Skip to content

SAMZA-2519: Support duplicate timer registration#1355

Merged
mynameborat merged 2 commits into
apache:masterfrom
mynameborat:allow-duplicate-timer
May 8, 2020
Merged

SAMZA-2519: Support duplicate timer registration#1355
mynameborat merged 2 commits into
apache:masterfrom
mynameborat:allow-duplicate-timer

Conversation

@mynameborat
Copy link
Copy Markdown
Contributor

@mynameborat mynameborat commented May 5, 2020

Issue: In EpochTimeScheduler, when the caller tries to register a duplicate timer with new callback, Samza throws an exception. This behavior prevents callers from updating the callbacks for a given timer key.
Changes: Allow registration for duplicate timer key where the newer callback will overwrite the previous callback provided it can be canceled. Refer to API changes section for semantics change to the existing API.
Tests: Added unit tests to validate scenarios where duplicate registration succeeds vs no-ops.
API Changes: setTimer API now allows duplicate timer registration. The semantics of the duplicate registration is as follows

  1. Duplicate registrations will attempt the cancel the previously registered callbacks. If its unsuccessful, the new request to register the timer will be ignored.
  2. If the previously registered callback has been fired successfully at the time of the new request, the new request will be fulfilled. This is to ensure we remain consistent and stay inline with the current semantics.

Upgrade Instructions: None
Usage Instructions: None

@mynameborat mynameborat requested a review from xinyuiscool May 6, 2020 02:25
Comment thread samza-core/src/main/java/org/apache/samza/scheduler/EpochTimeScheduler.java Outdated
Copy link
Copy Markdown
Contributor

@xinyuiscool xinyuiscool left a comment

Choose a reason for hiding this comment

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

LGTM!

@mynameborat mynameborat merged commit a29f29a into apache:master May 8, 2020
@mynameborat mynameborat deleted the allow-duplicate-timer branch September 2, 2020 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants