You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by yo...@apache.org on 2022/08/24 00:43:40 UTC
[bookkeeper] branch branch-4.15 updated: move forceWriteMarkerSent out of loop of ForceWriteThread to avoid frequently forceWrite (#3454)
This is an automated email from the ASF dual-hosted git repository.
yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/branch-4.15 by this push:
new 76eea92dcb move forceWriteMarkerSent out of loop of ForceWriteThread to avoid frequently forceWrite (#3454)
76eea92dcb is described below
commit 76eea92dcbc46e05aa20360d64ebf6fa169ea2b8
Author: yapeng <56...@qq.com>
AuthorDate: Wed Aug 24 08:25:58 2022 +0800
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 https://github.com/apache/bookkeeper/pull/2962
### Changes
move forceWriteMarkerSent=false out of while loop.
(cherry picked from commit dcc9a414eafbb27ed8d9a976ef824e825777273a)
---
.../src/main/java/org/apache/bookkeeper/bookie/Journal.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
index 46f48b1f90..62c07377d3 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
@@ -514,9 +514,9 @@ public class Journal extends BookieCriticalThread implements CheckpointSource {
boolean shouldForceWrite = true;
int numReqInLastForceWrite = 0;
long busyStartTime = System.nanoTime();
+ boolean forceWriteMarkerSent = false;
while (running) {
ForceWriteRequest req = null;
- boolean forceWriteMarkerSent = false;
try {
forceWriteThreadTime.add(MathUtils.elapsedNanos(busyStartTime));
req = forceWriteRequests.take();