[improve][broker] PIP-215 added StrategicTwoPhaseCompactor #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Master Issue: apache#18099
Motivation
This PR implements StrategicTwoPhaseCompactor as proposed in pip-215.
Modifications
This PR adds the following classes to implement StrategicTwoPhaseCompactor.
StrategicTwoPhaseCompactor
that extendsTwoPhaseCompactor
.TopicCompactionStrategy
interface that is passed inStrategicTwoPhaseCompactor
andTableViewImpl
.CompactionReaderImpl
to scan messages in StrategicTwoPhaseCompactor. It cumulatively acknowledges the read messages at the end of StrategicTwoPhaseCompactor.SubscriptionMode
andSubscriptionInitialPosition
parameters inReaderConfigurationData
since theCompactionReaderImpl
reader's subscription needs to be durable and needs to read from the earliest position.RawBatchMessageContainerImpl
to batch and serialize messages inStrategicTwoPhaseCompactor
.This PR updates the
TableViewImpl
to useTopicCompactionStrategy
in its data K,V map update logic.topicCompactionStrategy
member variable inTableViewConfigurationData
listen()
interface inTableView
to provide an option to call the listener actions only for the new future messages.TableViewImpl
and itshandleMessage()
function to considerTopicCompactionStrategy
when updating the data K,V map.This PR updated the compaction test classes to reuse the test cases.
This PR updated the modifiers of the parent classes of the added classes to access the member variables and member functions.
Verifying this change
This change added tests and can be verified as follows:
(example:)
StrategicTwoPhaseCompactor
.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
This PR does not enable strategic compaction for the customer topics. We will update the doc when enabling this compaction for the customer topics.
Matching PR in forked repository
PR in forked repository: #12