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

feat(dup): write pegasus value in new data version for duplication #459

Merged
merged 27 commits into from
Feb 11, 2020

Conversation

neverchanje
Copy link
Contributor

What problem does this PR solve?

Duplication requires "timetag" to be encoded in value for "master-master" write-conflict resolution.
This PR introduces a read-before-write mechanism on every duplicated write.

What is changed and how it works?

For our read-before-write implementation, we read the record from RocksDB and decodes its timetag. If new timetag in duplicated write is larger than the old timetag, this duplicated write can be applied. Otherwise, the duplicate will be ignored.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Code changes

  • Has persistent data change

Side effects

  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to be included in the release note

@neverchanje neverchanje added type/incompatible Changes that introduced incompatibility to Pegasus. component/duplication cluster duplication labels Jan 17, 2020
src/server/pegasus_write_service_impl.h Outdated Show resolved Hide resolved
src/server/pegasus_write_service_impl.h Outdated Show resolved Hide resolved
src/server/pegasus_write_service_impl.h Show resolved Hide resolved
src/server/pegasus_write_service_impl.h Outdated Show resolved Hide resolved
src/server/pegasus_write_service_impl.h Outdated Show resolved Hide resolved
src/server/pegasus_write_service_impl.h Outdated Show resolved Hide resolved
uint64_t local_timetag =
pegasus_extract_timetag(_pegasus_data_version, get_ctx.raw_value);

if (local_timetag >= new_timetag) {
Copy link
Contributor

Choose a reason for hiding this comment

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

如果timestamp和cluster id相同,remove操作优先于put?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

热备份暂时不考虑 remove,remove 的一致性判断比较复杂

{
struct test_case
{
int value_schema_version;

uint32_t expire_ts;
uint64_t timetag;
Copy link
Contributor

Choose a reason for hiding this comment

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

这个用TEST_P刚好适合

Copy link
Contributor Author

@neverchanje neverchanje Feb 6, 2020

Choose a reason for hiding this comment

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

后面的PR会改,这个PR优先考虑让diff最小。

src/server/pegasus_write_service_impl.h Outdated Show resolved Hide resolved
src/server/pegasus_write_service_impl.h Show resolved Hide resolved
src/base/pegasus_value_schema.h Outdated Show resolved Hide resolved
@neverchanje neverchanje merged commit 9d311de into apache:master Feb 11, 2020
@neverchanje neverchanje deleted the dup-part branch February 11, 2020 03:22
@neverchanje neverchanje mentioned this pull request Mar 31, 2020
@neverchanje neverchanje mentioned this pull request May 14, 2020
acelyc111 pushed a commit to acelyc111/pegasus that referenced this pull request Jun 10, 2020
acelyc111 pushed a commit to acelyc111/pegasus that referenced this pull request Jun 10, 2020
acelyc111 pushed a commit that referenced this pull request Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/duplication cluster duplication type/incompatible Changes that introduced incompatibility to Pegasus. v2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants