//---------------------------------------------------------------------
        public static async Task <GrainStateCouchbaseDataManager> Initialize(CouchbaseClientSection configSection)
        {
            var instance = new GrainStateCouchbaseDataManager();
            var config   = new ClientConfiguration(configSection);

            Cluster = new Cluster(config);

            var    tcs = new TaskCompletionSource <IBucket>();
            Action initAction;

            if (configSection.Buckets.Count > 0)
            {
                var buckets = new BucketElement[configSection.Buckets.Count];
                configSection.Buckets.CopyTo(buckets, 0);

                var bucketSetting = buckets.First();
                initAction = () => { tcs.SetResult(Cluster.OpenBucket(bucketSetting.Name, bucketSetting.Password)); };
            }
            else
            {
                initAction = () => { tcs.SetResult(Cluster.OpenBucket()); };
            }

            WaitCallback initBucket = (state) =>
            {
                try { initAction(); }
                catch (Exception ex) { tcs.SetException(new Exception("GrainStateCouchbaseDataManager initialize exception", ex)); }
            };

            ThreadPool.QueueUserWorkItem(initBucket, null);

            instance.Bucket = await tcs.Task;

            return(instance);
        }
        /// <summary>
        /// For synchronization with App.config or Web.configs.
        /// </summary>
        /// <param name="couchbaseClientSection"></param>
        public ClientConfiguration(CouchbaseClientSection couchbaseClientSection)
        {
            //For operation timing
            Timer = TimingFactory.GetTimer(Log);

            UseSsl                = couchbaseClientSection.UseSsl;
            SslPort               = couchbaseClientSection.SslPort;
            ApiPort               = couchbaseClientSection.ApiPort;
            DirectPort            = couchbaseClientSection.DirectPort;
            MgmtPort              = couchbaseClientSection.MgmtPort;
            HttpsMgmtPort         = couchbaseClientSection.HttpsMgmtPort;
            HttpsApiPort          = couchbaseClientSection.HttpsApiPort;
            ObserveInterval       = couchbaseClientSection.ObserveInterval;
            ObserveTimeout        = couchbaseClientSection.ObserveTimeout;
            MaxViewRetries        = couchbaseClientSection.MaxViewRetries;
            ViewHardTimeout       = couchbaseClientSection.ViewHardTimeout;
            SerializationSettings = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            DeserializationSettings = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            EnableConfigHeartBeat   = couchbaseClientSection.EnableConfigHeartBeat;
            HeartbeatConfigInterval = couchbaseClientSection.HeartbeatConfigInterval;
            ViewRequestTimeout      = couchbaseClientSection.ViewRequestTimeout;
            Expect100Continue       = couchbaseClientSection.Expect100Continue;
            EnableOperationTiming   = couchbaseClientSection.EnableOperationTiming;
            PoolConfiguration       = new PoolConfiguration(this);

            foreach (var server in couchbaseClientSection.Servers)
            {
                Servers.Add(((UriElement)server).Uri);
                _serversChanged = true;
            }

            BucketConfigs = new Dictionary <string, BucketConfiguration>();
            foreach (var bucketElement in couchbaseClientSection.Buckets)
            {
                var bucket = (BucketElement)bucketElement;
                var bucketConfiguration = new BucketConfiguration
                {
                    BucketName        = bucket.Name,
                    UseSsl            = bucket.UseSsl,
                    Password          = bucket.Password,
                    ObserveInterval   = bucket.ObserveInterval,
                    ObserveTimeout    = bucket.ObserveTimeout,
                    PoolConfiguration = new PoolConfiguration
                    {
                        MaxSize             = bucket.ConnectionPool.MaxSize,
                        MinSize             = bucket.ConnectionPool.MinSize,
                        WaitTimeout         = bucket.ConnectionPool.WaitTimeout,
                        ShutdownTimeout     = bucket.ConnectionPool.ShutdownTimeout,
                        UseSsl              = bucket.ConnectionPool.UseSsl,
                        ClientConfiguration = this
                    }
                };
                BucketConfigs.Add(bucket.Name, bucketConfiguration);
            }
        }
 public DesignDocManager(string sectionName = "couchbase")
 {
     if (_cluster == null)
     {
         _config  = ConfigurationManager.GetSection(sectionName) as CouchbaseClientSection;
         _cluster = new CouchbaseCluster(_config);
     }
 }
        public void SetUp()
        {
            _endPoint = UriExtensions.GetEndPoint(_address);
            CouchbaseClientSection section = (CouchbaseClientSection)ConfigurationManager.GetSection("couchbaseClients/couchbase");

            _clientConfig   = new ClientConfiguration(section);
            _clusterManager = new ClusterController(_clientConfig);
        }
Beispiel #5
0
 public ViewRunner(string sectionName = "couchbase")
 {
     if (_client == null)
     {
         _config = ConfigurationManager.GetSection(sectionName) as CouchbaseClientSection;
         _client = new CouchbaseClient(_config);
     }
 }
        public void CouchbaseConfigurationSection_CorrectDefault()
        {
            var section = new CouchbaseClientSection();

            var config = new ClientConfiguration(section);

            config.Initialize();

            Assert.AreEqual(ServerConfigurationProviders.CarrierPublication | ServerConfigurationProviders.HttpStreaming,
                            config.ConfigurationProviders);
        }
        public void NetworkType_can_override_using_client_section(string networkType)
        {
            var section = new CouchbaseClientSection
            {
                NetworkType = networkType
            };

            var config = new ClientConfiguration(section);

            Assert.AreEqual(networkType, config.NetworkType);
        }
        public void OperationTracing_ClientSection_Can_Disable()
        {
            var section = new CouchbaseClientSection
            {
                OperationTracingEnabled = false
            };

            var config = new ClientConfiguration(section);

            Assert.IsInstanceOf <NoopTracer>(config.Tracer);
        }
        public void OperationTracing_ClientSection_Can_Disable()
        {
            var section = new CouchbaseClientSection
            {
                ResponseTimeObservabilityEnabled = false
            };

            var config = new ClientConfiguration(section);

            Assert.IsInstanceOf <NullTracer>(config.Tracer);
        }
Beispiel #10
0
        /// <summary>
        /// Initializes the CouchbaseStorage from the XML configuration section.
        /// </summary>
        /// <param name="sectionName">The xml configuration section name</param>
        /// <param name="defaultBucket">The default name of the bucket to use</param>
        /// <param name="options">The CouchbaseStorageOptions object to override any of the options</param>
        public CouchbaseStorage(string sectionName, string defaultBucket = "default", CouchbaseStorageOptions options = null)
        {
            if (string.IsNullOrEmpty(sectionName))
            {
                throw new ArgumentNullException(nameof(sectionName));
            }

            CouchbaseClientSection configurationSection = System.Configuration.ConfigurationManager.GetSection(sectionName) as CouchbaseClientSection;
            ClientConfiguration    configuration        = new ClientConfiguration(configurationSection);

            Initialize(configuration, defaultBucket, options);
        }
        public void CouchbaseConfigurationSection_ConfigurationProviders_Passthrough(ServerConfigurationProviders configurationProviders)
        {
            var section = new CouchbaseClientSection
            {
                ConfigurationProviders = configurationProviders
            };

            var config = new ClientConfiguration(section);

            config.Initialize();

            Assert.AreEqual(configurationProviders, config.ConfigurationProviders);
        }
        /// <summary>
        /// For synchronization with App.config or Web.configs.
        /// </summary>
        /// <param name="couchbaseClientSection"></param>
        internal ClientConfiguration(CouchbaseClientSection couchbaseClientSection)
        {
            UseSsl          = couchbaseClientSection.UseSsl;
            SslPort         = couchbaseClientSection.SslPort;
            ApiPort         = couchbaseClientSection.ApiPort;
            DirectPort      = couchbaseClientSection.DirectPort;
            MgmtPort        = couchbaseClientSection.MgmtPort;
            HttpsMgmtPort   = couchbaseClientSection.HttpsMgmtPort;
            HttpsApiPort    = couchbaseClientSection.HttpsApiPort;
            ObserveInterval = couchbaseClientSection.ObserveInterval;
            ObserveTimeout  = couchbaseClientSection.ObserveTimeout;
            MaxViewRetries  = couchbaseClientSection.MaxViewRetries;
            ViewHardTimeout = couchbaseClientSection.ViewHardTimeout;
            SerializationContractResolver   = new CamelCasePropertyNamesContractResolver();
            DeserializationContractResolver = new CamelCasePropertyNamesContractResolver();
            EnableConfigHeartBeat           = couchbaseClientSection.EnableConfigHeartBeat;
            HeartbeatConfigInterval         = couchbaseClientSection.HeartbeatConfigInterval;

            foreach (var server in couchbaseClientSection.Servers)
            {
                Servers.Add(((UriElement)server).Uri);
                _serversChanged = true;
            }
            foreach (var bucketElement in couchbaseClientSection.Buckets)
            {
                var bucket = (BucketElement)bucketElement;
                var bucketConfiguration = new BucketConfiguration
                {
                    BucketName        = bucket.Name,
                    UseSsl            = bucket.UseSsl,
                    Password          = bucket.Password,
                    ObserveInterval   = bucket.ObserveInterval,
                    ObserveTimeout    = bucket.ObserveTimeout,
                    PoolConfiguration = new PoolConfiguration
                    {
                        MaxSize         = bucket.ConnectionPool.MaxSize,
                        MinSize         = bucket.ConnectionPool.MinSize,
                        WaitTimeout     = bucket.ConnectionPool.WaitTimeout,
                        ShutdownTimeout = bucket.ConnectionPool.ShutdownTimeout,
                        UseSsl          = bucket.ConnectionPool.UseSsl,
                    }
                };
                BucketConfigs = new Dictionary <string, BucketConfiguration> {
                    { bucket.Name, bucketConfiguration }
                };
            }
        }
        public void OperationTracing_ClientSection_Default_Values()
        {
            var section = new CouchbaseClientSection();

            var config = new ClientConfiguration(section);

            Assert.IsInstanceOf <ThresholdLoggingTracer>(config.Tracer);

            var tracer = (ThresholdLoggingTracer)config.Tracer;

            Assert.AreEqual(10000, tracer.Interval);
            Assert.AreEqual(10, tracer.SampleSize);

            Assert.AreEqual(500000, tracer.KvThreshold);
            Assert.AreEqual(1000000, tracer.ViewThreshold);
            Assert.AreEqual(1000000, tracer.N1qlThreshold);
            Assert.AreEqual(1000000, tracer.SearchThreshold);
            Assert.AreEqual(1000000, tracer.AnalyticsThreshold);
        }
