-
Notifications
You must be signed in to change notification settings - Fork 1k
PHOENIX-7567 Replication Log Writer (Synchronous mode) #2144
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
base: PHOENIX-7562-feature
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a synchronous replication log writer using a Disruptor-based mechanism for efficient and reliable log appends and syncs. Key changes include:
- Adding the Disruptor dependency and version tag in the Maven POM files.
- Implementing the new ReplicationLogWriter with asynchronous append and sync logic plus retry/rotation on failures.
- Introducing comprehensive test cases for replication log writer and log manager behavior.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
pom.xml | Added the disruptor version property and dependency for the core module. |
phoenix-core/src/test/java/org/apache/phoenix/replication/ReplicationLogWriterTest.java | New tests covering synchronous sync, retry behavior, and blocking semantics. |
phoenix-core/src/test/java/org/apache/phoenix/replication/ReplicationLogManagerTest.java | Tests validating log rotation based on time, size, and stale writer exceptions. |
phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogWriter.java | Implementation of the Disruptor-based replication log writer with sync and retry logic. |
phoenix-core-server/pom.xml | Added disruptor dependency for the server module. |
phoenix-core/src/test/java/org/apache/phoenix/replication/ReplicationLogWriterTest.java
Outdated
Show resolved
Hide resolved
* happen if the log file writer is unable to make progress, due to a HDFS level disruption. | ||
* Should we enter that condition this method will block until the append can be inserted. | ||
* @param tableName The name of the HBase table the mutation applies to. | ||
* @param commitId The commit identifier (e.g., SCN) associated with the mutation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this basically the timestamp the coproc assigns to the mutation ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The mutation and the cells in the mutation carry that timestamp. The "commit identifier" is a Phoenix level transaction id. It can be whatever Phoenix needs it to be. If we don't need this concept at this layer it can be removed. This is defined in the design document, and is part of the replication log spec. (It can also be removed from those places.)
phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogManager.java
Outdated
Show resolved
Hide resolved
phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogWriter.java
Outdated
Show resolved
Hide resolved
I had in mind two classes with separation of concerns, *Manager (lifecycle) and *Writer (disruptor), but my thinking has evolved since I started hacking on this. Actually it has been drifting for a couple of days but it didn't come together until today. There will be a single class
I figure it will be easier to refactor this as we add more features, like store-and-forward, then to start with a half baked idea. |
d56a9ae unifies the code into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality for synchronous replication in the log writer by introducing a new generation field, and it integrates the Disruptor library as a dependency.
- Added disruptor dependency in both root and module pom.xml files
- Introduced a generation field with corresponding getter and setter in LogFileWriter.java, and updated the toString method to include this field
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
pom.xml | Added a new property and dependency for the Disruptor library |
phoenix-core-server/src/main/java/org/apache/phoenix/replication/log/LogFileWriter.java | Introduced a generation field, including its getter, setter, and inclusion in the toString method |
phoenix-core-server/pom.xml | Added the Disruptor dependency without an explicit version, likely relying on dependency management |
Comments suppressed due to low confidence (1)
phoenix-core-server/pom.xml:182
- The disruptor dependency is added without an explicit version; ensure that version management is handled via a parent POM or dependency management section to avoid unexpected upgrades.
<dependency>
phoenix-core-server/src/main/java/org/apache/phoenix/replication/log/LogFileWriter.java
Show resolved
Hide resolved
… will be improved later
I think the basic test coverage is pretty good now and I will probably take this out of draft status today. Let me think if there are a couple more test cases that would make sense. Here is the test coverage to date: Basic Append and Sync:
Failure Handling and Retry (Append/Sync):
Backpressure (Ring Buffer Full):
Sync Timeout:
Concurrent Producers:
Time-Based Rotation:
Size-Based Rotation:
Close Behavior:
Error Handling during Rotation/Initialization:
Rotation During Batch:
|
No description provided.