// Token: 0x06000956 RID: 2390 RVA: 0x0002BC3C File Offset: 0x00029E3C public byte[] ReadOnePage(long pageNumber, out long lowGen, out long highGen) { if (pageNumber < 1L) { throw new ArgumentOutOfRangeException(string.Format(CultureInfo.CurrentCulture, "pageNumber is {0}, must be >= 1 ", new object[] { pageNumber })); } byte[] result = new byte[this.m_pageSize]; long num2; int num = CReplicaSeederInterop.OnlineGetDatabasePages(this.handle, this.m_dbPath, (ulong)pageNumber, 1UL, (ulong)this.m_pageSize, out result, out num2, out lowGen, out highGen); if (num == -4001) { throw new JetErrorFileIOBeyondEOFException(pageNumber.ToString()); } if (num != 0) { throw new FailedToReadDatabasePage(num); } DiagCore.RetailAssert(num2 == this.m_pageSize, "cRead {0} != m_pageSize {1}", new object[] { num2, this.m_pageSize }); return(result); }
// Token: 0x06000953 RID: 2387 RVA: 0x0002BB40 File Offset: 0x00029D40 private static EseDatabaseReader BuildEseDatabaseReader(string serverName, Guid dbGuid, string dbName, string dbPath) { EseDatabaseReader eseDatabaseReader = new EseDatabaseReader(dbName, dbGuid); SafeBackupContextHandle safeBackupContextHandle = eseDatabaseReader; SafeBackupContextHandle.GetAndSetIntPtrInCER(serverName, dbName, null, ref safeBackupContextHandle); bool flag = false; try { JET_DBINFOMISC jet_DBINFOMISC; int databaseInfo = CReplicaSeederInterop.GetDatabaseInfo(eseDatabaseReader.handle, dbPath, out jet_DBINFOMISC); if (databaseInfo != 0) { throw new FailedToGetDatabaseInfo(databaseInfo); } eseDatabaseReader.m_pageSize = (long)jet_DBINFOMISC.cbPageSize; eseDatabaseReader.m_dbPath = dbPath; if (jet_DBINFOMISC.cbPageSize != 4096 && jet_DBINFOMISC.cbPageSize != 8192 && jet_DBINFOMISC.cbPageSize != 32768) { throw new UnExpectedPageSizeException(dbPath, (long)jet_DBINFOMISC.cbPageSize); } flag = true; } finally { if (!flag) { eseDatabaseReader.ReleaseHandle(); } } return(eseDatabaseReader); }
// Token: 0x0600094E RID: 2382 RVA: 0x0002BA7C File Offset: 0x00029C7C protected override bool ReleaseHandle() { int num = CReplicaSeederInterop.CloseBackupContext(this.handle, this.m_ecLast); if (num != 0) { ExTraceGlobals.SeederServerTracer.TraceError <string, int>((long)this.GetHashCode(), "CloseBackupContext() for database '{0}' failed with error code {1}", this.DatabaseName, num); ReplayCrimsonEvents.BackupHandleCloseFailed.Log <Guid, string, string>(this.DatabaseGuid, this.DatabaseName, string.Format("CloseBackupContext() failed with error code {0}", num)); } return(num == 0); }
private static EseDatabaseBackupReader OpenSeedStreamer(Guid dbGuid, uint readHintSize, out long initialFileSizeBytes) { string machineName = Environment.MachineName; initialFileSizeBytes = 0L; string dbName; string sourceFileToBackupFullPath; SeedHelper.GetDatabaseNameAndPath(dbGuid, out dbName, out sourceFileToBackupFullPath); CReplicaSeederInterop.SetupNativeLogger(); EseDatabaseBackupReader esedatabaseBackupReader = EseDatabaseBackupReader.GetESEDatabaseBackupReader(machineName, dbName, dbGuid, null, sourceFileToBackupFullPath, readHintSize); initialFileSizeBytes = esedatabaseBackupReader.SourceFileSizeBytes; return(esedatabaseBackupReader); }
// Token: 0x06001A2E RID: 6702 RVA: 0x0006DCE8 File Offset: 0x0006BEE8 public int PerformDatabaseRead(long readOffset, byte[] buffer, int bytesToRead) { int num = bytesToRead; int num2 = CReplicaSeederInterop.PerformDatabaseRead(this.handle, this.m_backupFileHandle, readOffset, buffer, ref num); if (num2 != 0) { if (num2 == 38) { ExTraceGlobals.SeederServerTracer.TraceError <string, int>((long)this.GetHashCode(), "Reading the database '{0}' encountered the end of the file: {1}.", base.DatabaseName, num2); } else { ExTraceGlobals.SeederServerTracer.TraceError <string, int>((long)this.GetHashCode(), "Reading the database '{0}' encountered an error: {1}.", base.DatabaseName, num2); } throw new IOException(string.Format("EseDatabaseBackupReader: PerformDatabaseRead failed with error code 0x{0:X}. Expected {1} bytes read, but actually only {2} were read.", num2, bytesToRead, num)); } return(num); }
// Token: 0x06001A2C RID: 6700 RVA: 0x0006DC38 File Offset: 0x0006BE38 protected override bool ReleaseHandle() { bool result = true; if (!this.IsInvalid) { if (this.m_backupFileHandle != IntPtr.Zero) { int num = CReplicaSeederInterop.CloseBackupFileHandle(this.handle, this.m_backupFileHandle); this.m_backupFileHandle = IntPtr.Zero; if (num != 0) { ExTraceGlobals.SeederServerTracer.TraceError <string, int>((long)this.GetHashCode(), "CloseBackupFileHandle() for database '{0}' failed with error code {1}", base.DatabaseName, num); ReplayCrimsonEvents.BackupHandleCloseFailed.Log <Guid, string, string>(base.DatabaseGuid, base.DatabaseName, string.Format("CloseBackupFileHandle() failed with error code {0}", num)); } } result = base.ReleaseHandle(); base.SetHandleAsInvalid(); EseDatabaseBackupReader.CleanupNativeLogger(); } return(result); }
// Token: 0x06001A2F RID: 6703 RVA: 0x0006DD74 File Offset: 0x0006BF74 public static EseDatabaseBackupReader GetESEDatabaseBackupReader(string serverName, string dbName, Guid dbGuid, string transferAddress, string sourceFileToBackupFullPath, uint readHintSizeBytes) { bool flag = false; int num = 0; IntPtr value = new IntPtr(-1); EseDatabaseBackupReader eseDatabaseBackupReader = new EseDatabaseBackupReader(dbName, dbGuid); SafeBackupContextHandle safeBackupContextHandle = eseDatabaseBackupReader; EseDatabaseBackupReader result; try { EseDatabaseBackupReader.SetupNativeLogger(); SafeBackupContextHandle.GetAndSetIntPtrInCER(serverName, dbName, transferAddress, ref safeBackupContextHandle); flag = true; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { num = CReplicaSeederInterop.OpenBackupFileHandle(eseDatabaseBackupReader.handle, sourceFileToBackupFullPath, readHintSizeBytes, out eseDatabaseBackupReader.m_backupFileHandle, out eseDatabaseBackupReader.m_sourceFileSizeBytes); } if (num != 0 || eseDatabaseBackupReader.m_backupFileHandle == IntPtr.Zero || eseDatabaseBackupReader.m_backupFileHandle == value) { eseDatabaseBackupReader.Close(); throw new FailedToOpenBackupFileHandleException(dbName, serverName, num, SeedHelper.TranslateSeederErrorCode((long)num, serverName)); } result = eseDatabaseBackupReader; } finally { if (!flag) { EseDatabaseBackupReader.CleanupNativeLogger(); } } return(result); }
// Token: 0x06001A31 RID: 6705 RVA: 0x0006DE3B File Offset: 0x0006C03B public static void CleanupNativeLogger() { CReplicaSeederInterop.CleanupNativeLogger(); }
// Token: 0x06001A30 RID: 6704 RVA: 0x0006DE34 File Offset: 0x0006C034 public static void SetupNativeLogger() { CReplicaSeederInterop.SetupNativeLogger(); }
// Token: 0x06000955 RID: 2389 RVA: 0x0002BC15 File Offset: 0x00029E15 public void ForceNewLog() { ExTraceGlobals.IncrementalReseederTracer.TraceDebug((long)this.GetHashCode(), "rolling a log file"); CReplicaSeederInterop.ForceNewLog(this.handle); }
// Token: 0x0600094F RID: 2383 RVA: 0x0002BAE8 File Offset: 0x00029CE8 protected int GetBackupContextIntPtr(string serverName, string dbName, string transferAddress, out IntPtr hContext) { hContext = IntPtr.Zero; return(CReplicaSeederInterop.OpenBackupContext(serverName, dbName, transferAddress, this.m_dbGuid, out hContext)); }