Skip to content

Conversation

@GAOJHIHCYUAN
Copy link
Contributor

@GAOJHIHCYUAN GAOJHIHCYUAN commented Mar 6, 2023

What changes were proposed in this pull request?

adding the log message information about block id and logged at WARN level

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-8010

How was this patch tested?

CI tests

@GAOJHIHCYUAN GAOJHIHCYUAN changed the title HDDS-8010 .Improve DN warning message when getBlock does not find the block HDDS-8010. Improve DN warning message when getBlock does not find the block Mar 6, 2023
Copy link
Contributor

@dineshchitlangia dineshchitlangia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 LGTM, pending CI

if (log.isDebugEnabled()) {
log.debug(logInfo, request.getCmdType(), request.getTraceID(),
log.warn(logInfo, request.getCmdType(), request.getTraceID(),
request.getGetBlock().getBlockID(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be still logged at DEBUG level if it is under the isDebugEnabled() condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your comment
I commit new version that if it is under the condition still logged at DEBUG level.
if it's not under the condition logged at Warn level.

# Conflicts:
#	hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ContainerUtils.java
Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GAOJHIHCYUAN have you observed the updated message in the log?

} else {
log.info(logInfo, request.getCmdType(), request.getTraceID(),
log.warn(logInfo, request.getCmdType(), request.getTraceID(),
request.getGetBlock().getBlockID(),
Copy link
Contributor

@adoroszlai adoroszlai Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request.getGetBlock() is only applicable to GetBlock requests. Also, not all commands are related to blocks anyway.

Looking at HDDS-8010, I think the goal is to change the message in:

private BlockData getBlockByID(DBHandle db, BlockID blockID,
KeyValueContainerData containerData) throws IOException {
String blockKey = containerData.getBlockKey(blockID.getLocalID());
BlockData blockData = db.getStore().getBlockDataTable().get(blockKey);
if (blockData == null) {
throw new StorageContainerException(NO_SUCH_BLOCK_ERR_MSG,
NO_SUCH_BLOCK);
}
return blockData;
}

Copy link
Contributor Author

@GAOJHIHCYUAN GAOJHIHCYUAN Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request.getGetBlock() is only applicable to GetBlock requests. Also, not all commands are related to blocks anyway.

Looking at HDDS-8010, I think the goal is to change the message in:

private BlockData getBlockByID(DBHandle db, BlockID blockID,
KeyValueContainerData containerData) throws IOException {
String blockKey = containerData.getBlockKey(blockID.getLocalID());
BlockData blockData = db.getStore().getBlockDataTable().get(blockKey);
if (blockData == null) {
throw new StorageContainerException(NO_SUCH_BLOCK_ERR_MSG,
NO_SUCH_BLOCK);
}
return blockData;
}

public class StorageContainerException extends IOException {
  private final ContainerProtos.Result result;

  private final BlockID blockID = getLocalID();

  public BlockID getLocalID() {return blockID;}
if (log.isDebugEnabled()) {
        log.debug(logInfo, request.getCmdType(), request.getTraceID(),
            ex.getLocalID(),
            ex.getMessage(), ex.getResult().getValueDescriptor().getName(), ex);
      }
    } else {
      log.warn(logInfo, request.getCmdType(), request.getTraceID(),
          ex.getLocalID(),
          ex.getMessage(), ex.getResult().getValueDescriptor().getName(), ex);
    }

because the log was logged when StorageContainerException occurred
my opinion was adding the getLocalID() in StorageContainerException.java
and then we can call function in getBlockByID() getting the block ID.
Idk is it a good soultion.
thanks you so much

@GAOJHIHCYUAN have you observed the updated message in the log?

No,I haven't
I will try how could I observe the updated message.
sorry,i was a newbie. I'm still learning.
thanks you so much.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can update message in getBlockByID while throwing StorageContainerException to print the blockID. Can you update the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can update message in getBlockByID while throwing StorageContainerException to print the blockID. Can you update the PR?

okay,I will update the PR.
appreciate

@adoroszlai
Copy link
Contributor

Thanks again @GAOJHIHCYUAN for working on this. Will you update the patch to make the change in BlockManagerImpl#getBlockByID instead of the generic logAndReturnError method?

@adoroszlai
Copy link
Contributor

/pending

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this issue as un-mergeable as requested.

Please use /ready comment when it's resolved.

Please note that the PR will be closed after 21 days of inactivity from now. (But can be re-opened anytime later...)

/pending

@GAOJHIHCYUAN
Copy link
Contributor Author

Thanks again @GAOJHIHCYUAN for working on this. Will you update the patch to make the change in BlockManagerImpl#getBlockByID instead of the generic logAndReturnError method?

I will update the patch.
Thanks you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants