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; } } }
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; } }
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); } }
public void ExecuteAndValidate() { if (clusterKey != 0) { if (!first) { QueryValidate.Validate(node, ns, clusterKey); } base.Execute(); QueryValidate.Validate(node, ns, clusterKey); } else { base.Execute(); } }