Skip to content

Fix replication of large decimals #4521

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

Merged
merged 2 commits into from
Mar 17, 2021
Merged

Fix replication of large decimals #4521

merged 2 commits into from
Mar 17, 2021

Conversation

jedelbo
Copy link
Contributor

@jedelbo jedelbo commented Mar 16, 2021

What, How & Why?

Fixes #4519

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)

@jedelbo jedelbo force-pushed the je/decimal-replication branch from cf89838 to d80deb1 Compare March 16, 2021 12:13
@jedelbo jedelbo changed the base branch from v11 to master March 16, 2021 12:13
@jedelbo jedelbo requested a review from finnschiermer March 16, 2021 12:15
@jedelbo jedelbo force-pushed the je/decimal-replication branch from d80deb1 to ffcbfb8 Compare March 16, 2021 12:23
Copy link
Contributor

@finnschiermer finnschiermer left a comment

Choose a reason for hiding this comment

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

I think there is something wrong. See comments.

Also, concerning approach: wouldn't it be better to serialize/deserialize the 2 words separately. Should be easier to understand. Any reason not to ?

constexpr int bits_per_byte = 7;
using uchar = unsigned char;
char* ptr = buffer;
while (value_0 >> (bits_per_byte - 1)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems wrong. 1) why the "bits_per_byte-1", 2) isn't there a risk for too early out since value_1 is not part of the condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. "bits_per_byte-1" because there should be room for the sign bit in the last byte (always 0 in this case).
  2. An error - well spotted.

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps add a comment :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Has tests been updated to catch the error Finn spotted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error is fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

@jedelbo Yes, but I was more wondering if you added tests that would have found this error instead of Finn :-)

@jedelbo
Copy link
Contributor Author

jedelbo commented Mar 16, 2021

@finnschiermer it would be a change in the protocol if we changed the way we serialize the values.

@jedelbo jedelbo force-pushed the je/decimal-replication branch from ffcbfb8 to e0d0e5e Compare March 16, 2021 12:44
@bmunkholm
Copy link
Contributor

@jedelbo what was the root-cause for having this issue in the first place? Not creating an issue to fix the "FIXME"?

@jedelbo
Copy link
Contributor Author

jedelbo commented Mar 16, 2021

@bmunkholm yes, the root cause was me forgetting the FIXME.

@jedelbo jedelbo merged commit 4c20b13 into master Mar 17, 2021
@jedelbo jedelbo deleted the je/decimal-replication branch March 17, 2021 12:32
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Core crash after syncing a Mixed list.
3 participants