Beispiel #14
0
    public static bool BucketExists(this CouchbaseClient client, CouchbaseClientSection section = null)
    {
        section = section ?? (CouchbaseClientSection)ConfigurationManager.GetSection("couchbase");

        var webClient = new WebClient();
        var bucketUri = section.Servers.Urls.ToUriCollection().First().AbsoluteUri;
        var response  = webClient.DownloadString(bucketUri + "/buckets");
        var jss       = new JavaScriptSerializer();
        var jArray    = jss.DeserializeObject(response) as object[];

        foreach (var item in jArray)
        {
            var jDict  = item as Dictionary <string, object>;
            var bucket = jDict.Single(kv => kv.Key == "name").Value as string;
            if (bucket == section.Servers.Bucket)
            {
                return(true);
            }
        }
        return(false);
    }
Beispiel #15
0
        public void OperationTracing_ClientSection_Default_Values()
        {
            var section = new CouchbaseClientSection();

            var config = new ClientConfiguration(section);

            Assert.IsInstanceOf <NullTracer>(config.Tracer);

            //var tracer = (ThresholdLoggingTracer) config.Tracer;
            //Assert.AreEqual(10000, tracer.Interval);
            //Assert.AreEqual(10, tracer.SampleSize);

            //var serviceFloors = new Dictionary<string, int>
            //{
            //    {"kv", 500000}, // 500 milliseconds
            //    {"view", 1000000}, // 1 second
            //    {"n1ql", 1000000}, // 1 second
            //    {"search", 1000000}, // 1 second
            //    {"analytics", 1000000} // 1 second
            //};
            //Assert.AreEqual(serviceFloors, tracer.ServiceFloors);
        }
 /// <summary>
 /// For synchronization with App.config or Web.configs.
 /// </summary>
 /// <param name="couchbaseClientSection"></param>
 internal ClientConfiguration(CouchbaseClientSection couchbaseClientSection)
 {
     UseSsl        = couchbaseClientSection.UseSsl;
     SslPort       = couchbaseClientSection.SslPort;
     ApiPort       = couchbaseClientSection.ApiPort;
     DirectPort    = couchbaseClientSection.DirectPort;
     MgmtPort      = couchbaseClientSection.MgmtPort;
     HttpsMgmtPort = couchbaseClientSection.HttpsMgmtPort;
     HttpsApiPort  = couchbaseClientSection.HttpsApiPort;
     Servers       = new List <Uri>();
     foreach (var server in couchbaseClientSection.Servers)
     {
         Servers.Add(((UriElement)server).Uri);
     }
     foreach (var bucketElement in couchbaseClientSection.Buckets)
     {
         var bucket = (BucketElement)bucketElement;
         var bucketConfiguration = new BucketConfiguration
         {
             BucketName        = bucket.Name,
             UseSsl            = bucket.UseSsl,
             Password          = bucket.Password,
             PoolConfiguration = new PoolConfiguration
             {
                 MaxSize         = bucket.ConnectionPool.MaxSize,
                 MinSize         = bucket.ConnectionPool.MinSize,
                 WaitTimeout     = bucket.ConnectionPool.WaitTimeout,
                 ShutdownTimeout = bucket.ConnectionPool.ShutdownTimeout,
                 UseSsl          = bucket.ConnectionPool.UseSsl,
             }
         };
         BucketConfigs = new Dictionary <string, BucketConfiguration> {
             { bucket.Name, bucketConfiguration }
         };
     }
 }
Beispiel #17
0
        /// <summary>
        /// For synchronization with App.config or Web.configs.
        /// </summary>
        /// <param name="section"></param>
        public ClientConfiguration(CouchbaseClientSection section)
        {
            Timer = TimingFactory.GetTimer(Log);

            UseSsl                = section.UseSsl;
            SslPort               = section.SslPort;
            ApiPort               = section.ApiPort;
            DirectPort            = section.DirectPort;
            MgmtPort              = section.MgmtPort;
            HttpsMgmtPort         = section.HttpsMgmtPort;
            HttpsApiPort          = section.HttpsApiPort;
            ObserveInterval       = section.ObserveInterval;
            ObserveTimeout        = section.ObserveTimeout;
            MaxViewRetries        = section.MaxViewRetries;
            ViewHardTimeout       = section.ViewHardTimeout;
            SerializationSettings = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            DeserializationSettings = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            EnableConfigHeartBeat    = section.EnableConfigHeartBeat;
            HeartbeatConfigInterval  = section.HeartbeatConfigInterval;
            ViewRequestTimeout       = section.ViewRequestTimeout;
            Expect100Continue        = section.Expect100Continue;
            EnableOperationTiming    = section.EnableOperationTiming;
            PoolConfiguration        = new PoolConfiguration(this);
            DefaultOperationLifespan = section.OperationLifespan;

            //transcoders, converters, and serializers...o mai.
            Serializer = SerializerFactory.GetSerializer(this, section.Serializer);
            Converter  = ConverterFactory.GetConverter(section.Converter);
            Transcoder = TranscoderFactory.GetTranscoder(this, section.Transcoder);

            //to enable tcp keep-alives
            EnableTcpKeepAlives  = section.EnableTcpKeepAlives;
            TcpKeepAliveInterval = section.TcpKeepAliveInterval;
            TcpKeepAliveTime     = section.TcpKeepAliveTime;

            var keepAlivesChanged = EnableTcpKeepAlives != true ||
                                    TcpKeepAliveInterval != 1000 ||
                                    TcpKeepAliveTime != 2 * 60 * 60 * 1000;

            foreach (var server in section.Servers)
            {
                Servers.Add(((UriElement)server).Uri);
                _serversChanged = true;
            }

            BucketConfigs = new Dictionary <string, BucketConfiguration>();
            foreach (var bucketElement in section.Buckets)
            {
                var bucket = (BucketElement)bucketElement;
                var bucketConfiguration = new BucketConfiguration
                {
                    BucketName               = bucket.Name,
                    UseSsl                   = bucket.UseSsl,
                    Password                 = bucket.Password,
                    ObserveInterval          = bucket.ObserveInterval,
                    DefaultOperationLifespan = bucket.OperationLifespan ?? (uint)DefaultOperationLifespan,
                    ObserveTimeout           = bucket.ObserveTimeout,
                    PoolConfiguration        = new PoolConfiguration
                    {
                        MaxSize              = bucket.ConnectionPool.MaxSize,
                        MinSize              = bucket.ConnectionPool.MinSize,
                        WaitTimeout          = bucket.ConnectionPool.WaitTimeout,
                        ShutdownTimeout      = bucket.ConnectionPool.ShutdownTimeout,
                        UseSsl               = bucket.ConnectionPool.UseSsl,
                        BufferSize           = bucket.ConnectionPool.BufferSize,
                        BufferAllocator      = (p) => new BufferAllocator(p.MaxSize * p.BufferSize, p.BufferSize),
                        ConnectTimeout       = bucket.ConnectionPool.ConnectTimeout,
                        SendTimeout          = bucket.ConnectionPool.SendTimeout,
                        EnableTcpKeepAlives  = keepAlivesChanged ? EnableTcpKeepAlives : bucket.ConnectionPool.EnableTcpKeepAlives,
                        TcpKeepAliveInterval = keepAlivesChanged ? TcpKeepAliveInterval : bucket.ConnectionPool.TcpKeepAliveInterval,
                        TcpKeepAliveTime     = keepAlivesChanged ? TcpKeepAliveTime : bucket.ConnectionPool.TcpKeepAliveTime,
                        CloseAttemptInterval = bucket.ConnectionPool.CloseAttemptInterval,
                        MaxCloseAttempts     = bucket.ConnectionPool.MaxCloseAttempts,
                        ClientConfiguration  = this
                    }
                };
                BucketConfigs.Add(bucket.Name, bucketConfiguration);
            }

            //Set back to default
            _operationLifespanChanged = false;
            _poolConfigurationChanged = false;
        }
 /// <summary>
 /// For synchronization with App.config or Web.configs.
 /// </summary>
 /// <param name="section"></param>
 public ClientConfiguration(CouchbaseClientSection section) : this((ICouchbaseClientDefinition)section)
 {
 }
        /// <summary>
        /// For synchronization with App.config or Web.configs.
        /// </summary>
        /// <param name="section"></param>
        public ClientConfiguration(CouchbaseClientSection section)
        {
            Timer = TimingFactory.GetTimer(Log);
            NodeAvailableCheckInterval = section.NodeAvailableCheckInterval;
            UseSsl                = section.UseSsl;
            SslPort               = section.SslPort;
            ApiPort               = section.ApiPort;
            DirectPort            = section.DirectPort;
            MgmtPort              = section.MgmtPort;
            HttpsMgmtPort         = section.HttpsMgmtPort;
            HttpsApiPort          = section.HttpsApiPort;
            ObserveInterval       = section.ObserveInterval;
            ObserveTimeout        = section.ObserveTimeout;
            MaxViewRetries        = section.MaxViewRetries;
            ViewHardTimeout       = section.ViewHardTimeout;
            SerializationSettings = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            DeserializationSettings = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            EnableConfigHeartBeat    = section.EnableConfigHeartBeat;
            HeartbeatConfigInterval  = section.HeartbeatConfigInterval;
            ViewRequestTimeout       = section.ViewRequestTimeout;
            Expect100Continue        = section.Expect100Continue;
            EnableOperationTiming    = section.EnableOperationTiming;
            DefaultOperationLifespan = section.OperationLifespan;
            QueryRequestTimeout      = section.QueryRequestTimeout;
            IOErrorCheckInterval     = section.IOErrorCheckInterval;
            IOErrorThreshold         = section.IOErrorThreshold;

            //transcoders, converters, and serializers...o mai.
            Serializer = SerializerFactory.GetSerializer(this, section.Serializer);
            Converter  = ConverterFactory.GetConverter(section.Converter);
            Transcoder = TranscoderFactory.GetTranscoder(this, section.Transcoder);

            //to enable tcp keep-alives
            EnableTcpKeepAlives  = section.EnableTcpKeepAlives;
            TcpKeepAliveInterval = section.TcpKeepAliveInterval;
            TcpKeepAliveTime     = section.TcpKeepAliveTime;

            var keepAlivesChanged = EnableTcpKeepAlives != true ||
                                    TcpKeepAliveInterval != 1000 ||
                                    TcpKeepAliveTime != 2 * 60 * 60 * 1000;

            foreach (var server in section.Servers)
            {
                Servers.Add(((UriElement)server).Uri);
                _serversChanged = true;
            }

            PoolConfiguration = new PoolConfiguration
            {
                MaxSize              = section.ConnectionPool.MaxSize,
                MinSize              = section.ConnectionPool.MinSize,
                WaitTimeout          = section.ConnectionPool.WaitTimeout,
                ShutdownTimeout      = section.ConnectionPool.ShutdownTimeout,
                UseSsl               = section.ConnectionPool.UseSsl,
                BufferSize           = section.ConnectionPool.BufferSize,
                BufferAllocator      = (p) => new BufferAllocator(p.MaxSize * p.BufferSize, p.BufferSize),
                ConnectTimeout       = section.ConnectionPool.ConnectTimeout,
                SendTimeout          = section.ConnectionPool.SendTimeout,
                EnableTcpKeepAlives  = keepAlivesChanged ? EnableTcpKeepAlives : section.ConnectionPool.EnableTcpKeepAlives,
                TcpKeepAliveInterval = keepAlivesChanged ? TcpKeepAliveInterval : section.ConnectionPool.TcpKeepAliveInterval,
                TcpKeepAliveTime     = keepAlivesChanged ? TcpKeepAliveTime : section.ConnectionPool.TcpKeepAliveTime,
                CloseAttemptInterval = section.ConnectionPool.CloseAttemptInterval,
                MaxCloseAttempts     = section.ConnectionPool.MaxCloseAttempts,
                ClientConfiguration  = this
            };

            BucketConfigs = new Dictionary <string, BucketConfiguration>();
            foreach (var bucketElement in section.Buckets)
            {
                var bucket = (BucketElement)bucketElement;
                var bucketConfiguration = new BucketConfiguration
                {
                    BucketName               = bucket.Name,
                    UseSsl                   = bucket.UseSsl,
                    Password                 = bucket.Password,
                    ObserveInterval          = bucket.ObserveInterval,
                    DefaultOperationLifespan = bucket.OperationLifespan ?? (uint)DefaultOperationLifespan,
                    ObserveTimeout           = bucket.ObserveTimeout,
                    UseEnhancedDurability    = bucket.UseEnhancedDurability
                };
                //Configuration properties (including elements) can not be null, but we can check if it was originally presnt in xml and skip it.
                //By skipping the bucket specific connection pool settings we allow inheritance from clien-wide connection pool settings.
                if (bucket.ConnectionPool.ElementInformation.IsPresent)
                {
                    bucketConfiguration.PoolConfiguration = new PoolConfiguration
                    {
                        MaxSize             = bucket.ConnectionPool.MaxSize,
                        MinSize             = bucket.ConnectionPool.MinSize,
                        WaitTimeout         = bucket.ConnectionPool.WaitTimeout,
                        ShutdownTimeout     = bucket.ConnectionPool.ShutdownTimeout,
                        UseSsl              = bucket.ConnectionPool.UseSsl,
                        BufferSize          = bucket.ConnectionPool.BufferSize,
                        BufferAllocator     = (p) => new BufferAllocator(p.MaxSize * p.BufferSize, p.BufferSize),
                        ConnectTimeout      = bucket.ConnectionPool.ConnectTimeout,
                        SendTimeout         = bucket.ConnectionPool.SendTimeout,
                        EnableTcpKeepAlives =
                            keepAlivesChanged ? EnableTcpKeepAlives : bucket.ConnectionPool.EnableTcpKeepAlives,
                        TcpKeepAliveInterval =
                            keepAlivesChanged ? TcpKeepAliveInterval : bucket.ConnectionPool.TcpKeepAliveInterval,
                        TcpKeepAliveTime      = keepAlivesChanged ? TcpKeepAliveTime : bucket.ConnectionPool.TcpKeepAliveTime,
                        CloseAttemptInterval  = bucket.ConnectionPool.CloseAttemptInterval,
                        MaxCloseAttempts      = bucket.ConnectionPool.MaxCloseAttempts,
                        UseEnhancedDurability = bucket.UseEnhancedDurability,
                        ClientConfiguration   = this
                    };
                }
                else
                {
                    bucketConfiguration.PoolConfiguration = PoolConfiguration;
                }
                BucketConfigs.Add(bucket.Name, bucketConfiguration);
            }

            //Set back to default
            _operationLifespanChanged = false;
            _poolConfigurationChanged = false;
        }