Skip to content

Commit

Permalink
fix clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan committed Dec 24, 2024
1 parent 227a2c4 commit a4ac805
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/replica/replica_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2317,10 +2317,9 @@ bool replica_stub::validate_replica_dir(const std::string &dir,
return false;
}

// When the online partition split function aborted, the garbage partitions are with pidx in
// the range of [ai.partition_count, 2 * ai.partition_count), which means the partitions with
// pidx >= ai.partition_count are garbage partitions.
if (ai.partition_count <= pid.get_partition_index()) {
if (pid.get_partition_index() >= ai.partition_count) {
// Once the online partition split aborted, the partitions within the range of
// [ai.partition_count, 2 * ai.partition_count) would become garbage.
hint_message = fmt::format(
"partition[{}], count={}, this replica may be partition split garbage partition, "
"ignore it",
Expand Down
11 changes: 6 additions & 5 deletions src/replica/test/load_replicas_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ load_replicas_case generate_load_replicas_case(const std::vector<size_t> &disk_r
dirs_by_tag.emplace(fmt::format("data{}", disk_index), fmt::format("disk{}", disk_index));
}

static const int32_t kNumBitsPartitions = 3;
static const int32_t kNumPartitions = 1 << kNumBitsPartitions;
static const uint32_t kNumBitsPartitions = 3;
static const uint32_t kNumPartitions = 1U << kNumBitsPartitions;

int32_t app_id = 1;
int32_t partition_id = 0;
uint32_t app_id = 1;
uint32_t partition_id = 0;

std::map<std::string, std::vector<gpid>> replicas_by_tag;

Expand All @@ -281,7 +281,8 @@ load_replicas_case generate_load_replicas_case(const std::vector<size_t> &disk_r
}

// Generate a replica with current app id and partition index.
replica_list.emplace_back(app_id, partition_id);
replica_list.emplace_back(static_cast<int32_t>(app_id),
static_cast<int32_t>(partition_id));

// Once next partition index is found 0, increment app id to turn to next table.
app_id += ((partition_id + 1) & kNumPartitions) >> kNumBitsPartitions;
Expand Down

0 comments on commit a4ac805

Please sign in to comment.