JetRestoreInstance issue on WS2003

Apr 2, 2013 at 1:38 PM
Hi,

I got a problem with JetRestoreInstance. Same code is working flawlessly on Win7/Win8 but it crashes on WS2003 R2 (fully updated) - when I debug the whole application hangs at 52% (restore callback).

Can you advise?

Here is the code that is not working:
https://github.com/ppekrol/esent-ws2003-restore-issue
Developer
May 29, 2013 at 8:22 AM
I finally got a chance to look at this. Thanks a lot for the repro -- it was a huge help!

It is indeed a bug in esent.dll:
struct RSTMAP * 0x034db158
   +0x000 szDatabaseName   : 0x034ddd70  "C:\RavenDB\RavenDB-Build-2330\Server\Database\Databases\DB1\Data"
   +0x004 szNewDatabaseName : 0x034dddd8  "C:\investigate\ayende\esent-ws2003-restore-issue-master\EsentTest\bin\Debug\Restore\DB10Data"
   +0x008 szGenericName    : 0x034d0d60  "Data"
   +0x00c fDestDBReady     : 0n1
   +0x010 fSLVFile         : 0n0
   +0x014 signDatabase     : SIGNATURE
As you can see, the 'szNewDatabaseName' variable is wrong -- it's missing the backslash between 'DB10' and 'Data'.
My experience though was that it didn't hang; but it crashed.

Looking at the code, JetExternalRestore() may work around this bug (http://msdn.microsoft.com/en-us/library/windows/desktop/gg294088(v=exchg.10).aspx). It is implemented on Win2003, despite MSDN saying that it was introduced in Vista. But unfortunately it hasn't been added it to ManagedEsent.

-martin