@@ -3539,9 +3539,11 @@ TEST_P(FSBufferPrefetchTest, FSBufferPrefetchStatsInternals) {
3539
3539
ASSERT_TRUE (fpb.TryReadFromCache (IOOptions (), r.get (), 8192 /* offset */ ,
3540
3540
8192 /* n */ , &result, &s, for_compaction));
3541
3541
ASSERT_EQ (s, Status::OK ());
3542
- ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_HITS), 0 );
3543
- ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_BYTES_USEFUL),
3544
- 4096 ); // 8192-12288
3542
+ if (!for_compaction) {
3543
+ ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_HITS), 0 );
3544
+ ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_BYTES_USEFUL),
3545
+ 4096 ); // 8192-12288
3546
+ }
3545
3547
3546
3548
ASSERT_EQ (strncmp (result.data (), content.substr (8192 , 8192 ).c_str (), 8192 ),
3547
3549
0 );
@@ -3577,9 +3579,11 @@ TEST_P(FSBufferPrefetchTest, FSBufferPrefetchStatsInternals) {
3577
3579
4096 /* n */ , &result, &s, for_compaction));
3578
3580
ASSERT_EQ (s, Status::OK ());
3579
3581
3580
- ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_HITS), 1 );
3581
- ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_BYTES_USEFUL),
3582
- 4096 ); // 12288-16384
3582
+ if (!for_compaction) {
3583
+ ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_HITS), 1 );
3584
+ ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_BYTES_USEFUL),
3585
+ 4096 ); // 12288-16384
3586
+ }
3583
3587
3584
3588
ASSERT_EQ (strncmp (result.data (), content.substr (12288 , 4096 ).c_str (), 4096 ),
3585
3589
0 );
@@ -3611,10 +3615,12 @@ TEST_P(FSBufferPrefetchTest, FSBufferPrefetchStatsInternals) {
3611
3615
10000 /* n */ , &result, &s, for_compaction));
3612
3616
ASSERT_EQ (s, Status::OK ());
3613
3617
3614
- ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_HITS), 0 );
3615
- ASSERT_EQ (
3616
- stats->getAndResetTickerCount (PREFETCH_BYTES_USEFUL),
3617
- /* 24576(end offset of the buffer) - 16000(requested offset) =*/ 8576 );
3618
+ if (!for_compaction) {
3619
+ ASSERT_EQ (stats->getAndResetTickerCount (PREFETCH_HITS), 0 );
3620
+ ASSERT_EQ (
3621
+ stats->getAndResetTickerCount (PREFETCH_BYTES_USEFUL),
3622
+ /* 24576(end offset of the buffer) - 16000(requested offset) =*/ 8576 );
3623
+ }
3618
3624
3619
3625
ASSERT_EQ (strncmp (result.data (), content.substr (16000 , 10000 ).c_str (), 10000 ),
3620
3626
0 );
0 commit comments