コード例 #1
0
 // Token: 0x0600224A RID: 8778 RVA: 0x0009FE58 File Offset: 0x0009E058
 public override void CopyLog(long fromNumber, string destinationFileName, out DateTime writeTimeUtc)
 {
     writeTimeUtc = (DateTime)ExDateTime.UtcNow;
     ExTraceGlobals.LogCopyClientTracer.TraceDebug <string>((long)this.GetHashCode(), "CopyLog {0} starting", destinationFileName);
     base.AllocateBuffer();
     this.GetChannelLock();
     try
     {
         this.OpenChannelIfFirstRequest();
         CopyLogRequest msg = new CopyLogRequest(this.m_channel, this.DatabaseGuid, fromNumber);
         this.SendMessage(msg);
         ReplayStopwatch replayStopwatch = new ReplayStopwatch();
         replayStopwatch.Start();
         NetworkChannelMessage reply        = this.GetReply();
         CopyLogReply          copyLogReply = reply as CopyLogReply;
         if (copyLogReply == null)
         {
             this.m_channel.ThrowUnexpectedMessage(reply);
         }
         long elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;
         ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)this.GetHashCode(), "Log Copy Response took: {0}ms", elapsedMilliseconds);
         this.m_endOfLog.SetValue(copyLogReply.EndOfLogGeneration, new DateTime?(copyLogReply.EndOfLogUtc));
         writeTimeUtc = copyLogReply.LastWriteUtc;
         CheckSummer summer = null;
         if (this.m_channel.ChecksumDataTransfer)
         {
             summer = new CheckSummer();
         }
         copyLogReply.ReceiveFile(destinationFileName, null, summer);
         elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;
         ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)this.GetHashCode(), "Transmit/Decomp took: {0}ms", elapsedMilliseconds);
         base.RecordThruput(copyLogReply.FileSize);
         ExchangeNetworkPerfmonCounters perfCounters = this.m_channel.PerfCounters;
         if (perfCounters != null)
         {
             perfCounters.RecordLogCopyThruputReceived(copyLogReply.FileSize);
         }
         replayStopwatch.Stop();
         ExTraceGlobals.LogCopyClientTracer.TraceDebug((long)this.GetHashCode(), "{0}: LogCopy success: {1} for {2} after {3}ms", new object[]
         {
             ExDateTime.Now,
             replayStopwatch.ToString(),
             destinationFileName,
             replayStopwatch.ElapsedMilliseconds
         });
     }
     finally
     {
         this.ReleaseChannelLock();
     }
 }
コード例 #2
0
        // Token: 0x0600224B RID: 8779 RVA: 0x000A000C File Offset: 0x0009E20C
        internal static void CopyLog(Guid dbGuid, NetworkChannel ch, long logGen, string destinationFileName)
        {
            ExTraceGlobals.LogCopyClientTracer.TraceDebug <string>((long)ch.GetHashCode(), "static CopyLog {0} starting", destinationFileName);
            CopyLogRequest copyLogRequest = new CopyLogRequest(ch, dbGuid, logGen);

            copyLogRequest.Send();
            ReplayStopwatch replayStopwatch = new ReplayStopwatch();

            replayStopwatch.Start();
            NetworkChannelMessage message      = ch.GetMessage();
            CopyLogReply          copyLogReply = message as CopyLogReply;

            if (copyLogReply == null)
            {
                ch.ThrowUnexpectedMessage(message);
            }
            long elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;

            ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)ch.GetHashCode(), "Log Copy Response took: {0}ms", elapsedMilliseconds);
            CheckSummer summer = null;

            if (ch.ChecksumDataTransfer)
            {
                summer = new CheckSummer();
            }
            copyLogReply.ReceiveFile(destinationFileName, null, summer);
            elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;
            ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)ch.GetHashCode(), "Transmit/Decomp took: {0}ms", elapsedMilliseconds);
            ExchangeNetworkPerfmonCounters perfCounters = ch.PerfCounters;

            if (perfCounters != null)
            {
                perfCounters.RecordLogCopyThruputReceived(copyLogReply.FileSize);
            }
            replayStopwatch.Stop();
            ExTraceGlobals.LogCopyClientTracer.TraceDebug((long)ch.GetHashCode(), "{0}: LogCopy success: {1} for {2} after {3}ms", new object[]
            {
                ExDateTime.Now,
                replayStopwatch.ToString(),
                destinationFileName,
                replayStopwatch.ElapsedMilliseconds
            });
        }
