BUG-8371: raise unknown history log to warn 40/57940/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 22 May 2017 08:11:51 +0000 (10:11 +0200)
committerRobert Varga <nite@hq.sk>
Sun, 28 May 2017 20:34:13 +0000 (20:34 +0000)
This error seems to be happening quite often, raise it to a warning
so we understand what request is triggering it.

Change-Id: If357325787f5c859a46af9286c86c0e9934909cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f336a5c159ed94fb63d588b934727d8149248273)

opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/DeadHistoryException.java
opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/commands/DeadHistoryExceptionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LeaderFrontendState.java

index d4293c4..7df8476 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.controller.cluster.access.commands;
 
 import com.google.common.annotations.Beta;
+import com.google.common.collect.RangeSet;
+import com.google.common.primitives.UnsignedLong;
 import org.opendaylight.controller.cluster.access.concepts.RequestException;
 
 /**
@@ -20,8 +22,8 @@ import org.opendaylight.controller.cluster.access.concepts.RequestException;
 public final class DeadHistoryException extends RequestException {
     private static final long serialVersionUID = 1L;
 
-    public DeadHistoryException(final long lastSeenHistory) {
-        super("Histories up to " + Long.toUnsignedString(lastSeenHistory) + " are accounted for");
+    public DeadHistoryException(final RangeSet<UnsignedLong> purgedHistories) {
+        super("Histories " + purgedHistories + " have been purged");
     }
 
     @Override
index f4d88ec..f68297d 100644 (file)
@@ -11,11 +11,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 
+import com.google.common.collect.ImmutableRangeSet;
 import org.opendaylight.controller.cluster.access.concepts.RequestExceptionTest;
 
 public class DeadHistoryExceptionTest extends RequestExceptionTest<DeadHistoryException> {
 
-    private static final DeadHistoryException OBJECT = new DeadHistoryException(100);
+    private static final DeadHistoryException OBJECT = new DeadHistoryException(ImmutableRangeSet.of());
 
     @Override
     protected void isRetriable() {
@@ -25,7 +26,7 @@ public class DeadHistoryExceptionTest extends RequestExceptionTest<DeadHistoryEx
     @Override
     protected void checkMessage() {
         final String message = OBJECT.getMessage();
-        assertEquals("Histories up to 100 are accounted for", message);
+        assertEquals("Histories [] have been purged", message);
         assertNull(OBJECT.getCause());
     }
 
index 24de062..8704f2a 100644 (file)
@@ -134,7 +134,7 @@ final class LeaderFrontendState implements Identifiable<ClientIdentifier> {
         // end up resurrecting a purged history.
         if (purgedHistories.contains(UnsignedLong.fromLongBits(id.getHistoryId()))) {
             LOG.debug("{}: rejecting purged request {}", persistenceId, request);
-            throw new DeadHistoryException(lastSeenHistory.longValue());
+            throw new DeadHistoryException(purgedHistories);
         }
 
         // Update last history we have seen
@@ -188,7 +188,12 @@ final class LeaderFrontendState implements Identifiable<ClientIdentifier> {
             if (lhId.getHistoryId() != 0) {
                 history = localHistories.get(lhId);
                 if (history == null) {
-                    LOG.debug("{}: rejecting unknown history request {}", persistenceId, request);
+                    if (purgedHistories.contains(UnsignedLong.fromLongBits(lhId.getHistoryId()))) {
+                        LOG.warn("{}: rejecting request {} to purged history", persistenceId, request);
+                        throw new DeadHistoryException(purgedHistories);
+                    }
+
+                    LOG.warn("{}: rejecting unknown history request {}", persistenceId, request);
                     throw new UnknownHistoryException(lastSeenHistory);
                 }
             } else {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.