Make a split_threshold stub
This commit is contained in:
parent
f2c4376a44
commit
ebdf7344d8
@ -1,4 +1,4 @@
|
||||
// Copyright 2022 Memgraph Ltd.
|
||||
// Copyright 2023 Memgraph Ltd.
|
||||
//
|
||||
// Use of this software is governed by the Business Source License
|
||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||
@ -128,6 +128,9 @@ struct LabelSpace {
|
||||
// Maps between the smallest primary key stored in the shard and the shard
|
||||
std::map<PrimaryKey, ShardMetadata> shards;
|
||||
size_t replication_factor;
|
||||
// TODO
|
||||
// Stub value. Should be replaced once the shard-split logic is in place.
|
||||
int64_t split_threshold{10000};
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &in, const LabelSpace &label_space) {
|
||||
using utils::print_helpers::operator<<;
|
||||
|
@ -419,15 +419,28 @@ class RequestRouter : public RequestRouterInterface {
|
||||
return shards_map_.GetLabelId(name);
|
||||
}
|
||||
|
||||
int64_t GetApproximateVertexCount() const override { return 1; }
|
||||
int64_t GetApproximateVertexCount() const override {
|
||||
int64_t vertex_count = 0;
|
||||
|
||||
for (const auto &label_space : shards_map_.label_spaces) {
|
||||
const auto split_threshold = label_space.second.split_threshold;
|
||||
const auto shard_count = static_cast<int64_t>(label_space.second.shards.size());
|
||||
vertex_count += split_threshold * shard_count;
|
||||
}
|
||||
|
||||
return vertex_count;
|
||||
}
|
||||
|
||||
int64_t GetApproximateVertexCount(storage::v3::LabelId label) const override {
|
||||
const auto &label_space = shards_map_.label_spaces.at(label);
|
||||
return 1;
|
||||
return label_space.split_threshold * label_space.shards.size();
|
||||
}
|
||||
|
||||
int64_t GetApproximateVertexCount(storage::v3::LabelId label, storage::v3::PropertyId property) const override {
|
||||
return 1;
|
||||
int64_t GetApproximateVertexCount(storage::v3::LabelId label, storage::v3::PropertyId /*property*/) const override {
|
||||
// TODO
|
||||
// Once we have reliable metadata to approximate the
|
||||
// vertex count -based on properties- rework this function.
|
||||
return GetApproximateVertexCount(label);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user