Skip to content

Commit 2f9f3a1

Browse files
committed
[io] add reproducer of #19245 as test
1 parent c11dbc2 commit 2f9f3a1

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

io/io/test/TFileTests.cxx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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

456483
TEST(TFile, KeySizeLimit)

0 commit comments

Comments
 (0)