You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by "horizonzy (via GitHub)" <gi...@apache.org> on 2023/07/04 09:31:01 UTC
[GitHub] [zookeeper] horizonzy commented on a diff in pull request #2025: ZOOKEEPER-4715: Verify file size and position in testGetCurrentLogSize.
horizonzy commented on code in PR #2025:
URL: https://github.com/apache/zookeeper/pull/2025#discussion_r1251765568
##########
zookeeper-server/src/test/java/org/apache/zookeeper/server/persistence/FileTxnLogTest.java:
##########
@@ -171,20 +171,37 @@ public void testGetCurrentLogSize() throws Exception {
FileTxnLog log = new FileTxnLog(tmpDir);
FileTxnLog.setPreallocSize(PREALLOCATE);
CreateRequest record = new CreateRequest(null, new byte[NODE_SIZE], ZooDefs.Ids.OPEN_ACL_UNSAFE, 0);
+ long logSize = 16;
+ long position = 16;
int zxid = 1;
for (int i = 0; i < 4; i++) {
log.append(new TxnHeader(0, 0, zxid++, 0, 0), record);
- LOG.debug("Current log size: {}", log.getCurrentLogSize());
+ logSize += PREALLOCATE;
+ assertEquals(logSize, log.getCurrentLogSize());
+ assertEquals(position, log.fos.getChannel().position());
}
log.commit();
- LOG.info("Current log size: {}", log.getCurrentLogSize());
+ long totalSize = (8 + 4 + 1095 + 1) * 4 + 16;
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org