Skip to content

Commit

Permalink
Merge branch 'master' into refine_test_framework
Browse files Browse the repository at this point in the history
  • Loading branch information
ywqzzy authored Dec 22, 2022
2 parents 30f4d00 + b99541f commit f184ae7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 34 deletions.
17 changes: 12 additions & 5 deletions dbms/src/Storages/DeltaMerge/DeltaMergeStore_Ingest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,18 @@ void DeltaMergeStore::ingestFiles(
}

// Check whether all external files are contained by the range.
for (const auto & ext_file : external_files)
{
RUNTIME_CHECK(compare(range.getStart(), ext_file.range.getStart()) <= 0);
RUNTIME_CHECK(compare(range.getEnd(), ext_file.range.getEnd()) >= 0);
}
// Currently this check is disabled, see https://github.com/pingcap/tiflash/pull/6519
// for (const auto & ext_file : external_files)
// {
// RUNTIME_CHECK(
// compare(range.getStart(), ext_file.range.getStart()) <= 0,
// range.toDebugString(),
// ext_file.range.toDebugString());
// RUNTIME_CHECK(
// compare(range.getEnd(), ext_file.range.getEnd()) >= 0,
// range.toDebugString(),
// ext_file.range.toDebugString());
// }
}

EventRecorder write_block_recorder(ProfileEvents::DMWriteFile, ProfileEvents::DMWriteFileNS);
Expand Down
58 changes: 29 additions & 29 deletions dbms/src/Storages/DeltaMerge/tests/gtest_dm_ingest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,35 +78,35 @@ try
}
CATCH

TEST_P(StoreIngestTest, RangeSmallerThanData)
try
{
ASSERT_EQ(0, getRowsN());
auto block1 = fillBlock({.range = {0, 100}});
ASSERT_THROW({
ingestFiles({.range = {20, 40}, .blocks = {block1}, .clear = false});
},
DB::Exception);
}
CATCH

TEST_P(StoreIngestTest, RangeLargerThanData)
try
{
ASSERT_EQ(0, getRowsN());
auto block1 = fillBlock({.range = {0, 100}});
ingestFiles({.range = {-100, 110}, .blocks = {block1}, .clear = false});
ASSERT_TRUE(isFilled(0, 100));
ASSERT_EQ(100, getRowsN());

fill(-500, 500);
ingestFiles({.range = {-100, 110}, .blocks = {block1}, .clear = true});
ASSERT_TRUE(isFilled(-500, -100));
ASSERT_TRUE(isFilled(0, 100));
ASSERT_TRUE(isFilled(110, 500));
ASSERT_EQ(890, getRowsN());
}
CATCH
//TEST_P(StoreIngestTest, RangeSmallerThanData)
//try
//{
// ASSERT_EQ(0, getRowsN());
// auto block1 = fillBlock({.range = {0, 100}});
// ASSERT_THROW({
// ingestFiles({.range = {20, 40}, .blocks = {block1}, .clear = false});
// },
// DB::Exception);
//}
//CATCH
//
//TEST_P(StoreIngestTest, RangeLargerThanData)
//try
//{
// ASSERT_EQ(0, getRowsN());
// auto block1 = fillBlock({.range = {0, 100}});
// ingestFiles({.range = {-100, 110}, .blocks = {block1}, .clear = false});
// ASSERT_TRUE(isFilled(0, 100));
// ASSERT_EQ(100, getRowsN());
//
// fill(-500, 500);
// ingestFiles({.range = {-100, 110}, .blocks = {block1}, .clear = true});
// ASSERT_TRUE(isFilled(-500, -100));
// ASSERT_TRUE(isFilled(0, 100));
// ASSERT_TRUE(isFilled(110, 500));
// ASSERT_EQ(890, getRowsN());
//}
//CATCH

TEST_P(StoreIngestTest, OverlappedFiles)
try
Expand Down

0 comments on commit f184ae7

Please sign in to comment.