|
@@ -127,9 +127,9 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
File tmpDir = ClientBase.createTmpDir();
|
|
|
FileTxnSnapLog logFile = new FileTxnSnapLog(tmpDir, tmpDir);
|
|
|
DataTree dt = new DataTree();
|
|
|
- dt.createNode("/test", new byte[0], null, 0, 1, 1);
|
|
|
+ dt.createNode("/test", new byte[0], null, 0, -1, 1, 1);
|
|
|
for (count = 1; count <= 3; count++) {
|
|
|
- dt.createNode("/test/" + count, new byte[0], null, 0, count,
|
|
|
+ dt.createNode("/test/" + count, new byte[0], null, 0, -1, count,
|
|
|
System.currentTimeMillis());
|
|
|
}
|
|
|
DataNode zk = dt.getNode("/test");
|
|
@@ -139,8 +139,9 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
doOp(logFile, OpCode.create, "/test/" + (count - 1), dt, zk);
|
|
|
|
|
|
// Make delete fo fail, then verify cversion.
|
|
|
- LOG.info("Attempting to delete " + "/test/" + (count + 1));
|
|
|
- doOp(logFile, OpCode.delete, "/test/" + (count + 1), dt, zk);
|
|
|
+ // this doesn't happen anymore, we only set the cversion on create
|
|
|
+ // LOG.info("Attempting to delete " + "/test/" + (count + 1));
|
|
|
+ // doOp(logFile, OpCode.delete, "/test/" + (count + 1), dt, zk);
|
|
|
}
|
|
|
/*
|
|
|
* Does create/delete depending on the type and verifies
|
|
@@ -151,7 +152,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
int lastSlash = path.lastIndexOf('/');
|
|
|
String parentName = path.substring(0, lastSlash);
|
|
|
|
|
|
- long prevCversion = parent.stat.getCversion();
|
|
|
+ int prevCversion = parent.stat.getCversion();
|
|
|
long prevPzxid = parent.stat.getPzxid();
|
|
|
List<String> child = dt.getChildren(parentName, null, null);
|
|
|
String childStr = "";
|
|
@@ -160,7 +161,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
}
|
|
|
LOG.info("Children: " + childStr + " for " + parentName);
|
|
|
LOG.info("(cverions, pzxid): " + prevCversion + ", " + prevPzxid);
|
|
|
-
|
|
|
+
|
|
|
Record txn = null;
|
|
|
TxnHeader txnHeader = null;
|
|
|
if (type == OpCode.delete) {
|
|
@@ -170,7 +171,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
} else if (type == OpCode.create) {
|
|
|
txnHeader = new TxnHeader(0xabcd, 0x123, prevPzxid + 1,
|
|
|
System.currentTimeMillis(), OpCode.create);
|
|
|
- txn = new CreateTxn(path, new byte[0], null, false);
|
|
|
+ txn = new CreateTxn(path, new byte[0], null, false, -1);
|
|
|
}
|
|
|
logFile.processTransaction(txnHeader, dt, null, txn);
|
|
|
|
|
@@ -183,7 +184,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
}
|
|
|
LOG.info("Children: " + childStr + " for " + parentName);
|
|
|
LOG.info("(cverions, pzxid): " +newCversion + ", " + newPzxid);
|
|
|
- Assert.assertTrue("<cversion, pzxid> verification failed. Expected: <" +
|
|
|
+ Assert.assertTrue(type + " <cversion, pzxid> verification failed. Expected: <" +
|
|
|
(prevCversion + 1) + ", " + (prevPzxid + 1) + ">, found: <" +
|
|
|
newCversion + ", " + newPzxid + ">",
|
|
|
(newCversion == prevCversion + 1 && newPzxid == prevPzxid + 1));
|
|
@@ -198,7 +199,7 @@ public class LoadFromLogTest extends ZKTestCase implements Watcher {
|
|
|
FileTxnLog txnLog = new FileTxnLog(tmpDir);
|
|
|
TxnHeader txnHeader = new TxnHeader(0xabcd, 0x123, 0x123,
|
|
|
System.currentTimeMillis(), OpCode.create);
|
|
|
- Record txn = new CreateTxn("/Test", new byte[0], null, false);
|
|
|
+ Record txn = new CreateTxn("/Test", new byte[0], null, false, 1);
|
|
|
txnLog.append(txnHeader, txn);
|
|
|
FileInputStream in = new FileInputStream(tmpDir.getPath() + "/log." +
|
|
|
Long.toHexString(txnHeader.getZxid()));
|