jojochuang commented on code in PR #7221:
URL: https://github.com/apache/ozone/pull/7221#discussion_r1817103937
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -163,9 +163,13 @@ public synchronized void initialize() throws IOException {
try {
blockData = getBlockData();
chunks = blockData.getChunksList();
+ LOG.debug("Block {} has block data {}", blockID, blockData);
Review Comment:
the parameterized logging with a simple object reference has negligible
overhead. But let's remove it. It's redundant.
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java:
##########
@@ -417,6 +418,45 @@ private static String
getChunkPathOnDataNode(FSDataOutputStream outputStream)
return chunkPath;
}
+ @Test
+ public void testHSyncSeek() throws Exception {
+ // Set the fs.defaultFS
+ final String rootPath = String.format("%s://%s.%s/",
+ OZONE_URI_SCHEME, bucket.getName(), bucket.getVolumeName());
+ CONF.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, rootPath);
+
+ final String dir = OZONE_ROOT + bucket.getVolumeName()
+ + OZONE_URI_DELIMITER + bucket.getName();
+ final Path key1 = new Path(dir, "key-hsync-seek");
+
+ final byte[] data = new byte[1024];
+ final byte[] buffer = new byte[1024];
+ ThreadLocalRandom.current().nextBytes(data);
+
+ try (FileSystem fs = FileSystem.get(CONF)) {
+ // Create key1
+ try (FSDataOutputStream os = fs.create(key1, true)) {
+ os.write(data, 0, WAL_HEADER_LEN);
+ // the first hsync will update the correct length in the key info at OM
+ os.hsync();
+ os.write(data, 0, data.length);
+ os.hsync(); // the second hsync will not update the length at OM
+ try (FSDataInputStream in = fs.open(key1)) {
+ // the actual key length is 1025, but the length in OM is 1
Review Comment:
ah you're absolutely right. Updated.
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java:
##########
@@ -163,9 +163,13 @@ public synchronized void initialize() throws IOException {
try {
blockData = getBlockData();
chunks = blockData.getChunksList();
+ LOG.debug("Block {} has block data {}", blockID, blockData);
if (blockInfo != null && blockInfo.isUnderConstruction()) {
// use the block length from DN if block is under construction.
length = blockData.getSize();
+ LOG.debug("Updated block length to {} for block {}", length,
blockID);
+ } else {
+ LOG.debug("blockInfo = {}", blockInfo);
Review Comment:
Redundant. Removing it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]