-
Notifications
You must be signed in to change notification settings - Fork 188
[Enhancement] Try to cleanup lingering transactions when restoring in exactly-once mode #271
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
7ebbde1
to
fd46059
Compare
This PREPARED transaction is because the import encountered an exception. So when the import encountered an exception,Should the PREPARED transaction be closed and then restarted ? Each task needs to be set with sink.label-prefix, which makes it easy to repeat |
@dyp12 Thanks for your comments
|
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
fd46059
to
e85f108
Compare
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
… exactly-once mode (StarRocks#271) Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
… exactly-once mode (StarRocks#271) Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
… exactly-once mode (#271) Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
… exactly-once mode (#271) Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
For "Some of those PREPARED transactions may be in a successful checkpoint, and will be committed when the job restores from the checkpoint", if fe restore when this txn is PREPARED, the callback instance in fe will lose, and this txn will never be commited, but is also cannot be rollback by connector because of exactly-once. how to solve this problem? is this a bug in sr or connector? |
What type of PR is this:
Which issues of this PR fixes :
Fixes #
Problem Summary(Required) :
What's the problem
When using exactly-once, the connector will not abort the
PREPARED
transactions when the flink job failovers or exits because it's 2PC mechanism. Some of those PREPARED transactions may be in a successful checkpoint, and will be committed when the job restores from the checkpoint, but some of them are just useless, and should be aborted, otherwise they will be lingering in StarRocks until timeout which maybe make StarRocks unstable. We should try to abort those lingering transactions when restoringHow to solve it
When flink job restores, the connector will try to find those lingering transactions, and abort them. The key is how to find those transactions because the labels of them are not stored in the checkpoint. Here we design a label generator (ExactlyOnceLabelGenerator) to solve it
sink.label-prefix
which is used as the prefix of the labels, and it must be unique across all the ingestions, including flink connector, broker load and routine load, running on the same StarRocks cluster{labelPrefix}-{tableName}-{subtaskIndex}-{id}
.subtaskIndex
will make the label unique across subtasks if the sink writes parallelid
is incremental, and it will make the label unique across different transactions in a subtaskPREPARED
state, and should abort itChecklist: