Skip to content

Commit 76eea92

Browse files
yapxuezymap
authored andcommitted
move forceWriteMarkerSent out of loop of ForceWriteThread to avoid frequently forceWrite (#3454)
Fix group ForceWrite not take effect with forceWriteMarkerSent in while loop of ForceWriteThread ### Motivation Bookkeeper 4.15 has performance issue. There are too many journal sync. Then I found in ForceWriteThread, forceWriteMarkerSent is reset to false for every loop, and this can cause shouldForceWrite=true and trigger journal sync. This new logic is bringed by #2962 ### Changes move forceWriteMarkerSent=false out of while loop. (cherry picked from commit dcc9a41)
1 parent 7dfd51d commit 76eea92

File tree

1 file changed

+1
-1
lines changed
  • bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie

1 file changed

+1
-1
lines changed

Diff for: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ public void run() {
514514
boolean shouldForceWrite = true;
515515
int numReqInLastForceWrite = 0;
516516
long busyStartTime = System.nanoTime();
517+
boolean forceWriteMarkerSent = false;
517518
while (running) {
518519
ForceWriteRequest req = null;
519-
boolean forceWriteMarkerSent = false;
520520
try {
521521
forceWriteThreadTime.add(MathUtils.elapsedNanos(busyStartTime));
522522
req = forceWriteRequests.take();

0 commit comments

Comments
 (0)