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)
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;
/**
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
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() {
@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());
}
// 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
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 {