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

[improve][broker] PIP-215 added StrategicTwoPhaseCompactor #12

Closed
wants to merge 5 commits into from

Conversation

heesung-sn
Copy link
Owner

@heesung-sn heesung-sn commented Oct 22, 2022

Master Issue: apache#18099

Motivation

This PR implements StrategicTwoPhaseCompactor as proposed in pip-215.

Modifications

This PR adds the following classes to implement StrategicTwoPhaseCompactor.

  • Added StrategicTwoPhaseCompactor that extends TwoPhaseCompactor.
  • Added TopicCompactionStrategy interface that is passed in StrategicTwoPhaseCompactor and TableViewImpl.
  • Added CompactionReaderImpl to scan messages in StrategicTwoPhaseCompactor. It cumulatively acknowledges the read messages at the end of StrategicTwoPhaseCompactor.
  • Added SubscriptionMode and SubscriptionInitialPosition parameters in ReaderConfigurationData since the CompactionReaderImpl reader's subscription needs to be durable and needs to read from the earliest position.
  • Added RawBatchMessageContainerImpl to batch and serialize messages in StrategicTwoPhaseCompactor.

This PR updates the TableViewImpl to use TopicCompactionStrategy in its data K,V map update logic.

  • Added the topicCompactionStrategy member variable in TableViewConfigurationData
  • Added the listen() interface in TableView to provide an option to call the listener actions only for the new future messages.
  • Updated TableViewImpl and its handleMessage() function to consider TopicCompactionStrategy 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

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

(example:)

  • Extended the compaction tests to cover the same logic passes with the StrategicTwoPhaseCompactor.
  • Added other unit tests for the added classes.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • [] Dependencies (add or upgrade a dependency)
  • The public API (table-view.listen() addition and reader and table-view configuration update)
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • Anything that affects deployment

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

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Dec 8, 2022
@heesung-sn heesung-sn closed this Dec 24, 2022
@heesung-sn heesung-sn deleted the pip-215 branch April 2, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant