Ejemplo n.º 1
0
 public void Create(int nodeLength, TestClusterOptions options = null)
 {
     if (options == null)
     {
         options = TestClusterOptions.Default;
     }
     _ccm = new CcmBridge(Name, ClusterIpPrefix);
     _ccm.Create(_version, options.UseSsl);
     _ccm.Populate(nodeLength, options.Dc2NodeLength, options.UseVNodes);
 }
Ejemplo n.º 2
0
 public void Create(int nodeLength, TestClusterOptions options = null)
 {
     if (options == null)
     {
         options = TestClusterOptions.Default;
     }
     _ccm = new CcmBridge(Name, ClusterIpPrefix);
     _ccm.Create(_version, options.UseSsl);
     _ccm.Populate(nodeLength, options.Dc2NodeLength, options.UseVNodes);
 }
Ejemplo n.º 3
0
        public void Create(bool startTheCluster = true)
        {
            // if it's already being created in another thread, then wait until this step is complete
            if (!IsBeingCreated)
            {
                IsBeingCreated = true;
                if (Dc2NodeCount > 0)
                {
                    CcmBridge = CcmBridge.Create(Name, ClusterIpPrefix, Dc1NodeCount, Dc2NodeCount, CassandraVersion.ToString(), startTheCluster);
                }
                else
                {
                    CcmBridge = CcmBridge.Create(Name, ClusterIpPrefix, Dc1NodeCount, CassandraVersion.ToString(), startTheCluster);
                }
                IsBeingCreated = false;
                IsCreated      = true;
                if (startTheCluster)
                {
                    IsStarted = true;
                }
            }
            int sleepMs      = 300;
            int sleepMsMax   = 60000;
            int totalMsSlept = 0;

            while (IsBeingCreated || !IsCreated)
            {
                Trace.TraceInformation(string.Format("Cluster with name: {0}, CcmDir: {1} is being created. Sleeping another {2} MS ... ", Name,
                                                     CcmBridge.CcmDir.FullName, sleepMs));
                Thread.Sleep(sleepMs);
                totalMsSlept += sleepMs;
                if (totalMsSlept > sleepMsMax)
                {
                    throw new Exception("Failed to create cluster in " + sleepMsMax + " MS!");
                }
            }
        }
Ejemplo n.º 4
0
        public void Create(int nodeLength, TestClusterOptions options = null)
        {
            _nodeLength = nodeLength;
            options     = options ?? TestClusterOptions.Default;
            _ccm        = new CcmBridge(Name, ClusterIpPrefix, DsePath, Version, _executor);
            _ccm.Create(options.UseSsl);
            _ccm.Populate(nodeLength, options.Dc2NodeLength, options.UseVNodes);
            _ccm.UpdateConfig(options.CassandraYaml);

            if (TestClusterManager.IsDse)
            {
                _ccm.UpdateDseConfig(options.DseYaml);
                _ccm.SetWorkloads(nodeLength, options.Workloads);
            }

            if (TestClusterManager.Executor is WslCcmProcessExecuter)
            {
                _ccm.UpdateConfig(new []
                {
                    "read_request_timeout_in_ms: 20000",
                    "counter_write_request_timeout_in_ms: 20000",
                    "write_request_timeout_in_ms: 20000",
                    "request_timeout_in_ms: 20000",
                    "range_request_timeout_in_ms: 30000"
                });
                if (TestClusterManager.IsDse)
                {
                    if (TestClusterManager.CheckDseVersion(new Version(6, 7), Comparison.LessThan))
                    {
                        _ccm.UpdateConfig(new[]
                        {
                            "user_defined_function_fail_timeout: 20000"
                        });
                    }
                    else
                    {
                        _ccm.UpdateConfig(new[]
                        {
                            "user_defined_function_fail_micros: 20000"
                        });
                    }
                }
            }
        }
Ejemplo n.º 5
0
 public static void Setup(int nbNodesDC1, int nbNodesDC2, string ipPrefix, string cassandraVersion, string clusterName = "test")
 {
     if (nbNodesDC2 == 0)
     {
         if (nbNodesDC1 != NbNodesDC1)
         {
             Trace.TraceInformation("Cassandra:" + cassandraVersion);
             CCMBridge  = CcmBridge.Create(clusterName, ipPrefix, nbNodesDC1, cassandraVersion);
             NbNodesDC1 = nbNodesDC1;
             NbNodesDC2 = 0;
         }
     }
     else
     {
         if (nbNodesDC1 != NbNodesDC1 || nbNodesDC2 != NbNodesDC2)
         {
             CCMBridge  = CcmBridge.Create(clusterName, ipPrefix, nbNodesDC1, nbNodesDC2, cassandraVersion);
             NbNodesDC1 = nbNodesDC1;
             NbNodesDC2 = nbNodesDC2;
         }
     }
 }