Skip to content

HDDS-8010. Improve DN warning message when getBlock does not find the block - #4350

Closed
GAOJHIHCYUAN wants to merge 5 commits into
apache:masterfrom
GAOJHIHCYUAN:HDDS-8010
Closed

HDDS-8010. Improve DN warning message when getBlock does not find the block#4350
GAOJHIHCYUAN wants to merge 5 commits into
apache:masterfrom
GAOJHIHCYUAN:HDDS-8010

Conversation

@GAOJHIHCYUAN

@GAOJHIHCYUANGAOJHIHCYUAN commented Mar 6, 2023

Copy link
Copy Markdown
Contributor

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

@GAOJHIHCYUANGAOJHIHCYUAN changed the title HDDS-8010 .Improve DN warning message when getBlock does not find the blockHDDS-8010. Improve DN warning message when getBlock does not find the blockMar 6, 2023

@dineshchitlangiadineshchitlangia left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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

@adoroszlaiadoroszlai left a comment

Copy link
Copy Markdown
Contributor

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(),

@adoroszlaiadoroszlaiMar 6, 2023

Copy link
Copy Markdown
Contributor

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:

privateBlockDatagetBlockByID(DBHandledb, BlockIDblockID,
KeyValueContainerDatacontainerData) throwsIOException {
StringblockKey = containerData.getBlockKey(blockID.getLocalID());
BlockDatablockData = db.getStore().getBlockDataTable().get(blockKey);
if (blockData == null) {
thrownewStorageContainerException(NO_SUCH_BLOCK_ERR_MSG,
NO_SUCH_BLOCK);
}
returnblockData;
}

@GAOJHIHCYUANGAOJHIHCYUANMar 9, 2023

Copy link
Copy Markdown
ContributorAuthor

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:

privateBlockDatagetBlockByID(DBHandledb, BlockIDblockID,
KeyValueContainerDatacontainerData) throwsIOException {
StringblockKey = containerData.getBlockKey(blockID.getLocalID());
BlockDatablockData = db.getStore().getBlockDataTable().get(blockKey);
if (blockData == null) {
thrownewStorageContainerException(NO_SUCH_BLOCK_ERR_MSG,
NO_SUCH_BLOCK);
}
returnblockData;
}

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
Contributor

/pending

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown

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
Copy Markdown
ContributorAuthor

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 freeto 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

@GAOJHIHCYUAN@adoroszlai@dineshchitlangia@chungen0126@ashishkumar50