Are ESENT records flushed to a disk when performing a commit/rollback?

230 views Asked by At

I'm making some tests using ManagedEsent interface and I wonder if someone here can clarify on this:

  • Inside a transaction I do an update(insert a record) and then rollback the transaction

If I look at the database with EseDatabaseView I can see the "uncommitted" record listed in the table. Going esent.dll again doesn't give me the record.

So, using the esent api the record is not committed (and not visible); and using EDV (I guess it reads directly from the file) the record is there.

Is this "normal" behaviour, does ESENT "always" write record into the file and if it is not committed it just does not reads it? Is it a bug in EDV showing it then? Or I'm missing something here?

2

There are 2 answers

2
Martin Chisholm On

Judging by the description of EseDatabaseView ('esent.dll (The dll file of Extensible Storage Engine) is not required to read the database.'), it sounds like they try to read the database file directly, not using the ESE APIs.

Is the database shut down cleanly first? Confirm with esentutl -mh [database name], which dumps the database header. Look for something like 'Dirty Shutdown' or 'Clean Shutdown'.

Dirty Shutdown: You may see transactions that have not been committed (or rolled back). You need the information in the transaction log files to bring it to a clean state. Clean Shutdown: Everything is in a clean state. You could potentially delete the log files if you want.

My guess is that the database was shut down in a dirty state, and the tool is reading the data that hasn't yet been rolled back.

-martin

1
Fotis MC On

As in most databases, esent is using transactions. They are stored in the LOG files that you can find in the same directory with the EDB file. If you want to access the data within the transaction LOG files, you need to flush them into the database. Use the following command to do that: eseutil /MH database.edb

More information about esent's transaction log: http://support.microsoft.com/kb/240145/en-us