-
Notifications
You must be signed in to change notification settings - Fork 895
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
[improvement] Refactor Auditor to simplify the readability #3637
[improvement] Refactor Auditor to simplify the readability #3637
Conversation
rerun failure checks |
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.
+1
thanks for this improvement, it will help a lot new contributions
ping @zymap @hangc0276 @shoothzj @dlg99 If you have time, can you help take a look. Thanks. |
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorBookieCheckTask.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorReplicasCheckTask.java
Show resolved
Hide resolved
rerun failure checks |
@hangc0276 I have addressed all your comments. PTAL. |
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.
First of all, thank you for taking on this task.
I recognize it is not simple, given all the iterations of this code and "small changes" snuck there over the years.
Looking at this version I feel it fails a bit short of original plan of refactoring.
It does split the code into smaller components but it leaves the components interconnected - tasks that have to access Auditor's internals etc. Typically this is a design smell that will backfire in the future when changing the code or it will become a burden when you start writing unit tests and mocks for the tasks
Second point is the unit tests. I think that new tasks deserve some unit tests.
This is a fantastic job so far and I applaud you for doing it.
I hope my comment makes sense and it can be made even better.
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorTask.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorBookieCheckTask.java
Outdated
Show resolved
Hide resolved
...eeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java
Outdated
Show resolved
Hide resolved
@dlg99 Thanks for all your comments. The comments make a lot of sense, I'll try to perfect the whole PR. |
…tor and Task & add unit test for all tasks
If tests not fail, PTAL. Thanks! |
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.
LGTM, thank you!
One test failed, I am re-running the test suite, we'll see if that's a flake.
I have another bugfix for Auditor. I want to commit after this PR so that I can avoid rebase master and resolve code conflicts. Can you help me to see this PR? Thank you very much. @hangc0276 @dlg99 @eolivelli |
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorTask.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #3637 +/- ##
============================================
+ Coverage 58.23% 68.17% +9.93%
- Complexity 5612 6712 +1100
============================================
Files 467 473 +6
Lines 40822 40943 +121
Branches 5234 5234
============================================
+ Hits 23774 27913 +4139
+ Misses 14933 10768 -4165
- Partials 2115 2262 +147
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AuditorPeriodicCheckTest.java
Show resolved
Hide resolved
...r-server/src/test/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTaskTest.java
Outdated
Show resolved
Hide resolved
...ver/src/test/java/org/apache/bookkeeper/replication/AuditorPlacementPolicyCheckTaskTest.java
Show resolved
Hide resolved
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.
LGTM.
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.
Overall LGTM.
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorStats.java
Show resolved
Hide resolved
...eeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java
Outdated
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorStats.java
Show resolved
Hide resolved
### Motivation Fix apache#3636 See explanation in apache#3636 ### Changes 1. Auditor class: Only reserved to do some necessary initialization work, scheduling of various detection tasks 2. Separate monitoring metrics into `AuditorStats` 3. Separate the auditBookies task to the `AuditorBookieCheckTask` 4. Separate the checkAllLedgers task into the `AuditorCheckAllLedgersTask` 5. Separate placementPolicyCheck task into `AuditorPlacementPolicyCheckTask` 6. Separate replicasCheck to `AuditorReplicasCheckTask`
Motivation
Fix #3636
See explanation in #3636
Changes
AuditorStats
AuditorBookieCheckTask
AuditorCheckAllLedgersTask
AuditorPlacementPolicyCheckTask
AuditorReplicasCheckTask