Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some fail cases when enable TASN #5086

Merged
merged 6 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions dbms/src/Flash/Management/tests/gtest_manual_compact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <Common/FailPoint.h>
#include <Flash/Management/ManualCompact.h>
#include <Poco/Logger.h>
#include <Storages/ColumnsDescription.h>
#include <Storages/DeltaMerge/RowKeyRange.h>
#include <Storages/DeltaMerge/tests/DMTestEnv.h>
Expand Down Expand Up @@ -48,7 +47,6 @@ class BasicManualCompactTest

BasicManualCompactTest()
{
log = &Poco::Logger::get(DB::base::TiFlashStorageTestBasic::getCurrentFullTestName());
pk_type = GetParam();
}

Expand All @@ -63,7 +61,7 @@ class BasicManualCompactTest
setupStorage();

// In tests let's only compact one segment.
db_context->setSetting("manual_compact_more_until_ms", UInt64(0));
db_context->setSetting("manual_compact_more_until_ms", Field(UInt64(0)));

// Split into 4 segments, and prepare some delta data for first 3 segments.
helper = std::make_unique<DM::tests::MultiSegmentTestUtil>(*db_context);
Expand Down Expand Up @@ -116,8 +114,6 @@ class BasicManualCompactTest
std::unique_ptr<DB::Management::ManualCompactManager> manager;

DM::tests::DMTestEnv::PkType pk_type;

[[maybe_unused]] Poco::Logger * log;
};


Expand Down Expand Up @@ -315,7 +311,7 @@ CATCH
TEST_P(BasicManualCompactTest, CompactMultiple)
try
{
db_context->setSetting("manual_compact_more_until_ms", UInt64(60 * 1000)); // Hope it's long enough!
db_context->setSetting("manual_compact_more_until_ms", Field(UInt64(60 * 1000))); // Hope it's long enough!

auto request = ::kvrpcpb::CompactRequest();
request.set_physical_table_id(TABLE_ID);
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Storages/DeltaMerge/StoragePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ PageId StoragePool::newDataPageIdForDTFile(StableDiskDelegator & delegator, cons

auto existed_path = delegator.getDTFilePath(dtfile_id, /*throw_on_not_exist=*/false);
fiu_do_on(FailPoints::force_set_dtfile_exist_when_acquire_id, {
static size_t fail_point_called = 0;
if (existed_path.empty() && fail_point_called % 10 == 0)
static std::atomic<UInt64> fail_point_called(0);
if (existed_path.empty() && fail_point_called.load() % 10 == 0)
{
existed_path = "<mock for existed path>";
}
Expand Down
3 changes: 3 additions & 0 deletions dbms/src/Storages/DeltaMerge/tests/MultiSegmentTestUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class MultiSegmentTestUtil : private boost::noncopyable
// Check there is only one segment
ASSERT_EQ(store->segments.size(), 1);
const auto & [_key, seg] = *store->segments.begin();
(void)_key;
ASSERT_EQ(seg->getDelta()->getRows(), n_avg_rows_per_segment * 4);
ASSERT_EQ(seg->getStable()->getRows(), 0);

Expand All @@ -108,6 +109,7 @@ class MultiSegmentTestUtil : private boost::noncopyable
auto segment_idx = 0;
for (auto & [_key, seg] : store->segments)
{
(void)_key;
LOG_FMT_INFO(log, "Segment #{}: Range = {}", segment_idx, seg->getRowKeyRange().toDebugString());
ASSERT_EQ(seg->getDelta()->getRows(), 0);
ASSERT_GT(seg->getStable()->getRows(), 0); // We don't check the exact rows of each segment.
Expand Down Expand Up @@ -147,6 +149,7 @@ class MultiSegmentTestUtil : private boost::noncopyable
auto segment_idx = 0;
for (auto & [_key, seg] : store->segments)
{
(void)_key;
ASSERT_EQ(seg->getDelta()->getRows(), expected_delta_rows[segment_idx]) << "Assert failed for segment #" << segment_idx;
ASSERT_EQ(seg->getStable()->getRows(), expected_stable_rows[segment_idx]) << "Assert failed for segment #" << segment_idx;
segment_idx++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3564,7 +3564,6 @@ class DeltaMergeStoreMergeDeltaBySegmentTest
public:
DeltaMergeStoreMergeDeltaBySegmentTest()
{
log = &Poco::Logger::get(DB::base::TiFlashStorageTestBasic::getCurrentFullTestName());
std::tie(ps_ver, pk_type) = GetParam();
}

Expand Down Expand Up @@ -3607,8 +3606,6 @@ class DeltaMergeStoreMergeDeltaBySegmentTest

UInt64 ps_ver;
DMTestEnv::PkType pk_type;

[[maybe_unused]] Poco::Logger * log;
};

INSTANTIATE_TEST_CASE_P(
Expand Down
3 changes: 3 additions & 0 deletions dbms/src/Storages/Page/V3/tests/gtest_blob_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,23 @@ try
stats.restoreByEntry(PageEntryV3{
.file_id = file_id1,
.size = 128,
.padded_size = 0,
.tag = 0,
.offset = 1024,
.checksum = 0x4567,
});
stats.restoreByEntry(PageEntryV3{
.file_id = file_id1,
.size = 512,
.padded_size = 0,
.tag = 0,
.offset = 2048,
.checksum = 0x4567,
});
stats.restoreByEntry(PageEntryV3{
.file_id = file_id2,
.size = 512,
.padded_size = 0,
.tag = 0,
.offset = 2048,
.checksum = 0x4567,
Expand Down
Loading