You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/12/05 09:59:21 UTC

[skywalking] branch fix updated: Revert SessionCacheCallback

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

wusheng pushed a commit to branch fix
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/fix by this push:
     new 18c91816ec Revert SessionCacheCallback
18c91816ec is described below

commit 18c91816ecc0bb6baf248757f55eb6457bd7420e
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Mon Dec 5 17:59:14 2022 +0800

    Revert SessionCacheCallback
---
 .../oap/server/core/storage/SessionCacheCallback.java          | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java
index 98e01bf87c..ceff064e05 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/SessionCacheCallback.java
@@ -29,12 +29,22 @@ import org.apache.skywalking.oap.server.core.analysis.worker.MetricsSessionCache
 public class SessionCacheCallback {
     private final MetricsSessionCache sessionCache;
     private final Metrics metrics;
+    /**
+     * In some cases, this callback could be shared by multiple executions, such as SQLExecutor#additionalSQLs.
+     * This flag would make sure, once one of the generated executions is failure, the whole metric would be removed
+     * from the cache, and would not be added back. As those are executed in a batch mode. The sequence is uncertain.
+     */
+    private volatile boolean isFailed = false;
 
     public void onInsertCompleted() {
+        if (isFailed) {
+            return;
+        }
         sessionCache.put(metrics);
     }
 
     public void onUpdateFailure() {
+        isFailed = true;
         sessionCache.remove(metrics);
     }
 }