#1 2014-07-28 14:09:23

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

.sqlitedb-wal and .sqlitedb-shm leftover files, what might happened?

Arnaud,

I've noticed many times there are .sqlitedb-wal and .sqlitedb-shm leftover files. I use TSQLRestClientDB, I do have WAL enabled, with the intention of getting maximum stability; I do have have multiple threads starting/commiting transactions.

Any help would be appreciated!


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2014-07-28 14:13:03

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: .sqlitedb-wal and .sqlitedb-shm leftover files, what might happened?

additional info, My derived TransactionBegin() is protected with a TOmniMREW (mulit-reader-exclusive-writer) lock, like this:

function TDataStoreClient.TransactionBegin(aTable: TSQLRecordClass; SessionID:
    cardinal): boolean;
begin
  //if the db server is in the same process, we protect the writing operation from
  //being executed by multi threads.
  if IsServerInSameProcess then
    gAppScopeDbLock.EnterWriteLock; //this is an global lock

  result := inherited TransactionBegin(aTable, SessionID);
end;

procedure TDataStoreClient.Commit(SessionID: cardinal);
begin
  try
    inherited Commit(SessionID);
  finally
    if IsServerInSameProcess then
      gAppScopeDbLock.ExitWriteLock;
  end;
end;

Any logical problems in my derived TSQLRestClientDB class?


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#3 2014-07-28 16:42:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: .sqlitedb-wal and .sqlitedb-shm leftover files, what might happened?

We recommend not to use TransactionBegin from client sides, but a BATCH with a positive argument to BatchStart() for automatic transaction on the server side.

You should not need to do anything special on the client side for transaction protection.
It is already part of the TSQLRestServer.URI method, AFAIR.

Offline

#4 2014-07-29 03:41:44

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: .sqlitedb-wal and .sqlitedb-shm leftover files, what might happened?

Arnaud,

as per this discussion http://synopse.info/forum/viewtopic.php?id=1905

the URI methods doesn't return the actual database error, which we need.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#5 2014-07-29 05:57:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: .sqlitedb-wal and .sqlitedb-shm leftover files, what might happened?

Both BATCH and regular CRUD methods return an error code.
From the client point of view, it is enough to know if it succeeded or not.

Offline

#6 2014-07-29 06:45:57

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: .sqlitedb-wal and .sqlitedb-shm leftover files, what might happened?

Arnaud, this is not a real client/server app, but a single EXE USING TSQLRestClientDB, so it really need to handle the actual sqlite server. Do you think if I switch to TSQLRestServerDB will fix the problem?


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB