Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
Signed-off-by: JaySon-Huang <[email protected]>
  • Loading branch information
JaySon-Huang committed Jun 1, 2022
1 parent 3d288d1 commit 229ac0f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
4 changes: 1 addition & 3 deletions dbms/src/Common/FailPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ std::unordered_map<String, std::shared_ptr<FailPointChannel>> FailPointHelper::f
M(force_remote_read_for_batch_cop) \
M(force_context_path) \
M(force_slow_page_storage_snapshot_release) \
M(force_change_all_blobs_to_read_only) \
M(force_enable_dt_relevant_place) \
M(force_disable_dt_relevant_place)
M(force_change_all_blobs_to_read_only)

#define APPLY_FOR_FAILPOINTS_ONCE_WITH_CHANNEL(M) \
M(pause_with_alter_locks_acquired) \
Expand Down
8 changes: 0 additions & 8 deletions dbms/src/Storages/DeltaMerge/Segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ extern const Metric DT_SnapshotOfPlaceIndex;

namespace DB
{
namespace FailPoints
{
extern const char force_enable_dt_relevant_place[];
extern const char force_disable_dt_relevant_place[];
} // namespace FailPoints
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
Expand Down Expand Up @@ -1486,9 +1481,6 @@ std::pair<DeltaIndexPtr, bool> Segment::ensurePlace(const DMContext & dm_context
bool relevant_place = dm_context.enable_relevant_place;
bool skippable_place = dm_context.enable_skippable_place;

fiu_do_on(FailPoints::force_enable_dt_relevant_place, relevant_place = true);
fiu_do_on(FailPoints::force_disable_dt_relevant_place, relevant_place = false);

// Note that, when enable_relevant_place is false , we cannot use the range of this segment.
// Because some block / delete ranges could contain some data / range that are not belong to current segment.
// If we use the range of this segment as relevant_range, fully_indexed will always be false in those cases.
Expand Down
26 changes: 20 additions & 6 deletions dbms/src/Storages/DeltaMerge/tests/gtest_dm_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <ctime>
#include <memory>

#include "common/logger_useful.h"

namespace CurrentMetrics
{
extern const Metric DT_SnapshotOfRead;
Expand All @@ -40,11 +42,6 @@ extern const Metric DT_SnapshotOfPlaceIndex;

namespace DB
{
namespace FailPoints
{
extern const char force_enable_dt_relevant_place[];
extern const char force_disable_dt_relevant_place[];
} // namespace FailPoints
namespace DM
{
extern DMFilePtr writeIntoNewDMFile(DMContext & dm_context, //
Expand Down Expand Up @@ -440,7 +437,8 @@ TEST_P(SegmentDeletionRelevantPlaceTest, ShareDelteRangeIndex)
try
{
Settings my_settings;
my_settings.dt_enable_relevant_place = GetParam(); // set for test
const auto enable_relevant_place = GetParam();
my_settings.dt_enable_relevant_place = enable_relevant_place; // set for test
this->reload({}, std::move(my_settings));

const size_t num_rows_write = 300;
Expand Down Expand Up @@ -473,7 +471,23 @@ try

// The first call of get_rows below will place the DeleteRange into delta index.
auto rows1 = get_rows(RowKeyRange::fromHandleRange(HandleRange(0, 150)));
{
auto delta = segment->getDelta();
auto placed_rows = delta->getPlacedDeltaRows();
auto placed_deleted = delta->getPlacedDeltaDeletes();
ASSERT_EQ(placed_rows, num_rows_write);
ASSERT_EQ(placed_deleted, enable_relevant_place ? 0 : 1);
LOG_FMT_INFO(&Poco::Logger::get("fff"), "fffffff {} {}", placed_rows, placed_deleted);
}
auto rows2 = get_rows(RowKeyRange::fromHandleRange(HandleRange(150, 300)));
{
auto delta = segment->getDelta();
auto placed_rows = delta->getPlacedDeltaRows();
auto placed_deleted = delta->getPlacedDeltaDeletes();
ASSERT_EQ(placed_rows, num_rows_write);
ASSERT_EQ(placed_deleted, enable_relevant_place ? 0 : 1);
LOG_FMT_INFO(&Poco::Logger::get("fff"), "fffffff {} {}", placed_rows, placed_deleted);
}

ASSERT_EQ(rows1, 100);
ASSERT_EQ(rows2, 100);
Expand Down

0 comments on commit 229ac0f

Please sign in to comment.