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

Use leader's clock when calculating LTS cutoff timestamp #12998

Merged
merged 16 commits into from May 13, 2024

Conversation

ieQu1
Copy link
Member

@ieQu1 ieQu1 commented May 9, 2024

Fixes EMQX-12198

Release version: v/e5.7

Summary

This PR fixes clock skew issues that could lead to the loss of messages during replay of the messages in the current epoch of LTS storage.

On the storage layer, this PR also separates preparation of the batch from committing it.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Added property-based tests for code which performs user input validation
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix|breaking)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • Created PR to emqx-docs if documentation update is required, or link to a follow-up jira ticket
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

@ieQu1 ieQu1 requested review from keynslug, a team and lafirest as code owners May 9, 2024 00:15
{State, Result};
apply(
_RaftMeta,
#{?tag := storage_event, ?payload := CustomEvent, ?now := Now},
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny nit: for some reason, dialyzer didn't complain about this new tag in ra_command(). 🙈

apps/emqx_utils/src/emqx_utils_stream.erl Outdated Show resolved Hide resolved
apps/emqx_durable_storage/src/emqx_ds_storage_layer.erl Outdated Show resolved Hide resolved
apps/emqx_durable_storage/src/emqx_ds_storage_layer.erl Outdated Show resolved Hide resolved
apps/emqx_durable_storage/src/emqx_ds_storage_layer.erl Outdated Show resolved Hide resolved
apps/emqx_durable_storage/src/emqx_ds_storage_layer.erl Outdated Show resolved Hide resolved
?tp(emqx_ds_storage_layer_store_batch, #{
shard => Shard, messages => Messages, options => Options
}),
case prepare_batch(Shard, Messages, Options) of
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Should this piece of code eventually end up in what's now ra_store_batch/3?

apps/emqx_durable_storage/test/emqx_ds_test_helpers.erl Outdated Show resolved Hide resolved
@ieQu1 ieQu1 merged commit 8506ca7 into emqx:release-57 May 13, 2024
170 of 171 checks passed
@emqxqa
Copy link

emqxqa commented May 14, 2024

TestExecution

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.

None yet

4 participants