LOG.debug("Processing " + next);
// We need to get the EE handle for the partition that this txn
// needs to have read in some blocks from disk
PartitionExecutor executor = hstore_site.getPartitionExecutor(next.partition);
ExecutionEngine ee = executor.getExecutionEngine();
// boolean merge_needed = true;
// We can now tell it to read in the blocks that this txn needs
// Note that we are doing this without checking whether another txn is already
// running. That's because reading in unevicted tuples is a two-stage process.
// First we read the blocks from disk in a standalone buffer. Then once we
// know that all of the tuples that we need are there, we will requeue the txn,
// which knows that it needs to tell the EE to merge in the results from this buffer
// before it executes anything.
//
// TODO: We may want to create a HStoreConf option that allows to dispatch this
// request asynchronously per partition. For now we're just going to
// block the AntiCacheManager until each of the requests are finished
if (hstore_conf.site.anticache_profiling)
this.profilers[next.partition].retrieval_time.start();
try {
if (debug.val)
LOG.debug(String.format("Asking EE to read in evicted blocks from table %s on partition %d: %s",
next.catalog_tbl.getName(), next.partition, Arrays.toString(next.block_ids)));
ee.antiCacheReadBlocks(next.catalog_tbl, next.block_ids, next.tuple_offsets);
if (debug.val)
LOG.debug(String.format("Finished reading blocks from partition %d",
next.partition));
} catch (SerializableException ex) {
LOG.info("Caught unexpected SerializableException while reading anti-cache block.", ex);
// merge_needed = false;
} finally {
if (hstore_conf.site.anticache_profiling)
this.profilers[next.partition].retrieval_time.stopIfStarted();
}
if (debug.val) LOG.debug("anticache block removal done");
// Long oldTxnId = next.ts.getTransactionId();
// Now go ahead and requeue our transaction
// if(merge_needed)
next.ts.setAntiCacheMergeTable(next.catalog_tbl);
if (next.ts instanceof LocalTransaction){
// HACK HACK HACK HACK HACK HACK
// We need to get a new txnId for ourselves, since the one that we
// were given before is now probably too far in the past
if(next.partition != next.ts.getBasePartition()){
ee.antiCacheMergeBlocks(next.catalog_tbl);
}
this.hstore_site.getTransactionInitializer().resetTransactionId(next.ts, next.partition);
if (debug.val) LOG.debug("restartin on local");
this.hstore_site.transactionInit(next.ts);
} else {
ee.antiCacheMergeBlocks(next.catalog_tbl);
RemoteTransaction ts = (RemoteTransaction) next.ts;
RpcCallback<UnevictDataResponse> callback = ts.getUnevictCallback();
UnevictDataResponse.Builder builder = UnevictDataResponse.newBuilder()
.setSenderSite(this.hstore_site.getSiteId())
.setTransactionId(ts.getNewTransactionId())