public static void ScanNodes(Cluster cluster, ScanPolicy policy, string ns, string setName, string[] binNames, ScanCallback callback, Node[] nodes)
        {
            policy.Validate();

            // Detect cluster migrations when performing scan.
            ulong taskId     = RandomShift.ThreadLocalInstance.NextLong();
            ulong clusterKey = policy.failOnClusterChange ? QueryValidate.ValidateBegin(nodes[0], ns) : 0;
            bool  first      = true;

            if (policy.concurrentNodes && nodes.Length > 1)
            {
                Executor executor = new Executor(nodes.Length);

                foreach (Node node in nodes)
                {
                    ScanCommand command = new ScanCommand(cluster, node, policy, ns, setName, binNames, callback, taskId, clusterKey, first);
                    executor.AddCommand(command);
                    first = false;
                }
                executor.Execute(policy.maxConcurrentNodes);
            }
            else
            {
                foreach (Node node in nodes)
                {
                    ScanCommand command = new ScanCommand(cluster, node, policy, ns, setName, binNames, callback, taskId, clusterKey, first);
                    command.Execute();
                    first = false;
                }
            }
        }
示例#2
0
        protected internal void InitializeThreads()
        {
            // Detect cluster migrations when performing scan.
            ulong clusterKey = policy.failOnClusterChange ? QueryValidate.ValidateBegin(nodes[0], statement.ns) : 0;
            bool  first      = true;

            // Initialize threads.
            for (int i = 0; i < nodes.Length; i++)
            {
                MultiCommand command = CreateCommand(clusterKey, first);
                threads[i] = new QueryThread(this, nodes[i], command);
                first      = false;
            }
        }
示例#3
0
 public void Execute(Cluster cluster, Policy policy)
 {
     if (clusterKey != 0)
     {
         if (!first)
         {
             QueryValidate.Validate(node, ns, clusterKey);
         }
         base.Execute(cluster, policy, true);
         QueryValidate.Validate(node, ns, clusterKey);
     }
     else
     {
         base.Execute(cluster, policy, true);
     }
 }
示例#4
0
 public void ExecuteAndValidate()
 {
     if (clusterKey != 0)
     {
         if (!first)
         {
             QueryValidate.Validate(node, ns, clusterKey);
         }
         base.Execute();
         QueryValidate.Validate(node, ns, clusterKey);
     }
     else
     {
         base.Execute();
     }
 }