// Reshuffle the workloads and make sure all workloads in the same executor // will have the same partition key private List <TransactionExecutor> ReshuffleFillWorkerQueue(string operationFile, int executorCount, int totalWorkloads) { // new transaction queues at first Queue <TransactionRequest>[] queueArray = new Queue <TransactionRequest> [executorCount]; List <TransactionExecutor> executors = new List <TransactionExecutor>(executorCount); for (int i = 0; i < executorCount; i++) { queueArray[i] = new Queue <TransactionRequest>(); } using (StreamReader reader = new StreamReader(operationFile)) { string line; for (int i = 0; i < totalWorkloads; i++) { line = reader.ReadLine(); string[] fields = this.ParseCommandFormat(line); YCSBWorkload workload = new YCSBWorkload(fields[0], TABLE_ID, fields[2], fields[3]); string sessionId = (i + 1).ToString(); TransactionRequest req = new TransactionRequest(sessionId, workload, StoredProcedureType.YCSBStordProcedure); int pk = this.versionDb.PhysicalPartitionByKey(fields[2]); queueArray[pk].Enqueue(req); } } for (int pk = 0; pk < executorCount; pk++) { Queue <TransactionRequest> txQueue = queueArray[pk]; TxResourceManager manager = this.versionDb.GetResourceManager(pk); executors.Add( new TransactionExecutor(this.versionDb, null, txQueue, pk, pk, 0, manager, tables)); Console.WriteLine("Executor {0} workloads count: {1}", pk, txQueue.Count); } return(executors); }
public YCSBStoredProcedure(TxResourceManager resourceManager = null) { this.txRequestGCQueue = new Queue <TransactionRequest>(); this.resourceManager = resourceManager; }