ESnetMissingLogFIleException Current log file missing, when trying to open groove database

Nov 16, 2016 at 10:06 PM
Hi,

a while ago I posted already here (https://managedesent.codeplex.com/discussions/657317) that I am opening the ESENT Database of Groove Music - this was working fine for a while but now (I have nothing changed of corse, but when is it not like that as a developer ;) ) I get the following error in the Instance.Init Method:

EsnetMissingLogFileException
Current log file missing

Don't know if maybe the new Version of Groove changed this.
Here is my code, one info: I first copy the database directory of groove to make shure I do not destroy any files, that is why I need AlternateDatabaseRecoveryDirectory
 private Esent.Instance CreateEsnetInstance(string databaseDirPath)
        {
              SetIntegerParameter(Esent.JET_INSTANCE.Nil, Esent.JET_param.DatabasePageSize, 8192);
             var inst = new Esent.Instance(string.Format("GrooveMusicExporter{0}", Guid.NewGuid().ToString()));

            inst.Parameters.Recovery = true;
            inst.Parameters.LogFileDirectory = databaseDirPath;
            inst.Parameters.LogFileSize = 2048;
            inst.Parameters.BaseName = "edb";
            inst.Parameters.CircularLog = true;
            inst.Parameters.AlternateDatabaseRecoveryDirectory = databaseDirPath;

           inst.Init();
           ....
     }

        private void SetIntegerParameter(Esent.JET_INSTANCE inst, Esent.JET_param param, int value)
        {
            Esent.Api.JetSetSystemParameter(inst, Esent.JET_SESID.Nil, param, value, null);
        }
The file structure of the Database looks like this:

edb.chk
edb.log
edb00040.log
edb00041.log
edb00042.log
edb00043.log
edb00044.log
edbres00001.jrs
edbres00002.jrs
edbtmp.log
EntClientDb.edb
EntClientDb.jfm

Any Idea what the problem could be? - ESEDatabaseView can still open the database.

Thank you very much already for your help.
Developer
Nov 17, 2016 at 10:42 PM
AFAIK, EseDatabaseView doesn't use esent.dll, but has reverse-engineered the structure of the file. So you can't trust that to mean that it's a healthy database. :)

Look in the Application event viewer to determine the exact file that's missing.
Also try:
esentutl -mh EntClientDb.edb to look at the 'required' log range. Is it looking for generation 0x3f (it looks like your files start at generation 0x40 -- edb00040.log).
And esentutl -mk edb.chk to dump the checkpoint file. There are some rare cases where the checkpoint file is looking for logs that aren't actually needed by the database file. In that case, try copying all of the files somewhere as a backup, remove edb.chk, and run Log Replay manually: esentutl -r edb -l. -s. -d.


-martin
Nov 26, 2016 at 11:38 PM
Thank you again martinc for your help, I finally managed to check out the problem.

I could actually manage to make Groove recreate it's database but I'd still like to know how to solve this problem in Future:

I checked the cmd tools your recommended before but the output didn't help much.
You seem to be right it is about log generation. When I checked today again these were the log files (this time 3 log files):

edb0004D.log
edb0004E.log
edb0004F.log

esnetutl -mh EntClientDb.edb is written this:

Log Required: 80-80 (0x50-0x50)
Log Committed: 0-80 (0x0-0x50)
Log Recovering: 0 (0x0)
Log Consistent: 80 (0x50)

So normally you would expect him to look for 0005X.log files but the error in the event viewer is this:

GrooveMusicExporter.vshost (6780) GrooveMusicExporterbbe58692-f098-4ac9-8a20-5f158c7d41a5: Fehler -1811 (0xfffff8ed) beim Öffnen von Protokolldatei C:...\GrooveMusicExporter_96fd2352-063b-4aa5-90f5-d9852d8a5373\edb0001A.log.
Translation: beim Öffnen von Protokolldatei - at opening the protocol file,

So it seems he falls back to 1A logs because he can't find the right ones?

In my jouthfull naivity I tried renaming them to 5D, 5E, and 5F but this caused the same error, trying to rename the files to 1A, 1B and 1C caused the error:
GrooveMusicExporter.vshost (8748) GrooveMusicExporter8b8eee36-1831-47eb-9eac-abe6f7c5784e: Unerwarteter Fehler "-509" bei der Datenbankwiederherstellung.
Translation: Unerwarterer Fehler = Unexpected Error, bei der Datenbankwiederherstellung = at Database recovery.

Is there a way to tell him to change the log files he is looking for?

I Attached the full logs for info:
Thank you for your help again.

The recovery after deleting the edb.chk file (esentutl -r edb -l. -s. -d.) resulted in the following error:
Extensible Storage Engine Utilities for Microsoft(R) Windows(R)
Version 10.0
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initiating RECOVERY mode...
    Logfile base name: edb
            Log files: .
         System files: .
   Database Directory: .

Performing soft recovery...


        Recovery has indicated that there might be a lossy recovery option.  Run recovery with the /a argument.


Operation terminated with error -528 (JET_errMissingLogFile, Current log file missing) after 0.0 seconds.
The dump (-mh)
Initiating FILE DUMP mode...
         Database: C:\Users\...\GrooveMusicExporter_9eeb4bed-160a-4b50-939e-dae7f85fb9aa\EntClientDb.edb


DATABASE HEADER:
Checksum Information:
Expected Checksum: 0xe50fd427
  Actual Checksum: 0xe50fd427

Fields:
        File Type: Database
         Checksum: 0xe50fd427
   Format ulMagic: 0x89abcdef
   Engine ulMagic: 0x89abcdef
 Format ulVersion: 0x620,20,0  (attached by 0)
 Engine ulVersion: 0x620,30,40  (efvCurrent = 8960)
Created ulVersion: 0x620,20
     DB Signature: Create time:08/28/2016 16:00:49.738 Rand:3659995851 Computer:
         cbDbPage: 8192
           dbtime: 460598 (0x70736)
            State: Dirty Shutdown
     Log Required: 80-80 (0x50-0x50)
    Log Committed: 0-80 (0x0-0x50)
   Log Recovering: 0 (0x0)
   Log Consistent: 80 (0x50)
  GenMax Creation: 11/24/2016 23:55:55.771
         Shadowed: Yes
       Last Objid: 136
     Scrub Dbtime: 0 (0x0)
       Scrub Date: 00/00/1900 00:00:00
     Repair Count: 0
      Repair Date: 00/00/1900 00:00:00.000
 Old Repair Count: 0
  Last Consistent: (0x50,4B,31)  11/26/2016 22:29:24.191
      Last Attach: (0x50,4D,268)  11/26/2016 22:29:24.212
      Last Detach: (0x0,0,0)  00/00/1900 00:00:00.000
    Last ReAttach: (0x0,0,0)  00/00/1900 00:00:00.000
             Dbid: 1
    Log Signature: Create time:08/28/2016 16:00:49.723 Rand:347227430 Computer:
       OS Version: (10.0.14393 SP 0 NLS ffffffff.ffffffff)

Previous Full Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00.000

Previous Incremental Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00.000

Previous Copy Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00.000

Previous Differential Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00.000

Current Full Backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00.000

Current Shadow copy backup:
        Log Gen: 0-0 (0x0-0x0)
           Mark: (0x0,0,0)
           Mark: 00/00/1900 00:00:00.000

     cpgUpgrade55Format: 0
    cpgUpgradeFreePages: 0
cpgUpgradeSpaceMapPages: 0

       ECC Fix Success Count: none
   Old ECC Fix Success Count: none
         ECC Fix Error Count: none
     Old ECC Fix Error Count: none
    Bad Checksum Error Count: none
Old bad Checksum Error Count: none

  Last checksum finish Date: 00/00/1900 00:00:00.000
Current checksum start Date: 00/00/1900 00:00:00.000
      Current checksum page: 0

  Database Header Flush Signature: Create time:11/26/2016 22:29:28.780 Rand:2758432095 Computer:
 Flush Map Header Flush Signature: Create time:11/26/2016 22:29:26.323 Rand:2462744696 Computer:


Operation completed successfully in 0.47 seconds.
And the checkout file: (-mk)
Extensible Storage Engine Utilities for Microsoft(R) Windows(R)
Version 10.0
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initiating FILE DUMP mode...
      Checkpoint file: C:\Users\Michael Peter\AppData\Local\Temp\GrooveMusicExporter_96fd2352-063b-4aa5-90f5-d9852d8a5373\edb.chk

      LastFullBackupCheckpoint: (0x0,0,0)
      Checkpoint: (0x50,4C,0)
      DbConsistency: (0x50,54,F0)
      FullBackup: (0x0,0,0)
      FullBackup time: 00/00/1900 00:00:00.000
      IncBackup: (0x0,0,0)
      IncBackup time: 00/00/1900 00:00:00.000
      Signature: Create time:08/28/2016 16:00:49.723 Rand:347227430 Computer:
      Env (CircLog,Session,Opentbl,VerPage,Cursors,LogBufs,LogFile,Buffers)
          (     on,  30000,    300,    512,   1024,   4096,    512,2000000000)

Operation completed successfully in 0.0 seconds.


C:\Users\Michael Peter>