Exemple #1
0
        // Token: 0x060021B9 RID: 8633 RVA: 0x0009C9E4 File Offset: 0x0009ABE4
        private void HandlePreallocation(int copyCount)
        {
            int    num  = 50;
            string text = null;
            int    iobufferPoolPreallocationOverride = RegistryParameters.IOBufferPoolPreallocationOverride;

            if (iobufferPoolPreallocationOverride >= 0)
            {
                num  = iobufferPoolPreallocationOverride;
                text = string.Format("IOBufferPoolPreallocationOverride was used. BufCount={0}", iobufferPoolPreallocationOverride);
            }
            else
            {
                IMonitoringADConfig monitoringADConfig = null;
                try
                {
                    monitoringADConfig = Dependencies.MonitoringADConfigProvider.GetConfig(true);
                }
                catch (MonitoringADConfigException arg)
                {
                    IOBufferPool.Tracer.TraceError <MonitoringADConfigException>(0L, "IOBufferPool.HandlePreallocation failed to get adConfig: {0}", arg);
                    text = string.Format("Failed to get adConfig: {0}", arg);
                }
                if (monitoringADConfig == null)
                {
                    if (text == null)
                    {
                        text = "Failed to get adConfig but no exception was thrown";
                    }
                }
                else if (monitoringADConfig.ServerRole != MonitoringServerRole.DagMember)
                {
                    num  = 0;
                    text = string.Format("Non-DAG role: {0}", monitoringADConfig.ServerRole);
                }
                else
                {
                    IADServer srv = monitoringADConfig.LookupMiniServerByName(AmServerName.LocalComputerName);
                    int       maxMemoryPerDatabase  = PassiveBlockMode.GetMaxMemoryPerDatabase(srv);
                    int       maxBuffersPerDatabase = PassiveBlockMode.GetMaxBuffersPerDatabase(maxMemoryPerDatabase);
                    this.buffersPerCopy = maxBuffersPerDatabase;
                    IADDatabaseAvailabilityGroup dag = monitoringADConfig.Dag;
                    int num2 = 0;
                    if (dag.AutoDagTotalNumberOfServers > 0)
                    {
                        num2 = dag.AutoDagTotalNumberOfDatabases * dag.AutoDagDatabaseCopiesPerDatabase / dag.AutoDagTotalNumberOfServers;
                    }
                    text      = string.Format("BuffersPerCopy={0}. ExpectedCopiesPerServer={1} RIMgr reports {2} copies.", this.buffersPerCopy, num2, copyCount);
                    copyCount = Math.Max(copyCount, num2);
                    num       = copyCount * this.buffersPerCopy;
                }
            }
            if (num > this.maxBufferCount)
            {
                this.maxBufferCount = num;
            }
            this.Preallocate(num);
            ReplayCrimsonEvents.IoBufferPoolInit.Log <int, string>(num, text);
        }
Exemple #2
0
 public PassiveBlockMode(LogCopier copier, ISetBroken setBroken, int maxConsumerDepthInBytes)
 {
     this.Copier                    = copier;
     this.Configuration             = copier.Configuration;
     this.m_maxConsumerDepthInBytes = maxConsumerDepthInBytes;
     this.m_maxBuffersInUse         = PassiveBlockMode.GetMaxBuffersPerDatabase(this.m_maxConsumerDepthInBytes);
     this.m_consumer                = new GranularWriter(copier, copier.PerfmonCounters, copier.Configuration, setBroken);
     this.m_timer                   = new Timer(new TimerCallback(this.WakeUpCallback));
 }
Exemple #3
0
 public bool EnterBlockMode(EnterBlockModeMsg msg, NetworkChannel channel, int maxConsumerQDepth)
 {
     lock (this.m_workerLock)
     {
         Exception ex = null;
         try
         {
             if (msg.FirstGenerationToExpect != this.Copier.NextGenExpected)
             {
                 string text = string.Format("EnterBlockMode({0}) received gen 0x{1:X} but was expecting 0x{2:X}", this.DatabaseName, msg.FirstGenerationToExpect, this.Copier.NextGenExpected);
                 PassiveBlockMode.Tracer.TraceError((long)this.GetHashCode(), text);
                 throw new NetworkUnexpectedMessageException(this.Configuration.SourceMachine, text);
             }
             PassiveBlockMode.Tracer.TraceDebug <string, long>((long)this.GetHashCode(), "EnterBlockMode({0}) starts at gen 0x{1:X}", this.DatabaseName, msg.FirstGenerationToExpect);
             this.m_oldestMessage           = null;
             this.m_newestMessage           = null;
             this.m_maxConsumerDepthInBytes = maxConsumerQDepth;
             this.m_maxBuffersInUse         = PassiveBlockMode.GetMaxBuffersPerDatabase(this.m_maxConsumerDepthInBytes);
             this.m_consumer.Initialize();
             channel.KeepAlive = true;
             channel.NetworkChannelManagesAsyncReads = false;
             this.m_netChannel      = channel;
             this.IsBlockModeActive = true;
             this.Copier.PerfmonCounters.GranularReplication = 1L;
             this.Copier.PerfmonCounters.EncryptionEnabled   = (channel.IsEncryptionEnabled ? 1L : 0L);
             this.StartRead();
             msg.Send();
             this.ScheduleTimer();
             return(true);
         }
         catch (NetworkTransportException ex2)
         {
             ex = ex2;
         }
         catch (GranularReplicationTerminatedException ex3)
         {
             ex = ex3;
         }
         catch (GranularReplicationInitFailedException ex4)
         {
             ex = ex4;
         }
         finally
         {
             if (ex != null)
             {
                 PassiveBlockMode.Tracer.TraceError <Exception>((long)this.GetHashCode(), "EnterBlockMode failed: {0}", ex);
                 this.Terminate();
             }
             else
             {
                 PassiveBlockMode.Tracer.TraceDebug <string>((long)this.GetHashCode(), "EnterBlockMode({0}) succeeded", this.DatabaseName);
             }
         }
     }
     return(false);
 }
 public PassiveReadRequest(PassiveBlockMode mgr, NetworkChannel channel)
 {
     this.Channel = channel;
     this.Manager = mgr;
 }