From 1541f82113a2e70f98fd908d94a0641e2f32b368 Mon Sep 17 00:00:00 2001 From: GCHQDev404 Date: Mon, 19 Jul 2021 09:47:31 -0700 Subject: [PATCH] gh-2422 FederatedStore ChangeGraphId & ChangeGraphAccess recovery info. --- .../federatedstore/FederatedGraphStorage.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedGraphStorage.java b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedGraphStorage.java index b6c87006030..4ee280ea12e 100644 --- a/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedGraphStorage.java +++ b/store-implementation/federated-store/src/main/java/uk/gov/gchq/gaffer/federatedstore/FederatedGraphStorage.java @@ -555,10 +555,9 @@ private boolean changeGraphAccess(final String graphId, final FederatedAccess ne try { federatedStoreCache.addGraphToCache(graphToMove, newFederatedAccess, true/*true because graphLibrary should have throw error*/); } catch (final CacheOperationException e) { - //TODO FS recovery - String s = "Error occurred updating graphAccess. GraphStorage=updated, Cache=outdated. graphId:" + graphId; - LOGGER.error(s + " graphStorage access:{} cache access:{}", newFederatedAccess, oldAccess); - throw new StorageException(s, e); + String message = String.format("Error occurred updating graphAccess. GraphStorage=updated, Cache=outdated. graphId:%s. Recovery is possible from a restart if a persistent cache is being used, otherwise contact admin", graphId); + LOGGER.error(message + " graphStorage access:{} cache access:{}", newFederatedAccess, oldAccess); + throw new StorageException(message, e); } } @@ -606,10 +605,9 @@ private boolean changeGraphId(final String graphId, final String newGraphId, fin try { federatedStoreCache.addGraphToCache(newGraphSerialisable, key, true/*true because graphLibrary should have throw error*/); } catch (final CacheOperationException e) { - //TODO FS recovery - String s = "Error occurred updating graphId. GraphStorage=updated, Cache=outdated graphId."; - LOGGER.error(s + " graphStorage graphId:{} cache graphId:{}", newGraphId, graphId); - throw new StorageException(s, e); + String message = String.format("Error occurred updating graphId. GraphStorage=updated, Cache=outdated graphId. graphStorage graphId:%s cache graphId:%s. Recovery is possible from a restart if a persistent cache is being used, otherwise contact admin", newGraphId, graphId); + LOGGER.error(message); + throw new StorageException(message, e); } federatedStoreCache.deleteGraphFromCache(graphId); }