-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix schema ledger deletion when deleting topic with delete schema. #10383
Fix schema ledger deletion when deleting topic with delete schema. #10383
Conversation
@BewareMyPower Please also help review this PR. |
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
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.
Over look good! left some comment
deleteFuture.complete(null); | ||
}, null); | ||
}); | ||
FutureUtil.waitForAll(deleteFutures).whenComplete((v, e) -> { |
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.
whenComplete((v, e)
need to handle the exception?
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.
No, one ledger delete failed, we only print the warn log instead failed the whole delete schema operation.
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.
If one ledger delete failed, does it need to be cleaned again? If delete zk path of the schema, we couldn't find its ledgers again.
try { | ||
ZkUtils.deleteFullPathOptimistic(zooKeeper, getSchemaPath(schemaId), -1); | ||
} catch (InterruptedException | KeeperException thr) { | ||
future.completeExceptionally(thr); |
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.
should return after future.completeExceptionally(thr)
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.
Nice catch!
}); | ||
FutureUtil.waitForAll(deleteFutures).whenComplete((v, e) -> { | ||
try { | ||
ZkUtils.deleteFullPathOptimistic(zooKeeper, getSchemaPath(schemaId), -1); |
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.
This call can be dangerous (I think it was already the case in the existing code). We're making a blocking call from the callback of an async call. It can lead to deadlock the ZK thread. We should never mix sync/async calls, rather we should convert into using ZkUtils.asyncDeleteFullPathOptimistic()
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.
@merlimat Fixed, PTAL.
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
@merlimat please take your final look, |
Related to #8167
Motivation
Fix schema ledger deletion when deleting topic with delete schema.
Modifications
Delete ledgers according to the schema index.
Verifying this change
New unit tests added.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation