2016-07-26 20 views
1

これまでのところ、(古い)バージョンのCouchbaseから最新のバージョンにアップグレードすることには様々な理由があります。残念ながら、現在.NET用のCouchbase Client SDKのv1.1.6を使用しています。 v2.3.4への移行は現在、すべて設定を中心に、多くの急速な変更をもたらすようです。CouchbaseClientConfigurationからSDKのClientConfigurationへの移行

我々は(もBucketConfigurationPoolConfigurationで)ClientConfigurationで今取って代わられているように見える古いCouchbaseClientConfigurationタイプを使用するために使用。私はほとんどの設定自体を移行することができましたが、現在は不明な点はタイムアウトです。

それがフックアップするために使用方法の例:

var clientConfiguration = new CouchbaseClientConfiguration() 
    { 
     Bucket = MembaseBucketName, 
     BucketPassword = MembaseBucketPassword 
    }; 

foreach (string host in root.Elements("servers").Elements("add").Attributes("uri")) 
{ 
    clientConfiguration.Servers.Add(new Uri(host)); 
} 

// <servers retryCount="3" retryTimeout="00:00:30" > 
clientConfiguration.RetryTimeout = TimeSpan.Parse(root.Element("servers").Attribute("retryTimeout").Value); 
clientConfiguration.RetryCount = Convert.ToInt32(root.Element("servers").Attribute("retryCount").Value); 

// <socketPool minPoolSize="10" maxPoolSize="10" connectionTimeout="00:00:30" deadTimeout="00:00:30" queueTimeout="00:00:30" receiveTimeout="00:00:30" />  
clientConfiguration.SocketPool.MinPoolSize = 
    Convert.ToInt32(root.Element("socketPool").Attribute("minPoolSize").Value); 
clientConfiguration.SocketPool.MaxPoolSize = 
    Convert.ToInt32(root.Element("socketPool").Attribute("maxPoolSize").Value); 
clientConfiguration.SocketPool.ConnectionTimeout = 
    TimeSpan.Parse(root.Element("socketPool").Attribute("connectionTimeout").Value); 
clientConfiguration.SocketPool.DeadTimeout = 
    TimeSpan.Parse(root.Element("socketPool").Attribute("deadTimeout").Value); 
clientConfiguration.SocketPool.QueueTimeout = 
    TimeSpan.Parse(root.Element("socketPool").Attribute("queueTimeout").Value); 
clientConfiguration.SocketPool.ReceiveTimeout = 
    TimeSpan.Parse(root.Element("socketPool").Attribute("receiveTimeout").Value); 

そして、これは私がこれまでに翻訳するために管理してきたものである:

var clientConfiguration = new ClientConfiguration 
{ 
    BucketConfigs = new Dictionary<string, BucketConfiguration> 
    { 
     { 
      MembaseBucketName, 
      new BucketConfiguration 
      { 
       BucketName = MembaseBucketName, 
       Password = MembaseBucketPassword, 
       Servers = root.Elements("servers").Elements("add").Attributes("uri").ToList(_ => new Uri(_.Value)), 
       PoolConfiguration = new PoolConfiguration 
       { 
        MinSize = Convert.ToInt32(root.Element("socketPool").Attribute("minPoolSize").Value), 
        MaxSize = Convert.ToInt32(root.Element("socketPool").Attribute("maxPoolSize").Value), 
        ConnectTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("connectionTimeout").Value).TotalMilliseconds, 
        WaitTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("queueTimeout").Value).TotalMilliseconds, 
       }, 
       DefaultOperationLifespan = (uint)TimeSpan.Parse(root.Element("socketPool").Attribute("receiveTimeout").Value).TotalMilliseconds, 
      } 
     }, 
    }, 
}; 

は、私たちは、指定するために使用:QueueTimeoutDeadTimeoutReceiveTimeout,ConnectionTimeout,RetryTimeoutおよびRetryCountである。これらはどこに移行しますか?私は彼らが新しいコードで同等のプロパティを持っているか、またはそれらの周りのコンセプトが変更されていると思います。

また、ServersPoolConfigurationの設定はどこにありますか?それらはClientConfigurationBucketConfigurationで利用できます。少数のサーバーURIを使用して1つのバケットしか実行しないので、全体の構成は複雑ではありません。

答えて

2

私が知る限り、私は以前はかなり近くでした。

  • retryCountの数:archived docsに言う

    var clientConfiguration = new ClientConfiguration 
    { 
        BucketConfigs = new Dictionary<string, BucketConfiguration> 
        { 
         { 
          MembaseBucketName, 
          new BucketConfiguration 
          { 
           BucketName = MembaseBucketName, 
           Password = MembaseBucketPassword, 
           Servers = root.Elements("servers").Elements("add").Attributes("uri").ToList(_ => new Uri(_.Value)), 
           PoolConfiguration = new PoolConfiguration 
           { 
            MinSize = Convert.ToInt32(root.Element("socketPool").Attribute("minPoolSize").Value), 
            MaxSize = Convert.ToInt32(root.Element("socketPool").Attribute("maxPoolSize").Value), 
            ConnectTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("connectionTimeout").Value).TotalMilliseconds, 
            WaitTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("queueTimeout").Value).TotalMilliseconds, 
            SendTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("receiveTimeout").Value).TotalMilliseconds, 
           }, 
           DefaultOperationLifespan = (uint)TimeSpan.Parse(root.Element("socketPool").Attribute("receiveTimeout").Value).TotalMilliseconds, // Belt and braces. 
          } 
         }, 
        }, 
        ViewRequestTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("receiveTimeout").Value).TotalMilliseconds, // Belt and braces. 
    }; 
    
    もうDeadTimeoutのための同等はないように見える

    、またRetryCountRetryTimeoutは、ためのものです:私は何をしてしまったことは、このました失敗したクラスタ構成の読み取り試行を再試行する回数

  • retryTimeout(00:00:02)クラスタ構成の読み取りに失敗してから、クラスタ構成を読み取るまでの間に待機する時間

現在のドキュメントには、これと似たものはありません。

ReceiveTimeoutは、いくつかのもの、すなわちPoolConfiguration.WaitTimeout,BucketConfiguration.DefaultOperationLifespanおよびClientConfiguration.ViewRequestTimeoutに関連するように見えます。これは、同様の動作をしているように思われる3つの新しい構成オプションへの1つの構成マッピングであるため、これはほとんど自信がありません。

残りはほぼ1対1でした。

奇妙なことを無視して(int)TimeSpan.TotalMillisecondsナンセンス、私たちが設定を指定する現在の方法の後戻りです。将来変化する必要があります。

私は上記のアプローチに基づいて私の前提を確認するので、私はこの答えに戻ってくるでしょう。私はまだ同じ構成が複数のレベルにある理由を理解していません。デフォルトを設定して値を上書きすることを願っています。