コード例 #3
0
 // Token: 0x060017B3 RID: 6067 RVA: 0x00061F1C File Offset: 0x0006011C
 internal void ReceiveFile(string fullDestinationFileName, IPerfmonCounters copyPerfCtrs, CheckSummer summer)
 {
     this.ReceiveFile(fullDestinationFileName, null, copyPerfCtrs, summer);
 }
コード例 #4
0
 // Token: 0x060017B2 RID: 6066 RVA: 0x00061F03 File Offset: 0x00060103
 internal void ReceiveFile(string fullDestinationFileName, IReplicaSeederCallback callback, IPerfmonCounters copyPerfCtrs, CheckSummer summer)
 {
     this.DestinationFileName = fullDestinationFileName;
     this.m_channel.ReceiveFile(this, callback, copyPerfCtrs, summer);
 }
コード例 #5
0
        private LogCopyServerContext.SendLogStatus SendE00()
        {
            string text = this.Database.BuildLogFileName(0L);
            long   num  = 0L;
            FileIOonSourceException ex;

            if (this.m_dismountWorker == null)
            {
                ex = this.Database.GetE00Generation(out num, text);
            }
            else
            {
                ex = this.m_dismountWorker.LastE00ReadException;
            }
            if (ex != null)
            {
                bool      flag           = true;
                Exception innerException = ex.InnerException;
                if (innerException != null && innerException is EsentFileAccessDeniedException && !AmStoreServiceMonitor.WasKillTriggered())
                {
                    if (this.m_dismountWorker == null)
                    {
                        LogCopyServerContext.Tracer.TraceDebug((long)this.GetHashCode(), "SendE00(): E00 still in use so starting a DismountDatabaseOrKillStore() in background...");
                        this.m_dismountWorker = new DismountBackgroundWorker(new DismountBackgroundWorker.DismountDelegate(this.DismountDatabaseOrKillStore));
                        this.m_dismountWorker.LastE00ReadException = ex;
                        this.m_dismountWorker.Start();
                    }
                    if (this.m_dismountWorker.CompletedEvent.WaitOne(1000))
                    {
                        if (this.m_dismountWorker.DismountException == null)
                        {
                            flag = false;
                            LogCopyServerContext.Tracer.TraceDebug((long)this.GetHashCode(), "SendE00(): DismountDatabaseOrKillStore() operation completed successfully");
                        }
                        else
                        {
                            LogCopyServerContext.Tracer.TraceError <Exception>((long)this.GetHashCode(), "SendE00(): DismountDatabaseOrKillStore() operation completed but encountered an exception: {0}", this.m_dismountWorker.DismountException);
                        }
                        this.m_dismountWorker.Dispose();
                        this.m_dismountWorker = null;
                    }
                    else if ((ExDateTime.Now - this.m_dismountWorker.StartTime).TotalMilliseconds < (double)(RegistryParameters.AcllDismountOrKillTimeoutInSec2 * 1000))
                    {
                        return(LogCopyServerContext.SendLogStatus.KeepChannelAlive);
                    }
                }
                if (!flag)
                {
                    this.Database.ProbeForMoreLogs(this.m_currentLogGeneration);
                    return(LogCopyServerContext.SendLogStatus.KeepTrying);
                }
                this.HandleSourceReadError(ex);
                return(LogCopyServerContext.SendLogStatus.StopForException);
            }
            else if (num != this.m_currentLogGeneration)
            {
                LogCopyServerContext.Tracer.TraceDebug <long, long>((long)this.GetHashCode(), "SendE00 finds e00 at 0x{0:X} but expected 0x{1:X}", num, this.m_currentLogGeneration);
                if (num > this.m_currentLogGeneration)
                {
                    this.Database.SyncWithE00(num);
                    return(LogCopyServerContext.SendLogStatus.KeepTrying);
                }
                AcllFailedException e = new AcllFailedException(ReplayStrings.LogCopierE00InconsistentError(num, this.m_currentLogGeneration));
                this.SendException(e);
                return(LogCopyServerContext.SendLogStatus.StopForException);
            }
            else
            {
                Exception ex2 = null;
                try
                {
                    using (SafeFileHandle safeFileHandle = LogCopy.OpenLogForRead(text))
                    {
                        CopyLogReply copyLogReply = new CopyLogReply(this.Channel);
                        copyLogReply.ThisLogGeneration  = 0L;
                        copyLogReply.EndOfLogGeneration = num;
                        copyLogReply.EndOfLogUtc        = DateTime.UtcNow;
                        CheckSummer summer = null;
                        if (this.Channel.ChecksumDataTransfer)
                        {
                            summer = new CheckSummer();
                        }
                        this.Channel.SendLogFileTransferReply(copyLogReply, text, safeFileHandle, this.SourceDatabasePerfCounters, summer);
                    }
                }
                catch (IOException ex3)
                {
                    ex2 = new FileIOonSourceException(Environment.MachineName, text, ex3.Message, ex3);
                }
                catch (UnauthorizedAccessException ex4)
                {
                    ex2 = new FileIOonSourceException(Environment.MachineName, text, ex4.Message, ex4);
                }
                catch (FileIOonSourceException ex5)
                {
                    ex2 = ex5;
                }
                if (ex2 != null)
                {
                    this.HandleSourceReadError(ex2);
                    return(LogCopyServerContext.SendLogStatus.StopForException);
                }
                return(LogCopyServerContext.SendLogStatus.SentE00);
            }
        }
