Skip to content

Conversation

@merlimat
Copy link
Contributor

Motivation

To support the grouping of acknowledgements, we need to be able to pass multiple message ids to managed ledger to delete individually.

This change will be used then in broker to do group acknowledgment

@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Mar 27, 2018
@merlimat merlimat added this to the 2.0.0-incubating milestone Mar 27, 2018
@merlimat merlimat self-assigned this Mar 27, 2018
@merlimat merlimat requested review from jai1, rdhabalia and sijie March 27, 2018 01:55
@jai1
Copy link
Contributor

jai1 commented Mar 28, 2018

retest this please

@merlimat merlimat mentioned this pull request Mar 28, 2018
@merlimat merlimat force-pushed the delayed-acks branch 2 times, most recently from fc2e376 to 6f4024d Compare March 28, 2018 20:48

@Override
public void delete(final Position position) throws InterruptedException, ManagedLedgerException {
checkNotNull(position);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have these checks in ManagedCursorImpl.java:1524 (asyncDelete)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would fail anyway the cast: PositionImpl position = (PositionImpl) pos;

Copy link
Contributor

Choose a reason for hiding this comment

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

What about the checkNotNull?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the cast will fail if pos is null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(throwing NPE)

if (STATE_UPDATER.get(this) == State.Closed) {
@Override
public void asyncDelete(Iterable<Position> positions, AsyncCallbacks.DeleteCallback callback, Object ctx) {
if (state == State.Closed) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Leave it as STATE_UPDATER.get(this)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no difference with STATE_UPDATER.get(this). Reading a volatile variable gives the last value of it.

log.debug("[{}] Found a position range to mark delete for cursor {}: {} ", ledger.getName(),
name, range);
}
// Bug:7062188 - markDeletePosition can sometimes be stuck at the beginning of an empty ledger.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the address where we can find this bug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The comment was there in the code. If you can find it in the old Yahoo bugzilla... I'll put a link :)

Copy link
Contributor

@jai1 jai1 Mar 29, 2018

Choose a reason for hiding this comment

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

I went through the ticket - not very informative.
I would suggest removing the comment altogether unless we have seen the issue again in recent history.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, not related with this change but will remove

@merlimat
Copy link
Contributor Author

@jai1 Updated

@merlimat merlimat merged commit 73a214a into apache:master Mar 30, 2018
@merlimat merlimat deleted the delayed-acks branch March 30, 2018 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants