-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29441 ReplicationSourceShipper should delegate the empty wal entries handling to ReplicationEndpoint #7145
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
Conversation
… of COMMITED for empty WAL batches
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR delegates empty WAL entry handling in ReplicationSourceShipper to each ReplicationEndpoint via a new EmptyEntriesPolicy enum and updates related code and tests.
- Introduce
EmptyEntriesPolicyandgetEmptyEntriesPolicy()inReplicationEndpointwith a default ofCOMMIT. - Update
ReplicationSourceShipper.shipEdits()to use endpoint policy for empty batches and add helpergetReplicationResult(). - Add sync and async endpoint implementations and corresponding tests; update
ContinuousBackupReplicationEndpointto returnSUBMIT.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSource.java | Added AsyncReplicationEndpoint and SyncReplicationEndpoint tests for empty-batch behavior. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceShipper.java | Changed shipEdits visibility, delegated empty-batch logic using endpoint policy, and added getReplicationResult(). |
| hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java | Added default getEmptyEntriesPolicy() method and documentation. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/replication/EmptyEntriesPolicy.java | Introduced enum to distinguish COMMIT vs. SUBMIT for empty batches. |
| hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/replication/ContinuousBackupReplicationEndpoint.java | Override getEmptyEntriesPolicy() to return SUBMIT for async backup. |
Comments suppressed due to low confidence (3)
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceShipper.java:244
- [nitpick] The method name getReplicationResult is generic; consider renaming to getEmptyBatchReplicationResult or computeEmptyEntriesPolicyResult for clarity.
private ReplicationResult getReplicationResult() {
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceShipper.java:278
- [nitpick] Document the return value for updateLogPosition, explaining what
trueorfalseindicates about the update operation.
boolean updateLogPosition(WALEntryBatch batch, ReplicationResult replicated) {
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/EmptyEntriesPolicy.java:23
- [nitpick] The Javadoc bullet list in this enum is formatted inline; consider using standard Javadoc list tags (
<ul><li>) or separate lines for each policy for better readability.
* Policy that defines what a replication endpoint should do when the entry batch is empty. This is
| * Do the shipping logic. Package-private for test visibility only. Do not use outside tests. | ||
| */ | ||
| private void shipEdits(WALEntryBatch entryBatch) { | ||
| void shipEdits(WALEntryBatch entryBatch) { |
Copilot
AI
Jul 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider annotating this package-private method with @VisibleForTesting (or a project-specific equivalent) to clearly signal its test-only visibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: VisibleForTesting seems the right comment, and it may save few words for testing only,
taklwu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| * Do the shipping logic. Package-private for test visibility only. Do not use outside tests. | ||
| */ | ||
| private void shipEdits(WALEntryBatch entryBatch) { | ||
| void shipEdits(WALEntryBatch entryBatch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: VisibleForTesting seems the right comment, and it may save few words for testing only,
| /** | ||
| * Package-private for test visibility only. Do not use outside tests. | ||
| */ | ||
| boolean updateLogPosition(WALEntryBatch batch, ReplicationResult replicated) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VisibleForTesting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
I think we are not allowed to use @VisibleForTesting. I don't see any other instance in the codebase as well.
also, I see this
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
<includeTestCode>true</includeTestCode>
<commentLineBufferSize>512</commentLineBufferSize>
<reason>You should never use this style of annotations(i.e, 'this is for test only')
in IA.Public or IA.LimitedPrivate classes. Use IA.Private to tell users this is
not for public use.
For IA.Private classes, use RestrictedApi annotation in error prone instead.</reason>
<bannedImports>
<bannedImport>org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting</bannedImport>
</bannedImports>
</restrictImports>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
…tries handling to ReplicationEndpoint (#7145) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org>
…tries handling to ReplicationEndpoint (apache#7145) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org>
…tries handling to ReplicationEndpoint (apache#7145) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org>
…tries handling to ReplicationEndpoint (#7145) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org>
…tries handling to ReplicationEndpoint (#7145) Signed-off-by: Tak Lon (Stephen) Wu <taklwu@apache.org>
No description provided.