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][client]PIP-189: No batching if only one message in batch #16605

Merged
merged 15 commits into from
Aug 24, 2022

Conversation

AnonHxy
Copy link
Contributor

@AnonHxy AnonHxy commented Jul 14, 2022

email discussion thread: https://lists.apache.org/thread/dbq1lrv03bhtk0lr5nwm5txo9ndjplv0
email VOTE thread: https://lists.apache.org/thread/s0wtqpoynh970xp6y08xhncyg93xqopv

Motivation

Modifications

  • See PIP-189: No batching if only one message in batch #16619
  • Most of the Modifications are relevant to BatchMessageContainerImpl
  • Of course there are some tests about batching need to be modified, because batched producer can also pubulish non-batched messages when this PIP applies. The tests include:
    • RGUsageMTAggrWaitForAllMsgsTest
    • BatchMessageTest
    • BrokerEntryMetadataE2ETest
    • ClientDeduplicationTest
    • TopicReaderTest
    • PulsarClientToolTest

Verifying this change

  • Make sure that the change passes the CI checks.
  • Add UT org.apache.pulsar.broker.service.BatchMessageTest#testBatchSendOneMessage

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 14, 2022
@AnonHxy AnonHxy force-pushed the non_batch_one_msg branch 4 times, most recently from 667710d to 4e66d8d Compare July 15, 2022 08:59
@AnonHxy AnonHxy changed the title [WIP][client]Optimize batch one message [improve][client]Optimize batch one message Jul 15, 2022
@AnonHxy AnonHxy changed the title [improve][client]Optimize batch one message [wip][improve][client]Optimize batch one message Jul 18, 2022
@AnonHxy AnonHxy force-pushed the non_batch_one_msg branch 4 times, most recently from 559d42d to dc2fd44 Compare July 20, 2022 02:45
@AnonHxy
Copy link
Contributor Author

AnonHxy commented Jul 20, 2022

/pulsarbot run-failure-checks

@AnonHxy AnonHxy force-pushed the non_batch_one_msg branch 2 times, most recently from 3ff33cb to e119a97 Compare July 22, 2022 11:22
@AnonHxy AnonHxy changed the title [wip][improve][client]Optimize batch one message [wip][improve][client]PIP-189: No batching if only one message in batch Jul 23, 2022
@AnonHxy AnonHxy force-pushed the non_batch_one_msg branch 2 times, most recently from 8bdd2c2 to bb70eb6 Compare July 23, 2022 14:16
@AnonHxy AnonHxy changed the title [wip][improve][client]PIP-189: No batching if only one message in batch [improve][client]PIP-189: No batching if only one message in batch Jul 25, 2022
@AnonHxy AnonHxy force-pushed the non_batch_one_msg branch 2 times, most recently from a74caf1 to 729553c Compare July 26, 2022 03:57
@AnonHxy
Copy link
Contributor Author

AnonHxy commented Jul 26, 2022

/pulsarbot run-failure-checks

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are on your way.
Now the problem is to fix the remaining tests.

I wish to see this in 2.11 if possible, as it is a important behaviour change and it is better to not introduce it in a point release (like 2.11.1)

@codelipenghui @BewareMyPower @lhotari @michaeljmarshall @merlimat @rdhabalia

@eolivelli eolivelli self-requested a review July 31, 2022 06:03
@AnonHxy AnonHxy force-pushed the non_batch_one_msg branch 4 times, most recently from 577a198 to 228cb2c Compare August 1, 2022 12:47
@AnonHxy AnonHxy self-assigned this Aug 23, 2022
@AnonHxy AnonHxy added area/broker release/2.11.1 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages labels Aug 23, 2022
Copy link
Contributor

@Jason918 Jason918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AnonHxy AnonHxy merged commit 3958aa6 into apache:master Aug 24, 2022
@AnonHxy AnonHxy added this to the 2.12.0 milestone Aug 26, 2022
lhotari added a commit to lhotari/pulsar that referenced this pull request Aug 26, 2022
lhotari added a commit that referenced this pull request Aug 26, 2022
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Aug 29, 2022
…pache#16605)

[improve][client]PIP-189: No batching if only one message in batch apache#16605

### Motivation

* See apache#16619

### Modifications

* See apache#16619
* Most of the Modifications are relevant to `BatchMessageContainerImpl`
* Of course there are some tests about batching need to be modified, because batched producer can also pubulish non-batched messages when this PIP applies. The tests include:
    * `RGUsageMTAggrWaitForAllMsgsTest`
    * `BatchMessageTest`
    * `BrokerEntryMetadataE2ETest`
    * `ClientDeduplicationTest`
    * `TopicReaderTest`
    * `PulsarClientToolTest`
lhotari added a commit that referenced this pull request Aug 31, 2022
…sors (#17273)

* [fix][broker] Fix broken build caused by conflict between #17195 and #16605

- #17195 changed the method signature that #16605 depended upon

* [fix][broker] Keep sorted list of cursors ordered by read position of active cursors when cacheEvictionByMarkDeletedPosition=false

Fixes #16054

- calculate the sorted list of when a read position gets updated
- this resolves #9958 in a proper way
  - #12045 broke the caching solution as explained in #16054
- remove invalid tests
- fix tests
- add more tests to handle corner cases

* Address review comment

* Handle durable & non-durable in the correct way

* Fix cache tests since now entries get evicted reactively

* Address review comment about method names

* Change signature for add method so that position must be passed

- this is more consistent with cursorUpdated method where the position is passed

* Update javadoc for ManagedCursorContainer

* Address review comment

* Simplify ManagedCursorContainer

* Clarify javadoc

* Ensure that cursors are tracked by making sure that initial position isn't null unintentionally

* Prevent race in updating activeCursors
Technoboy- pushed a commit that referenced this pull request Oct 31, 2022
…sors (#17273)

* [fix][broker] Fix broken build caused by conflict between #17195 and #16605

- #17195 changed the method signature that #16605 depended upon

* [fix][broker] Keep sorted list of cursors ordered by read position of active cursors when cacheEvictionByMarkDeletedPosition=false

Fixes #16054

- calculate the sorted list of when a read position gets updated
- this resolves #9958 in a proper way
  - #12045 broke the caching solution as explained in #16054
- remove invalid tests
- fix tests
- add more tests to handle corner cases

* Address review comment

* Handle durable & non-durable in the correct way

* Fix cache tests since now entries get evicted reactively

* Address review comment about method names

* Change signature for add method so that position must be passed

- this is more consistent with cursorUpdated method where the position is passed

* Update javadoc for ManagedCursorContainer

* Address review comment

* Simplify ManagedCursorContainer

* Clarify javadoc

* Ensure that cursors are tracked by making sure that initial position isn't null unintentionally

* Prevent race in updating activeCursors
congbobo184 pushed a commit that referenced this pull request Nov 17, 2022
…sors (#17273)

* [fix][broker] Fix broken build caused by conflict between #17195 and #16605

- #17195 changed the method signature that #16605 depended upon

* [fix][broker] Keep sorted list of cursors ordered by read position of active cursors when cacheEvictionByMarkDeletedPosition=false

Fixes #16054

- calculate the sorted list of when a read position gets updated
- this resolves #9958 in a proper way
  - #12045 broke the caching solution as explained in #16054
- remove invalid tests
- fix tests
- add more tests to handle corner cases

* Address review comment

* Handle durable & non-durable in the correct way

* Fix cache tests since now entries get evicted reactively

* Address review comment about method names

* Change signature for add method so that position must be passed

- this is more consistent with cursorUpdated method where the position is passed

* Update javadoc for ManagedCursorContainer

* Address review comment

* Simplify ManagedCursorContainer

* Clarify javadoc

* Ensure that cursors are tracked by making sure that initial position isn't null unintentionally

* Prevent race in updating activeCursors

(cherry picked from commit 856ef15)
AnonHxy added a commit to AnonHxy/pulsar that referenced this pull request Nov 20, 2022
…pache#16605)

[improve][client]PIP-189: No batching if only one message in batch apache#16605

### Motivation

* See apache#16619

### Modifications

* See apache#16619
* Most of the Modifications are relevant to `BatchMessageContainerImpl`
* Of course there are some tests about batching need to be modified, because batched producer can also pubulish non-batched messages when this PIP applies. The tests include:
    * `RGUsageMTAggrWaitForAllMsgsTest`
    * `BatchMessageTest`
    * `BrokerEntryMetadataE2ETest`
    * `ClientDeduplicationTest`
    * `TopicReaderTest`
    * `PulsarClientToolTest`
@AnonHxy AnonHxy modified the milestones: 2.12.0, 2.11.0 Nov 20, 2022
@Jason918
Copy link
Contributor

move release/2.11.0 label to #18548

congbobo184 pushed a commit that referenced this pull request Dec 7, 2022
…sors (#17273)

* [fix][broker] Fix broken build caused by conflict between #17195 and #16605

- #17195 changed the method signature that #16605 depended upon

* [fix][broker] Keep sorted list of cursors ordered by read position of active cursors when cacheEvictionByMarkDeletedPosition=false

Fixes #16054

- calculate the sorted list of when a read position gets updated
- this resolves #9958 in a proper way
  - #12045 broke the caching solution as explained in #16054
- remove invalid tests
- fix tests
- add more tests to handle corner cases

* Address review comment

* Handle durable & non-durable in the correct way

* Fix cache tests since now entries get evicted reactively

* Address review comment about method names

* Change signature for add method so that position must be passed

- this is more consistent with cursorUpdated method where the position is passed

* Update javadoc for ManagedCursorContainer

* Address review comment

* Simplify ManagedCursorContainer

* Clarify javadoc

* Ensure that cursors are tracked by making sure that initial position isn't null unintentionally

* Prevent race in updating activeCursors

(cherry picked from commit 856ef15)
BewareMyPower added a commit to BewareMyPower/kop that referenced this pull request Feb 22, 2023
### Motivation

apache/pulsar#17696 removes the
`powermock-reflect` dependency, which leads to a compilation error in
KoP.

### Modifications

Upgrade the Pulsar dependency to 2.11.0.0-rc5. Then replace
`Whitebox.invokeMethod` with `MethodUtils.invokeMethod`.

It also fixes the bug that null values are not handled well for
non-batched messages. This bug was exposed because of
[PIP-189](apache/pulsar#16605).

### TODO

Migrate the bug fix for non-batched messages to branch-2.10.x and
branch-2.9.x.
Demogorgon314 pushed a commit to streamnative/kop that referenced this pull request Feb 22, 2023
### Motivation

apache/pulsar#17696 removes the
`powermock-reflect` dependency, which leads to a compilation error in
KoP.

### Modifications

Upgrade the Pulsar dependency to 2.11.0.0-rc5. Then replace
`Whitebox.invokeMethod` with `MethodUtils.invokeMethod`.

It also fixes the bug that null values are not handled well for
non-batched messages. This bug was exposed because of
[PIP-189](apache/pulsar#16605).
Demogorgon314 pushed a commit to streamnative/kop that referenced this pull request Feb 22, 2023
### Motivation

apache/pulsar#17696 removes the
`powermock-reflect` dependency, which leads to a compilation error in
KoP.

### Modifications

Upgrade the Pulsar dependency to 2.11.0.0-rc5. Then replace
`Whitebox.invokeMethod` with `MethodUtils.invokeMethod`.

It also fixes the bug that null values are not handled well for
non-batched messages. This bug was exposed because of
[PIP-189](apache/pulsar#16605).

(cherry picked from commit 88fe870)
eolivelli pushed a commit to eolivelli/kop that referenced this pull request Feb 28, 2023
### Motivation

apache/pulsar#17696 removes the
`powermock-reflect` dependency, which leads to a compilation error in
KoP.

### Modifications

Upgrade the Pulsar dependency to 2.11.0.0-rc5. Then replace
`Whitebox.invokeMethod` with `MethodUtils.invokeMethod`.

It also fixes the bug that null values are not handled well for
non-batched messages. This bug was exposed because of
[PIP-189](apache/pulsar#16605).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker doc-not-needed Your PR changes do not impact docs type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants