Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DR] Compute CRC for backup recovery and verification #2788

Merged
merged 21 commits into from
May 24, 2024

Conversation

snalli
Copy link
Contributor

@snalli snalli commented May 20, 2024

No description provided.

@@ -241,6 +245,13 @@ private void fetchDataFromReadSet(MessageFormatMetrics metrics) throws MessageFo
}
}

public long getBlobCRCOffset(MessageReadSet messages, int idx) throws MessageFormatException, IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is a better way to know the offset of CRC. When you call store.get(storeKeys, storeGetOptions), it returns a MessageReadSet and a list of MessageInfo. In this case, we only have one MessageInfo and one MessageReadSet. The MessageInfo's getSize() would return the size of this entire message, what we are trying to get is the crc of this message. As long as we know the message size, we can just do MessageInfo.getSize() - MessageFormatRecord.Crc_Size. Something like that.

So you don't really need to have a new method to get the crc offset.

long crcOffset = msgFmt.getBlobCRCOffset(rdset, 0); // index = 0, as we have 1 msg
rdset.doPrefetch(0, crcOffset, 8); // crc is 8 bytes
long crc = rdset.getPrefetchedData(0).getLong(0);
newMsgInfo = new MessageInfo(crc, minfo);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have to release the prefetched data buffer.
rdset.getPrefetchedData(0).release()

@snalli snalli changed the title [WIP][DR] Compute CRC for backup recovery and verification [DR] Compute CRC for backup recovery and verification May 23, 2024
@snalli snalli merged commit 8948726 into master May 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants