@@ -256,6 +256,7 @@ bool NestLoopIndexExecutor::p_execute(const NValueArray ¶ms, ReadWriteTracke
256256 #ifdef ANTICACHE
257257 AntiCacheEvictionManager* eviction_manager = executor_context->getAntiCacheEvictionManager ();
258258 bool hasEvictedTable = (eviction_manager != NULL && inner_table->getEvictedTable () != NULL );
259+ bool blockingMergeSuccessful = false ;
259260 #endif
260261
261262 //
@@ -284,7 +285,7 @@ bool NestLoopIndexExecutor::p_execute(const NValueArray ¶ms, ReadWriteTracke
284285 setNValue (ctr,
285286 inline_node->getSearchKeyExpressions ()[ctr]->eval (&outer_tuple, NULL ));
286287 }
287- VOLT_TRACE (" Searching %s" , index_values.debug (" " ).c_str ());
288+ VOLT_TRACE (" Searching %s, isEvicted: %d " , index_values.debug (" " ).c_str (), outer_tuple. isEvicted ());
288289
289290 //
290291 // In order to apply the Expression trees in our join, we need
@@ -326,14 +327,20 @@ bool NestLoopIndexExecutor::p_execute(const NValueArray ¶ms, ReadWriteTracke
326327 (m_lookupType != INDEX_LOOKUP_TYPE_EQ &&
327328 !(inner_tuple = index->nextValue ()).isNullTuple ()))
328329 {
330+ VOLT_TRACE (" Searching inner!" );
329331 match = true ;
330332 inner_table->updateTupleAccessCount ();
331333
332334 // Anti-Cache Evicted Tuple Tracking
333335 #ifdef ANTICACHE
336+ #ifdef ANTICACHE_COUNTER
337+ inner_tuple.setTempMergedFalse ();
338+ #endif
339+ blockingMergeSuccessful = false ;
334340 // We are pointing to an entry for an evicted tuple
341+ VOLT_TRACE (" If condition before check: %d %d!" , hasEvictedTable, inner_tuple.isEvicted ());
335342 if (hasEvictedTable && inner_tuple.isEvicted ()) {
336- VOLT_INFO (" Tuple in NestLoopIndexScan is evicted %s" , inner_catalogTable->name ().c_str ());
343+ VOLT_TRACE (" Tuple in NestLoopIndexScan is evicted %s" , inner_catalogTable->name ().c_str ());
337344
338345 // Tell the EvictionManager's internal tracker that we touched this mofo
339346 eviction_manager->recordEvictedAccess (inner_catalogTable, &inner_tuple);
@@ -347,13 +354,42 @@ bool NestLoopIndexExecutor::p_execute(const NValueArray ¶ms, ReadWriteTracke
347354 // TODO: possibly an alternate codepath that simply looks through all the tuples
348355 // for evicted tuples and then see if we have any non-blockable accesses
349356 if (eviction_manager->hasBlockableEvictedAccesses ()) {
350- // VOLT_ERROR("From nestloop!");
351- eviction_manager->blockingMerge ();
357+ // VOLT_ERROR("From sync!");
358+ #ifdef ANTICACHE_COUNTER
359+ if (eviction_manager->m_update_access )
360+ #endif
361+ blockingMergeSuccessful = eviction_manager->blockingMerge ();
352362 } else {
363+ // VOLT_ERROR("From abrt!");
364+ blockingMergeSuccessful = false ;
353365 // eviction_manager->blockingMerge();
354366 continue ;
355367 }
356368 }
369+
370+ if (blockingMergeSuccessful) {
371+ // printf("Scan from merge.\n");
372+ VOLT_TRACE (" grabbing tuple again" );
373+ if (m_lookupType == INDEX_LOOKUP_TYPE_EQ) {
374+ index->moveToKey (&index_values);
375+ inner_tuple = index->nextValueAtKey ();
376+ } else {
377+ if (m_lookupType == INDEX_LOOKUP_TYPE_GT)
378+ index->moveToGreaterThanKey (&index_values);
379+ else
380+ index->moveToKeyOrGreater (&index_values);
381+ inner_tuple = index->nextValue ();
382+ }
383+
384+ #ifdef ANTICACHE_COUNTER
385+ inner_tuple.setTempMergedFalse ();
386+ #endif
387+
388+ if (inner_tuple.isNullTuple ()) {
389+ VOLT_INFO (" We've got a null tuple for some reason" );
390+ }
391+ VOLT_TRACE (" Merged Tuple: %s" , m_tuple.debug (m_targetTable->name ()).c_str ());
392+ }
357393 #endif
358394
359395 VOLT_TRACE (" inner_tuple:%s" ,
@@ -395,6 +431,12 @@ bool NestLoopIndexExecutor::p_execute(const NValueArray ¶ms, ReadWriteTracke
395431 }
396432 #endif
397433 }
434+ #if defined(ANTICACHE) && defined(ANTICACHE_COUNTER)
435+ if (inner_tuple.isTempMerged ()) {
436+ // printf("isTempMerged?\n");
437+ delete[] inner_tuple.address ();
438+ }
439+ #endif
398440 } // WHILE
399441
400442 //
0 commit comments