コード例 #6
0
        internal void SendLog(long logGen, NetworkChannel channel, SourceDatabasePerformanceCountersInstance perfCounters)
        {
            ReplayStopwatch replayStopwatch = new ReplayStopwatch();

            replayStopwatch.Start();
            string    text = this.BuildLogFileName(logGen);
            Exception ex   = null;

            try
            {
                using (SafeFileHandle safeFileHandle = LogCopy.OpenLogForRead(text))
                {
                    try
                    {
                        JET_LOGINFOMISC jet_LOGINFOMISC;
                        UnpublishedApi.JetGetLogFileInfo(text, out jet_LOGINFOMISC, JET_LogInfo.Misc2);
                        if (logGen != 0L && (long)jet_LOGINFOMISC.ulGeneration != logGen)
                        {
                            FileCheckLogfileGenerationException ex2 = new FileCheckLogfileGenerationException(text, (long)jet_LOGINFOMISC.ulGeneration, logGen);
                            CorruptLogDetectedException         ex3 = new CorruptLogDetectedException(text, ex2.Message, ex2);
                            throw new FileIOonSourceException(Environment.MachineName, text, ex3.Message, ex3);
                        }
                        JET_SIGNATURE?jet_SIGNATURE = null;
                        lock (this.m_sigLock)
                        {
                            if (this.m_logfileSignature == null)
                            {
                                this.m_logfileSignature = new JET_SIGNATURE?(jet_LOGINFOMISC.signLog);
                            }
                            jet_SIGNATURE = this.m_logfileSignature;
                        }
                        if (!jet_LOGINFOMISC.signLog.Equals(jet_SIGNATURE))
                        {
                            FileCheckLogfileSignatureException ex4 = new FileCheckLogfileSignatureException(text, jet_LOGINFOMISC.signLog.ToString(), jet_SIGNATURE.Value.ToString());
                            CorruptLogDetectedException        ex5 = new CorruptLogDetectedException(text, ex4.Message, ex4);
                            throw new FileIOonSourceException(Environment.MachineName, text, ex5.Message, ex5);
                        }
                    }
                    catch (EsentLogFileCorruptException ex6)
                    {
                        CorruptLogDetectedException ex7 = new CorruptLogDetectedException(text, ex6.Message, ex6);
                        throw new FileIOonSourceException(Environment.MachineName, text, ex7.Message, ex7);
                    }
                    EndOfLog     currentEndOfLog = this.CurrentEndOfLog;
                    CopyLogReply copyLogReply    = new CopyLogReply(channel);
                    copyLogReply.ThisLogGeneration  = logGen;
                    copyLogReply.EndOfLogGeneration = currentEndOfLog.Generation;
                    copyLogReply.EndOfLogUtc        = currentEndOfLog.Utc;
                    CheckSummer summer = null;
                    if (channel.ChecksumDataTransfer)
                    {
                        summer = new CheckSummer();
                    }
                    channel.SetupLogChecksummer(this.Config.LogFilePrefix);
                    channel.SendLogFileTransferReply(copyLogReply, text, safeFileHandle, perfCounters, summer);
                    MonitoredDatabase.Tracer.TracePerformance <long>((long)this.GetHashCode(), "CopyLogFile finished streaming after {0}ms.", replayStopwatch.ElapsedMilliseconds);
                }
            }
            catch (IOException ex8)
            {
                ex = ex8;
            }
            catch (UnauthorizedAccessException ex9)
            {
                ex = ex9;
            }
            catch (EsentErrorException ex10)
            {
                ex = ex10;
            }
            if (ex != null)
            {
                ExTraceGlobals.MonitoredDatabaseTracer.TraceError <string, Exception>((long)this.GetHashCode(), "SendLog({0}) failed: {1}", text, ex);
                throw new FileIOonSourceException(Environment.MachineName, text, ex.Message, ex);
            }
        }