Skip to content

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

Merged
neverchanje merged 27 commits into
apache:masterfrom
neverchanje:dup-part
Feb 11, 2020
Merged

neverchanje merged 27 commits into
apache:masterfrom
neverchanje:dup-part

Conversation

@neverchanje

Copy link
Copy Markdown
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
Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/base/pegasus_value_schema.h Resolved
Comment thread src/server/pegasus_write_service_impl.h Resolved
uint64_t local_timetag =
pegasus_extract_timetag(_pegasus_data_version, get_ctx.raw_value);

if (local_timetag >= new_timetag) {

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Comment thread src/server/pegasus_write_service_impl.h Resolved
int value_schema_version;

uint32_t expire_ts;
uint64_t timetag;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个用TEST_P刚好适合

@neverchanje neverchanje Feb 6, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/server/pegasus_write_service_impl.h Resolved
Comment thread src/base/pegasus_value_schema.h 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