This is an automated email from the ASF dual-hosted git repository.

chenhang pushed a commit to branch branch-4.14
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit d23e63cb7987c8454989fd7535a4446f1a1fc9f4
Author: houxiaoyu <[email protected]>
AuthorDate: Mon Feb 27 12:02:38 2023 +0800

    Fix ReadEntryProcessor v2 SchedulingDelayStats (#3758)
    
    Descriptions of the changes in this PR:
    
    We registered `ReadEntrySchedulingDelayStats` of `ReadEntryProcessor` as 
`WriteThreadQueuedLatency` mistakenly, so we need fix it.
    
    Register `ReadEntrySchedulingDelayStats`  if `ReadEntryProcessor`
    
    (cherry picked from commit 08ef6491a61cc3fbc3d055eb56b75eb221f986ec)
---
 .../bookkeeper/proto/PacketProcessorBase.java      | 11 +++++--
 .../TestCompatUpgradeWithHostnameBookieId.groovy   | 34 +++++++++++-----------
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PacketProcessorBase.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PacketProcessorBase.java
index 7b642f524c..8854ebebb3 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PacketProcessorBase.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PacketProcessorBase.java
@@ -168,8 +168,15 @@ abstract class PacketProcessorBase<T extends Request> 
extends SafeRunnable {
 
     @Override
     public void safeRun() {
-        requestProcessor.getRequestStats().getWriteThreadQueuedLatency()
-                .registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueNanos), 
TimeUnit.NANOSECONDS);
+        if (request instanceof BookieProtocol.ReadRequest) {
+            
requestProcessor.getRequestStats().getReadEntrySchedulingDelayStats()
+                    
.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueNanos), 
TimeUnit.NANOSECONDS);
+        }
+        if (request instanceof BookieProtocol.ParsedAddRequest) {
+            requestProcessor.getRequestStats().getWriteThreadQueuedLatency()
+                    
.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueNanos), 
TimeUnit.NANOSECONDS);
+        }
+
         if (!isVersionCompatible()) {
             sendResponse(BookieProtocol.EBADVERSION,
                          
ResponseBuilder.buildErrorResponse(BookieProtocol.EBADVERSION, request),
diff --git 
a/tests/backward-compat/hostname-bookieid/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgradeWithHostnameBookieId.groovy
 
b/tests/backward-compat/hostname-bookieid/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgradeWithHostnameBookieId.groovy
index c6cf08a85c..eb6114da57 100644
--- 
a/tests/backward-compat/hostname-bookieid/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgradeWithHostnameBookieId.groovy
+++ 
b/tests/backward-compat/hostname-bookieid/src/test/groovy/org/apache/bookkeeper/tests/backwardcompat/TestCompatUpgradeWithHostnameBookieId.groovy
@@ -1,20 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.bookkeeper.tests.backwardcompat
 
 import com.github.dockerjava.api.DockerClient

Reply via email to