#include <seastar/core/sharded.hh>
#include "os/Transaction.h"
+#include "crimson/common/config_proxy.h"
#include "crimson/common/local_shared_foreign_ptr.h"
#include "crimson/common/smp_helpers.h"
#include "crimson/common/smp_helpers.h"
constexpr bool is_seastar_future = seastar::is_future<raw_return_type>::value && !is_errorator;
constexpr bool is_plain = !is_errorator && !is_seastar_future;
const auto original_core = seastar::this_shard_id();
+ if(crimson::common::get_conf<bool>("seastore_require_partition_count_match_reactor_count")) {
+ ceph_assert(store.get_owner_shard() == seastar::this_shard_id());
+ }
if (store.get_owner_shard() == seastar::this_shard_id()) {
if constexpr (is_plain) {
return seastar::make_ready_future<raw_return_type>(
ceph_assert_always(primary_mapping.core_to_num_pgs.end() != count_iter);
++(count_iter->second);
- if (seastar::smp::count > store_shard_nums ) {
- auto alien_iter = primary_mapping.core_alien_to_num_pgs.find(core_to_update);
- auto core_iter = std::min_element(
- alien_iter->second.begin(),
- alien_iter->second.end(),
- [](const auto &left, const auto &right) {
- return left.second < right.second;
- }
- );
- core_iter->second++;
- core_to_update = core_iter->first;
- }
- if (seastar::smp::count >= store_shard_nums) {
- shard_index_update = 0; // use the first store shard index on this core
+ if(crimson::common::get_conf<bool>("seastore_require_partition_count_match_reactor_count")) {
+ shard_index_update = 0;
} else {
- core_shard_iter = primary_mapping.core_shard_to_num_pgs.find(core_to_update);
- ceph_assert_always(core_shard_iter != primary_mapping.core_shard_to_num_pgs.end());
- if (shard_index_update == NULL_STORE_INDEX) {
- // find the store shard index with the least number of pgs
- // on this core
- shard_iter = std::min_element(
- core_shard_iter->second.begin(),
- core_shard_iter->second.end(),
+ if (seastar::smp::count > store_shard_nums ) {
+ auto alien_iter = primary_mapping.core_alien_to_num_pgs.find(core_to_update);
+ auto core_iter = std::min_element(
+ alien_iter->second.begin(),
+ alien_iter->second.end(),
[](const auto &left, const auto &right) {
return left.second < right.second;
}
);
- shard_index_update = shard_iter->first; //find the store shard index on this core
+ core_iter->second++;
+ core_to_update = core_iter->first;
+ }
+ if (seastar::smp::count >= store_shard_nums) {
+ shard_index_update = 0; // use the first store shard index on this core
} else {
- shard_iter = core_shard_iter->second.find(shard_index_update);
+ core_shard_iter = primary_mapping.core_shard_to_num_pgs.find(core_to_update);
+ ceph_assert_always(core_shard_iter != primary_mapping.core_shard_to_num_pgs.end());
+ if (shard_index_update == NULL_STORE_INDEX) {
+ // find the store shard index with the least number of pgs
+ // on this core
+ shard_iter = std::min_element(
+ core_shard_iter->second.begin(),
+ core_shard_iter->second.end(),
+ [](const auto &left, const auto &right) {
+ return left.second < right.second;
+ }
+ );
+ shard_index_update = shard_iter->first; //find the store shard index on this core
+ } else {
+ shard_iter = core_shard_iter->second.find(shard_index_update);
+ }
+ ++(shard_iter->second);
}
- ++(shard_iter->second);
}
[[maybe_unused]] auto [insert_iter, inserted] =
primary_mapping.pg_to_core.emplace(pgid, std::make_pair(core_to_update, shard_index_update));