Fixed error due to storage exception timeout. Added a delay between retries.
Change-Id: I99bdfbe980eac7069f34203ee69fe0c5c480db45
Showing
2 changed files
with
16 additions
and
17 deletions
... | @@ -17,7 +17,6 @@ package org.onosproject.store.app; | ... | @@ -17,7 +17,6 @@ package org.onosproject.store.app; |
17 | 17 | ||
18 | import com.google.common.base.Charsets; | 18 | import com.google.common.base.Charsets; |
19 | import com.google.common.collect.ImmutableSet; | 19 | import com.google.common.collect.ImmutableSet; |
20 | - | ||
21 | import org.apache.felix.scr.annotations.Activate; | 20 | import org.apache.felix.scr.annotations.Activate; |
22 | import org.apache.felix.scr.annotations.Component; | 21 | import org.apache.felix.scr.annotations.Component; |
23 | import org.apache.felix.scr.annotations.Deactivate; | 22 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -43,12 +42,12 @@ import org.onosproject.store.cluster.messaging.ClusterCommunicationService; | ... | @@ -43,12 +42,12 @@ import org.onosproject.store.cluster.messaging.ClusterCommunicationService; |
43 | import org.onosproject.store.cluster.messaging.ClusterMessage; | 42 | import org.onosproject.store.cluster.messaging.ClusterMessage; |
44 | import org.onosproject.store.cluster.messaging.ClusterMessageHandler; | 43 | import org.onosproject.store.cluster.messaging.ClusterMessageHandler; |
45 | import org.onosproject.store.cluster.messaging.MessageSubject; | 44 | import org.onosproject.store.cluster.messaging.MessageSubject; |
46 | -import org.onosproject.store.service.MultiValuedTimestamp; | ||
47 | import org.onosproject.store.serializers.KryoNamespaces; | 45 | import org.onosproject.store.serializers.KryoNamespaces; |
48 | import org.onosproject.store.service.EventuallyConsistentMap; | 46 | import org.onosproject.store.service.EventuallyConsistentMap; |
49 | import org.onosproject.store.service.EventuallyConsistentMapEvent; | 47 | import org.onosproject.store.service.EventuallyConsistentMapEvent; |
50 | import org.onosproject.store.service.EventuallyConsistentMapListener; | 48 | import org.onosproject.store.service.EventuallyConsistentMapListener; |
51 | import org.onosproject.store.service.LogicalClockService; | 49 | import org.onosproject.store.service.LogicalClockService; |
50 | +import org.onosproject.store.service.MultiValuedTimestamp; | ||
52 | import org.onosproject.store.service.StorageService; | 51 | import org.onosproject.store.service.StorageService; |
53 | import org.slf4j.Logger; | 52 | import org.slf4j.Logger; |
54 | 53 | ||
... | @@ -63,15 +62,10 @@ import java.util.function.Function; | ... | @@ -63,15 +62,10 @@ import java.util.function.Function; |
63 | 62 | ||
64 | import static com.google.common.io.ByteStreams.toByteArray; | 63 | import static com.google.common.io.ByteStreams.toByteArray; |
65 | import static java.util.concurrent.TimeUnit.MILLISECONDS; | 64 | import static java.util.concurrent.TimeUnit.MILLISECONDS; |
65 | +import static org.onlab.util.Tools.delay; | ||
66 | import static org.onlab.util.Tools.groupedThreads; | 66 | import static org.onlab.util.Tools.groupedThreads; |
67 | -import static org.onosproject.app.ApplicationEvent.Type.APP_ACTIVATED; | 67 | +import static org.onosproject.app.ApplicationEvent.Type.*; |
68 | -import static org.onosproject.app.ApplicationEvent.Type.APP_DEACTIVATED; | 68 | +import static org.onosproject.store.app.GossipApplicationStore.InternalState.*; |
69 | -import static org.onosproject.app.ApplicationEvent.Type.APP_INSTALLED; | ||
70 | -import static org.onosproject.app.ApplicationEvent.Type.APP_PERMISSIONS_CHANGED; | ||
71 | -import static org.onosproject.app.ApplicationEvent.Type.APP_UNINSTALLED; | ||
72 | -import static org.onosproject.store.app.GossipApplicationStore.InternalState.ACTIVATED; | ||
73 | -import static org.onosproject.store.app.GossipApplicationStore.InternalState.DEACTIVATED; | ||
74 | -import static org.onosproject.store.app.GossipApplicationStore.InternalState.INSTALLED; | ||
75 | import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT; | 69 | import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT; |
76 | import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE; | 70 | import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE; |
77 | import static org.slf4j.LoggerFactory.getLogger; | 71 | import static org.slf4j.LoggerFactory.getLogger; |
... | @@ -85,12 +79,13 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -85,12 +79,13 @@ import static org.slf4j.LoggerFactory.getLogger; |
85 | public class GossipApplicationStore extends ApplicationArchive | 79 | public class GossipApplicationStore extends ApplicationArchive |
86 | implements ApplicationStore { | 80 | implements ApplicationStore { |
87 | 81 | ||
88 | - private static final int MAX_LOAD_RETRIES = 3; | ||
89 | - | ||
90 | private final Logger log = getLogger(getClass()); | 82 | private final Logger log = getLogger(getClass()); |
91 | 83 | ||
92 | private static final MessageSubject APP_BITS_REQUEST = new MessageSubject("app-bits-request"); | 84 | private static final MessageSubject APP_BITS_REQUEST = new MessageSubject("app-bits-request"); |
93 | 85 | ||
86 | + private static final int MAX_LOAD_RETRIES = 3; | ||
87 | + private static final int RETRY_DELAY_MS = 2_000; | ||
88 | + | ||
94 | private static final int FETCH_TIMEOUT_MS = 10_000; | 89 | private static final int FETCH_TIMEOUT_MS = 10_000; |
95 | private static final int LOAD_TIMEOUT_MS = 5_000; | 90 | private static final int LOAD_TIMEOUT_MS = 5_000; |
96 | 91 | ||
... | @@ -174,6 +169,7 @@ public class GossipApplicationStore extends ApplicationArchive | ... | @@ -174,6 +169,7 @@ public class GossipApplicationStore extends ApplicationArchive |
174 | } | 169 | } |
175 | } catch (Exception e) { | 170 | } catch (Exception e) { |
176 | log.warn("Unable to load application {} from disk; retrying", name); | 171 | log.warn("Unable to load application {} from disk; retrying", name); |
172 | + delay(RETRY_DELAY_MS); // FIXME: This is a deliberate hack; fix in Drake | ||
177 | } | 173 | } |
178 | } | 174 | } |
179 | } | 175 | } |
... | @@ -412,6 +408,7 @@ public class GossipApplicationStore extends ApplicationArchive | ... | @@ -412,6 +408,7 @@ public class GossipApplicationStore extends ApplicationArchive |
412 | } | 408 | } |
413 | } | 409 | } |
414 | } | 410 | } |
411 | + | ||
415 | /** | 412 | /** |
416 | * Prunes applications which are not in the map, but are on disk. | 413 | * Prunes applications which are not in the map, but are on disk. |
417 | */ | 414 | */ | ... | ... |
1 | package org.onosproject.store.core.impl; | 1 | package org.onosproject.store.core.impl; |
2 | 2 | ||
3 | -import static org.slf4j.LoggerFactory.getLogger; | 3 | +import com.google.common.collect.Maps; |
4 | - | ||
5 | -import java.util.Map; | ||
6 | - | ||
7 | import org.apache.felix.scr.annotations.Activate; | 4 | import org.apache.felix.scr.annotations.Activate; |
8 | import org.apache.felix.scr.annotations.Component; | 5 | import org.apache.felix.scr.annotations.Component; |
9 | import org.apache.felix.scr.annotations.Deactivate; | 6 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -17,7 +14,10 @@ import org.onosproject.store.service.StorageException; | ... | @@ -17,7 +14,10 @@ import org.onosproject.store.service.StorageException; |
17 | import org.onosproject.store.service.StorageService; | 14 | import org.onosproject.store.service.StorageService; |
18 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
19 | 16 | ||
20 | -import com.google.common.collect.Maps; | 17 | +import java.util.Map; |
18 | + | ||
19 | +import static org.onlab.util.Tools.delay; | ||
20 | +import static org.slf4j.LoggerFactory.getLogger; | ||
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Implementation of {@code IdBlockStore} using {@code AtomicCounter}. | 23 | * Implementation of {@code IdBlockStore} using {@code AtomicCounter}. |
... | @@ -27,6 +27,7 @@ import com.google.common.collect.Maps; | ... | @@ -27,6 +27,7 @@ import com.google.common.collect.Maps; |
27 | public class ConsistentIdBlockStore implements IdBlockStore { | 27 | public class ConsistentIdBlockStore implements IdBlockStore { |
28 | 28 | ||
29 | private static final int MAX_TRIES = 3; | 29 | private static final int MAX_TRIES = 3; |
30 | + private static final int RETRY_DELAY_MS = 2_000; | ||
30 | 31 | ||
31 | private final Logger log = getLogger(getClass()); | 32 | private final Logger log = getLogger(getClass()); |
32 | private final Map<String, AtomicCounter> topicCounters = Maps.newConcurrentMap(); | 33 | private final Map<String, AtomicCounter> topicCounters = Maps.newConcurrentMap(); |
... | @@ -62,6 +63,7 @@ public class ConsistentIdBlockStore implements IdBlockStore { | ... | @@ -62,6 +63,7 @@ public class ConsistentIdBlockStore implements IdBlockStore { |
62 | log.warn("Unable to allocate ID block due to {}; retrying...", | 63 | log.warn("Unable to allocate ID block due to {}; retrying...", |
63 | e.getMessage()); | 64 | e.getMessage()); |
64 | exc = e; | 65 | exc = e; |
66 | + delay(RETRY_DELAY_MS); // FIXME: This is a deliberate hack; fix in Drake | ||
65 | } | 67 | } |
66 | } | 68 | } |
67 | throw new IllegalStateException("Unable to allocate ID block", exc); | 69 | throw new IllegalStateException("Unable to allocate ID block", exc); | ... | ... |
-
Please register or login to post a comment