File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -451,6 +451,33 @@ TEST(TFile, DeleteKey)
451451 }
452452 // Same as before the recovery
453453 EXPECT_EQ (4 , fnCountGaps (fileGuard.GetPath ()));
454+
455+ // Write in large gap (between 1GB and 2GB), reproducer of issue https://github.com/root-project/root/issues/19245
456+ f = std::unique_ptr<TFile>(TFile::Open (fileGuard.GetPath ().c_str (), " RECREATE" ));
457+ f->SetCompressionSettings (0 );
458+
459+ v.resize (1000 * 1000 * 1000 - 100 , ' x' ); // almost 1GB
460+ f->WriteObject (&v, " big1" );
461+ f->WriteObject (&v, " big2" );
462+ v.resize (1024 * 1024 , ' x' );
463+ f->WriteObject (&v, " small1" );
464+ f->Write ();
465+ f->Close ();
466+
467+ f = std::unique_ptr<TFile>(TFile::Open (fileGuard.GetPath ().c_str (), " UPDATE" ));
468+ // Creates a combined gap close to 2GB
469+ f->Delete (" big1;*" );
470+ f->Delete (" big2;*" );
471+ f->Write ();
472+ f->Close ();
473+
474+ f = std::unique_ptr<TFile>(TFile::Open (fileGuard.GetPath ().c_str (), " UPDATE" ));
475+ f->WriteObject (&v, " small2" );
476+ f->Write ();
477+ f->Close ();
478+
479+ f = std::unique_ptr<TFile>(TFile::Open (fileGuard.GetPath ().c_str (), " UPDATE" ));
480+ EXPECT_FALSE (f->TestBit (TFile::kRecovered ));
454481}
455482
456483TEST (TFile, KeySizeLimit)
You can’t perform that action at this time.
0 commit comments