@@ -493,8 +493,8 @@ TEST_F(PureDiskTSTest, Dump) {
493493TEST_P (LatentCoolingTSTest, SimpleHash) {
494494 absl::FlagSaver saver;
495495 absl::SetFlag (&FLAGS_tiered_experimental_hash_support, true );
496- // For now, never upload as its not implemented yet
497- absl::SetFlag (&FLAGS_tiered_upload_threshold, 0.0 );
496+ absl::SetFlag (&FLAGS_tiered_upload_threshold,
497+ 0.0 ); // For now, never upload as its not implemented yet
498498 UpdateFromFlags ();
499499
500500 const size_t kNUM = 100 ;
@@ -516,11 +516,9 @@ TEST_P(LatentCoolingTSTest, SimpleHash) {
516516 // Wait for all to be stashed or in end up in bins
517517 ExpectConditionWithinTimeout ([=] {
518518 auto metrics = GetMetrics ();
519- VLOG (0 ) << metrics.tiered_stats .total_stashes << " "
520- << metrics.tiered_stats .small_bins_entries_cnt ;
521- return metrics.tiered_stats .total_stashes +
522- metrics.tiered_stats .small_bins_filling_entries_cnt ==
523- kNUM ;
519+ size_t sum =
520+ metrics.tiered_stats .total_stashes + metrics.tiered_stats .small_bins_filling_entries_cnt ;
521+ return sum == kNUM ;
524522 });
525523
526524 // Verify correctness
@@ -533,20 +531,36 @@ TEST_P(LatentCoolingTSTest, SimpleHash) {
533531 EXPECT_EQ (resp, v);
534532 }
535533
536- // Wait for all offloads again
537- ExpectConditionWithinTimeout ([=] {
534+ // Start offloading
535+ SetFlag (&FLAGS_tiered_offload_threshold, 1.0 );
536+ UpdateFromFlags ();
537+ auto wait_offloaded = [=] {
538538 auto metrics = GetMetrics ();
539- return metrics.db_stats [0 ].tiered_entries +
540- metrics.tiered_stats .small_bins_filling_entries_cnt ==
541- kNUM ;
542- });
539+ size_t sum =
540+ metrics.db_stats [0 ].tiered_entries + metrics.tiered_stats .small_bins_filling_entries_cnt ;
541+ return sum == kNUM ;
542+ };
543+
544+ // Wait for all offloads again
545+ ExpectConditionWithinTimeout (wait_offloaded);
543546
544547 // HDEL
545548 for (size_t i = 0 ; i < kNUM ; i++) {
546549 string key = absl::StrCat (" k" , i);
547- EXPECT_THAT (Run ({" DEL " , key, string{1 , ' c' }}), IntArg (1 ));
550+ EXPECT_THAT (Run ({" HDEL " , key, string{1 , ' c' }}), IntArg (1 ));
548551 EXPECT_THAT (Run ({" HLEN" , key}), IntArg (25 ));
549552 }
553+
554+ // Wait for all offloads again
555+ ExpectConditionWithinTimeout (wait_offloaded);
556+
557+ // HSET new field
558+ for (size_t i = 0 ; i < kNUM ; i++) {
559+ string key = absl::StrCat (" k" , i);
560+ EXPECT_THAT (Run ({" HSET" , key, string{1 , ' c' }, " Some new value" }), IntArg (1 ));
561+ EXPECT_THAT (Run ({" HLEN" , key}), IntArg (26 ));
562+ EXPECT_EQ (Run ({" HGET" , key, string{1 , ' c' }}), " Some new value" );
563+ }
550564}
551565
552566} // namespace dfly
0 commit comments