@@ -1258,75 +1258,6 @@ public long getSmallestReadPoint(HStore store) {
1258
1258
}
1259
1259
}
1260
1260
1261
- @ Test
1262
- public void testPreventLoopRead () throws Exception {
1263
- init (this .name .getMethodName ());
1264
- Configuration conf = HBaseConfiguration .create ();
1265
- // use small heart beat cells
1266
- conf .setLong (StoreScanner .HBASE_CELLS_SCANNED_PER_HEARTBEAT_CHECK , 2 );
1267
- IncrementingEnvironmentEdge edge = new IncrementingEnvironmentEdge ();
1268
- EnvironmentEdgeManager .injectEdge (edge );
1269
- byte [] r0 = Bytes .toBytes ("row0" );
1270
- byte [] value0 = Bytes .toBytes ("value0" );
1271
- byte [] value1 = Bytes .toBytes ("value1" );
1272
- MemStoreSizing memStoreSizing = new NonThreadSafeMemStoreSizing ();
1273
- long ts = EnvironmentEdgeManager .currentTime ();
1274
- long seqId = 100 ;
1275
- init (name .getMethodName (), conf , TableDescriptorBuilder .newBuilder (TableName .valueOf (table )),
1276
- ColumnFamilyDescriptorBuilder .newBuilder (family ).setTimeToLive (10 ).build (),
1277
- new MyStoreHook () {
1278
- @ Override
1279
- public long getSmallestReadPoint (HStore store ) {
1280
- return seqId + 3 ;
1281
- }
1282
- });
1283
- // The cells having the value0 will be expired
1284
- store .add (createCell (r0 , qf1 , ts , seqId , value0 ), memStoreSizing );
1285
- store .add (createCell (r0 , qf2 , ts , seqId , value0 ), memStoreSizing );
1286
- store .add (createCell (r0 , qf3 , ts , seqId , value0 ), memStoreSizing );
1287
- store .add (createCell (r0 , qf4 , ts + 10000 + 1 , seqId , value1 ), memStoreSizing );
1288
- store .add (createCell (r0 , qf5 , ts , seqId , value0 ), memStoreSizing );
1289
- store .add (createCell (r0 , qf6 , ts + 10000 + 1 , seqId , value1 ), memStoreSizing );
1290
-
1291
- List <Cell > myList = new ArrayList <>();
1292
- Scan scan = new Scan ().withStartRow (r0 );
1293
- ScannerContext .Builder contextBuilder = ScannerContext .newBuilder (false );
1294
- // test normal scan, should return all the cells
1295
- ScannerContext scannerContext = contextBuilder .build ();
1296
- try (InternalScanner scanner = (InternalScanner ) store .getScanner (scan , null , seqId + 3 )) {
1297
- scanner .next (myList , scannerContext );
1298
- assertEquals (6 , myList .size ());
1299
- }
1300
-
1301
- // test skip two ttl cells and return with empty results, default prevent loop skip is on
1302
- edge .incrementTime (10 * 1000 );
1303
- scannerContext = contextBuilder .build ();
1304
- myList .clear ();
1305
- try (InternalScanner scanner = (InternalScanner ) store .getScanner (scan , null , seqId + 3 )) {
1306
- // r0
1307
- scanner .next (myList , scannerContext );
1308
- assertEquals (0 , myList .size ());
1309
- }
1310
-
1311
- // should scan all non-ttl expired cells by iterative next
1312
- int resultCells = 0 ;
1313
- try (InternalScanner scanner = (InternalScanner ) store .getScanner (scan , null , seqId + 3 )) {
1314
- boolean hasMore = true ;
1315
- while (hasMore ) {
1316
- myList .clear ();
1317
- hasMore = scanner .next (myList , scannerContext );
1318
- assertTrue (myList .size () < 6 );
1319
- resultCells += myList .size ();
1320
- }
1321
- for (Cell c : myList ) {
1322
- byte [] actualValue = CellUtil .cloneValue (c );
1323
- assertTrue ("expected:" + Bytes .toStringBinary (value1 ) + ", actual:"
1324
- + Bytes .toStringBinary (actualValue ), Bytes .equals (actualValue , value1 ));
1325
- }
1326
- }
1327
- assertEquals (2 , resultCells );
1328
- }
1329
-
1330
1261
@ Test
1331
1262
public void testCreateScannerAndSnapshotConcurrently () throws IOException , InterruptedException {
1332
1263
Configuration conf = HBaseConfiguration .create ();
0 commit comments