voldemortConfig.getClientMaxConnectionsPerNode());
try {
StorageEngine<ByteArray, byte[], byte[]> storageEngine = getStorageEngine(storeRepository,
storeName);
EventThrottler throttler = new EventThrottler(voldemortConfig.getStreamMaxWriteBytesPerSec());
if(isReadOnlyStore) {
ReadOnlyStorageEngine readOnlyStorageEngine = ((ReadOnlyStorageEngine) storageEngine);
String destinationDir = readOnlyStorageEngine.getCurrentDirPath();
logger.info("Fetching files for RO store '" + storeName
+ "' from node " + nodeId + " ( " + partitionIds + " )");
updateStatus("Fetching files for RO store '" + storeName
+ "' from node " + nodeId + " ( " + partitionIds + " )");
adminClient.readonlyOps.fetchPartitionFiles(nodeId,
storeName,
partitionIds,
destinationDir,
readOnlyStorageEngine.getChunkedFileSet()
.getChunkIdToNumChunks()
.keySet(),
running);
} else {
logger.info("Fetching entries for RW store '" + storeName
+ "' from node " + nodeId + " ( " + partitionIds + " )");
updateStatus("Fetching entries for RW store '" + storeName
+ "' from node " + nodeId + " ( " + partitionIds + " ) ");
if(partitionIds.size() > 0) {
Iterator<Pair<ByteArray, Versioned<byte[]>>> entriesIterator = adminClient.bulkFetchOps.fetchEntries(nodeId,
storeName,
partitionIds,
filter,
false,
initialCluster,
0);
long numTuples = 0;
long startTime = System.currentTimeMillis();
long startNs = System.nanoTime();
while(running.get() && entriesIterator.hasNext()) {
Pair<ByteArray, Versioned<byte[]>> entry = entriesIterator.next();
if(streamingStats != null) {
streamingStats.reportNetworkTime(Operation.UPDATE_ENTRIES,
Utils.elapsedTimeNs(startNs,
System.nanoTime()));
}
ByteArray key = entry.getFirst();
Versioned<byte[]> value = entry.getSecond();
startNs = System.nanoTime();
try {
/**
* TODO This also needs to be fixed to
* use the atomic multi version puts
*/
storageEngine.put(key, value, null);
} catch(ObsoleteVersionException e) {
// log and ignore
logger.debug("Fetch and update threw Obsolete version exception. Ignoring");
} finally {
if(streamingStats != null) {
streamingStats.reportStreamingPut(Operation.UPDATE_ENTRIES);
streamingStats.reportStorageTime(Operation.UPDATE_ENTRIES,
Utils.elapsedTimeNs(startNs,
System.nanoTime()));
}
}
long totalTime = (System.currentTimeMillis() - startTime) / 1000;
throttler.maybeThrottle(key.length() + valueSize(value));
if((numTuples % 100000) == 0 && numTuples > 0) {
logger.info(numTuples + " entries copied from node "
+ nodeId + " for store '" + storeName + "'c");
updateStatus(numTuples + " entries copied from node "
+ nodeId + " for store '" + storeName