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

Fix[mqbblp::RemoteQueue]: 0 deduplication timeout causes expired PUTs #494

Merged

Conversation

678098
Copy link
Collaborator

@678098 678098 commented Oct 31, 2024

deduplicationTimeMs parameter serves at least 2 roles:

  • it defines if queue history is saved or not on PRIMARY
  • it is used on REPLICA/PROXY to schedule PUT expiration if PRIMARY node is not available

With the second point, we got a bug. When we provide 0 timeout, we schedule PUT expiration almost immediately on REPLICA/PROXY, causing some of the PUTs to expire before reaching PRIMARY.

This PR handles 0 (and just for safety negative values, if someone wants to pass -1) for deduplicationTimeMs, and now we assume that "zero deduplication timeout means we don't want to expire messages for as long as we can". We use a default 5 minute timer in this case.

The sample WARN log from PROXY:
31OCT2024_17:33:11.257 (140251446843136) WARN mqbblp_remotequeue.cpp:488 Remote queue [@bmq://bmq.capmon.priority.sc/dummy]: cannot schedule PUT expiration timer with a non-positive timeout from config [0 ms], use a default PUT expiration timeout for scheduler instead [5.00 m]

@678098 678098 requested a review from a team as a code owner October 31, 2024 17:29
@678098 678098 requested review from dorjesinpo and removed request for a team October 31, 2024 17:29
@678098 678098 changed the title Fix[MQB]: fix 0 deduplication timeout causing instant expired puts on… Fix[MQB]: 0 deduplication timeout causing expired puts on REPLICA Oct 31, 2024
@678098 678098 changed the title Fix[MQB]: 0 deduplication timeout causing expired puts on REPLICA Fix[MQB]: 0 deduplication timeout causes expired PUTs on REPLICA Oct 31, 2024
… REPLICA

Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
@678098 678098 force-pushed the 241031_fix_zero_deduplication_timeout_replica branch from 2d2c902 to 37d1450 Compare October 31, 2024 17:38
@678098 678098 changed the title Fix[MQB]: 0 deduplication timeout causes expired PUTs on REPLICA Fix[MQB]: 0 deduplication timeout causes expired PUTs on PROXY Oct 31, 2024
@678098 678098 changed the title Fix[MQB]: 0 deduplication timeout causes expired PUTs on PROXY Fix[mqbblp::RemoteQueue]: 0 deduplication timeout causes expired PUTs Oct 31, 2024
Copy link
Collaborator

@dorjesinpo dorjesinpo left a comment

Choose a reason for hiding this comment

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

looks good, minor comments

@@ -483,6 +483,19 @@ RemoteQueue::RemoteQueue(QueueState* state,
os << '@' << d_state_p->uri().asString();
d_state_p->setDescription(os.str());

if (deduplicationTimeMs <= 0) {
d_pendingPutsTimeoutNs = 5 *
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's have a k_ constant instead of 5
Or, the default dedup timeout

<< "non-positive timeout from config ["
<< deduplicationTimeMs << " ms], use a default PUT "
<< "deduplication timeout for scheduler instead ["
<< bmqu::PrintUtil::prettyTimeInterval(
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's print the minutes, easier to read?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pretty time interval prints 5.00 m, you want to print the full 5 minutes instead, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is 5.00 m, then it is ok. Just did not want long string of zeroes

Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
@678098
Copy link
Collaborator Author

678098 commented Oct 31, 2024

@dorjesinpo I moved 5 to unit's constants. Also, changed the log line so it mentions expiration, not deduplication.

@678098 678098 requested a review from dorjesinpo October 31, 2024 18:10
@678098 678098 merged commit 198843c into bloomberg:main Oct 31, 2024
31 checks passed
@678098 678098 deleted the 241031_fix_zero_deduplication_timeout_replica branch October 31, 2024 19: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