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

[server] Cdc log visible only when the data already flush to rocksDb from preWriteBuffer #179

Merged
merged 4 commits into from
Mar 6, 2025

Conversation

swuferhong
Copy link
Collaborator

Purpose

This pr is aims to fix the visibility of the CDC log, it should only become visible after the KV data has been flushed to RocksDb.

Linked issue: #134

Tests

API and Format

Documentation

Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

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

We need to add a test to reproduce the problem. Maybe add a test in ReplicaManagerTest to verify the high-watermark of the given record is must advanced if the given record can be read in kv.

@swuferhong
Copy link
Collaborator Author

@wuchong comments addressed.

assertThat(lookups.get(0)).isNull();
replicaManager.putRecordsToKv(
20000,
1,
Copy link
Member

Choose a reason for hiding this comment

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

this test can reproduce the problem, because it only has one replia and ack=1, so after executing replicaManager.putRecordsToKv, the watermark has been advanced, and kv data has been flushed, thus the following test is always success without any changes to the source code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I switched to a multi-thread way to validate this issue. In the new test, if highWatermarkUpdateTimestamp is less than lastTimestampForNullValue even once, it indicates that the CDC log visibility is earlier than the KV. Specifically, highWatermarkUpdateTimestamp is later than the actual highWatermarkUpdate time, and lastTimestampForNullValue is earlier than the collected time, which is intended to eliminate influence of collecting. Pr ready.

Copy link
Collaborator Author

@swuferhong swuferhong Mar 4, 2025

Choose a reason for hiding this comment

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

In my local env, if I revert the change, the test will always failed.

@swuferhong
Copy link
Collaborator Author

@wuchong comments addressed.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…from preWriteBuffer
@wuchong wuchong merged commit ba36d05 into alibaba:main Mar 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants