+
+
+ t2.update();
+ System.out.println("Writing Keys b...");
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ System.out.println(i);
+
+ String key = "b" + i;
+ String value = "b" + (i + 10000);
+ IoTString iKey = new IoTString(key);
+ IoTString iValue = new IoTString(value);
+
+
+ t2.startTransaction();
+ t2.addKV(iKey, iValue);
+ t2.commitTransaction();
+ }
+
+
+ // Do Updates for the keys
+ System.out.println("Writing Keys a...");
+ for (int i = 0; i < NUMBER_OF_TESTS; i += 2) {
+ System.out.println(i);
+
+ String key = "a" + i;
+ String value = "a" + (i + 10000);
+ IoTString iKey = new IoTString(key);
+ IoTString iValue = new IoTString(value);
+
+ t1.startTransaction();
+ t1.addKV(iKey, iValue);
+ t1.commitTransaction();
+ }
+
+
+ t1.update();
+ t2.update();
+
+ System.out.println("Checking a keys...");
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+
+ String key = "a" + i;
+ String value = "a" + (i + 10000);
+ IoTString iKey = new IoTString(key);
+ IoTString iValue = new IoTString(value);
+
+ IoTString testVal = t1.getCommitted(iKey);
+
+ if ((testVal == null) || (testVal.equals(iValue) == false)) {
+ System.out.println("Key val incorrect: " + key);
+ }
+
+ key = "b" + i;
+ value = "b" + (i + 10000);
+ iKey = new IoTString(key);
+ iValue = new IoTString(value);
+
+ testVal = t1.getCommitted(iKey);
+
+ if ((testVal == null) || (testVal.equals(iValue) == false)) {
+ System.out.println("Key val incorrect: " + key);
+ }
+ }
+
+ System.out.println("Checking b keys...");
+ for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+
+ String key = "a" + i;
+ String value = "a" + (i + 10000);
+ IoTString iKey = new IoTString(key);
+ IoTString iValue = new IoTString(value);
+
+ IoTString testVal = t2.getCommitted(iKey);
+
+ if ((testVal == null) || (testVal.equals(iValue) == false)) {
+ System.out.println("Key val incorrect: " + key);
+ }
+
+ key = "b" + i;
+ value = "b" + (i + 10000);
+ iKey = new IoTString(key);
+ iValue = new IoTString(value);
+
+ testVal = t2.getCommitted(iKey);
+
+ if ((testVal == null) || (testVal.equals(iValue) == false)) {
+ System.out.println("Key val incorrect: " + key);
+ }
+ }
+
+
+
+
+ System.out.println();
+ System.out.println();
+ System.out.println("Update");
+ // Make sure t1 sees the new updates from t2
+ t1.update();
+ t2.update();
+ t1.update();
+ System.out.println();
+ System.out.println();
+ System.out.println();
+ System.out.println();
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ t2.update();
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+ System.out.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
+
+
+ // System.out.println("=========t1 live" + t1.liveslotcount + " thresh: " + t1.resizethreshold + " commits: " + t1.commitedTable.size() + " uncommits: " + t1.uncommittedTransactionsList.size());
+ // System.out.println("=========t2 live" + t2.liveslotcount + " thresh: " + t2.resizethreshold + " commits: " + t2.commitedTable.size() + " uncommits: " + t2.uncommittedTransactionsList.size() );
+ System.out.println();
+
+ t1.printSlots();
+ System.out.println();
+ System.out.println();
+ System.out.println();
+ System.out.println();
+ t2.printSlots();
+ System.out.println();
+
+
+
+ // // Do Updates for the keys
+ // System.out.println("Writing Keys a (actual)");
+ // for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ // String key = "a" + i;
+ // String value = "a" + i;
+ // IoTString iKey = new IoTString(key);
+ // IoTString iValue = new IoTString(value);
+
+ // t1.startTransaction();
+ // t1.addKV(iKey, iValue);
+ // t1.commitTransaction();
+ // }
+
+ // System.out.println("=========t1 live" + t1.liveslotcount + " thresh: " + t1.resizethreshold + " commits: " + t1.commitedTable.size() + " uncommits: " + t1.uncommittedTransactionsList.size());
+ // System.out.println("=========t2 live" + t2.liveslotcount + " thresh: " + t2.resizethreshold + " commits: " + t2.commitedTable.size() + " uncommits: " + t2.uncommittedTransactionsList.size());
+ // System.out.println();
+
+
+
+ // System.out.println("Writing Keys b (actual)");
+ // for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ // String key = "b" + i;
+ // String value = "b" + i;
+ // IoTString iKey = new IoTString(key);
+ // IoTString iValue = new IoTString(value);
+
+ // t2.startTransaction();
+ // t2.addKV(iKey, iValue);
+ // t2.commitTransaction();
+ // }
+
+ // System.out.println("=========t1 live" + t1.liveslotcount + " thresh: " + t1.resizethreshold + " commits: " + t1.commitedTable.size() + " uncommits: " + t1.uncommittedTransactionsList.size() );
+ // System.out.println("=========t2 live" + t2.liveslotcount + " thresh: " + t2.resizethreshold + " commits: " + t2.commitedTable.size() + " uncommits: " + t2.uncommittedTransactionsList.size() );
+ // System.out.println();
+
+
+ // // Do Updates for the keys
+ // System.out.println("Writing Keys a (actual)");
+ // for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ // String key = "a" + i;
+ // String value = "a" + i;
+ // IoTString iKey = new IoTString(key);
+ // IoTString iValue = new IoTString(value);
+
+ // t1.startTransaction();
+ // t1.addKV(iKey, iValue);
+ // t1.commitTransaction();
+ // }
+
+ // System.out.println("=========t1 live" + t1.liveslotcount + " thresh: " + t1.resizethreshold + " commits: " + t1.commitedTable.size() + " uncommits: " + t1.uncommittedTransactionsList.size());
+ // System.out.println("=========t2 live" + t2.liveslotcount + " thresh: " + t2.resizethreshold + " commits: " + t2.commitedTable.size() + " uncommits: " + t2.uncommittedTransactionsList.size());
+ // System.out.println();
+
+
+
+ // System.out.println("Writing Keys b (actual)");
+ // for (int i = 0; i < NUMBER_OF_TESTS; i++) {
+ // String key = "b" + i;
+ // String value = "b" + i;
+ // IoTString iKey = new IoTString(key);
+ // IoTString iValue = new IoTString(value);
+
+ // t2.startTransaction();
+ // t2.addKV(iKey, iValue);
+ // t2.commitTransaction();
+ // }
+
+ // System.out.println("=========t1 live" + t1.liveslotcount + " thresh: " + t1.resizethreshold + " commits: " + t1.commitedTable.size() + " uncommits: " + t1.uncommittedTransactionsList.size() );
+ // System.out.println("=========t2 live" + t2.liveslotcount + " thresh: " + t2.resizethreshold + " commits: " + t2.commitedTable.size() + " uncommits: " + t2.uncommittedTransactionsList.size() );
+ // System.out.println();
+
+ // t1.printSlots();
+ // System.out.println();
+ // t2.printSlots();
+
+
+
+ // Make sure t1 sees the new updates from t2
+ // t1.update();
+
+ // // Print the results
+ // for (int i = NUMBER_OF_TESTS - 10; i < NUMBER_OF_TESTS; i++) {
+ // String a = "a" + i;
+ // String b = "b" + i;
+ // IoTString ia = new IoTString(a);
+ // IoTString ib = new IoTString(b);
+
+ // System.out.println(ib + " -> " + t1.getCommitted(ib));
+ // System.out.println(ia + " -> " + t2.getCommitted(ia));
+ // System.out.println();
+ // }