use of voldemort.store.InvalidMetadataException in project voldemort by voldemort.
the class DefaultStoreClient method getAll.
public Map<K, Versioned<V>> getAll(Iterable<K> keys) {
Map<K, List<Versioned<V>>> items = null;
for (int attempts = 0; ; attempts++) {
if (attempts >= this.metadataRefreshAttempts)
throw new VoldemortException(this.metadataRefreshAttempts + " metadata refresh attempts failed.");
try {
items = store.getAll(keys, null);
break;
} catch (InvalidMetadataException e) {
logger.info("Received invalid metadata exception during getAll [ " + e.getMessage() + " ] on store '" + storeName + "'. Rebootstrapping");
bootStrap();
}
}
Map<K, Versioned<V>> result = Maps.newHashMapWithExpectedSize(items.size());
for (Entry<K, List<Versioned<V>>> mapEntry : items.entrySet()) {
Versioned<V> value = getItemOrThrow(mapEntry.getKey(), null, mapEntry.getValue());
result.put(mapEntry.getKey(), value);
}
return result;
}
use of voldemort.store.InvalidMetadataException in project voldemort by voldemort.
the class AsyncMetadataVersionManager method run.
public void run() {
logger.debug("************* AsyncMetadataVersionManger running. Checking for " + SystemStoreConstants.CLUSTER_VERSION_KEY + " and " + storesVersionKey + " *************");
try {
/*
* Get the properties object from the system store (containing
* versions)
*/
Properties versionProps = MetadataVersionStoreUtils.getProperties(this.systemStoreRepository.getMetadataVersionStore());
Long newClusterVersion = fetchNewVersion(SystemStoreConstants.CLUSTER_VERSION_KEY, this.currentClusterVersion, versionProps);
Long newStoreVersion = fetchNewVersion(storesVersionKey, this.currentStoreVersion, versionProps);
// Check if something has been updated
if ((newClusterVersion != null) || (newStoreVersion != null)) {
logger.info("Metadata version mismatch detected. Re-bootstrapping!");
try {
if (newClusterVersion != null) {
logger.info("Updating cluster version");
currentClusterVersion = newClusterVersion;
}
if (newStoreVersion != null) {
logger.info("Updating store : '" + storesVersionKey + "' version");
this.currentStoreVersion = newStoreVersion;
}
this.storeClientThunk.call();
} catch (Exception e) {
logger.error("Exception occurred while invoking the rebootstrap callback.", e);
}
}
} catch (InvalidMetadataException e) {
try {
this.storeClientThunk.call();
} catch (Exception e2) {
logger.error("Exception occurred while invoking the rebootstrap callback.", e);
}
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Could not retrieve metadata versions from the server.", e);
}
}
}
use of voldemort.store.InvalidMetadataException in project voldemort by voldemort.
the class InvalidMetadataCheckingStoreTest method testValidMetaData.
public void testValidMetaData() {
Cluster cluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 } });
StoreDefinition storeDef = ServerTestUtils.getStoreDefs(1).get(0);
MetadataStore metadata = ServerTestUtils.createMetadataStore(cluster, Arrays.asList(storeDef));
InvalidMetadataCheckingStore store = new InvalidMetadataCheckingStore(0, new DoNothingStore<ByteArray, byte[], byte[]>(storeDef.getName()), metadata);
try {
doOperations(0, store, metadata, storeDef);
} catch (InvalidMetadataException e) {
throw new RuntimeException("Should not see any InvalidMetaDataException", e);
}
}
use of voldemort.store.InvalidMetadataException in project voldemort by voldemort.
the class RedirectingStoreTest method testProxyGetDuringPut.
@Test
public void testProxyGetDuringPut() {
final RedirectingStore storeNode2 = getRedirectingStore(2, servers[2].getMetadataStore(), "test");
final RedirectingStore storeNode0 = getRedirectingStore(0, servers[0].getMetadataStore(), "test");
// Check primary
for (final Entry<ByteArray, byte[]> entry : primaryEntriesMoved.entrySet()) {
try {
// should see obsoleteVersionException for same vectorClock
storeNode2.put(entry.getKey(), Versioned.value(entry.getValue(), new VectorClock().incremented(0, System.currentTimeMillis())), null);
fail("Should see obsoleteVersionException here.");
} catch (ObsoleteVersionException e) {
// ignore
}
try {
// should see obsoleteVersionException for same vectorClock
storeNode0.put(entry.getKey(), Versioned.value(entry.getValue(), new VectorClock().incremented(0, System.currentTimeMillis())), null);
fail("Should see obsoleteVersionException here.");
} catch (ObsoleteVersionException e) {
// ignore
} catch (InvalidMetadataException e) {
}
}
}
Aggregations