osd: limit omap data in push op
authorWanlong Gao <wanlong.gao@easystack.cn>
Thu, 23 Jun 2016 12:04:25 +0000 (20:04 +0800)
committerAdrian Bunk <bunk@debian.org>
Wed, 7 Jun 2017 08:39:39 +0000 (09:39 +0100)
We already have the config osd_recovery_max_chunk to limit the total
size of omap entries and omap data. But we need an individual config
to limit the number of omap entries independently. We call this config
osd_recovery_max_omap_entries_per_chunk here with the default number
of 64000.

Signed-off-by: Wanlong Gao <wanlong.gao@easystack.cn>
Gbp-Pq: Name osd-limit-omap-data-in-push-op.patch

src/common/config_opts.h
src/osd/ReplicatedBackend.cc

index 3795f0ec3e6c2f998b09ee005622ca2292638351..1c3ea43fb3a999c42a2cf446e37f03eb6722ae6a 100644 (file)
@@ -748,6 +748,7 @@ OPTION(osd_recovery_delay_start, OPT_FLOAT, 0)
 OPTION(osd_recovery_max_active, OPT_INT, 3)
 OPTION(osd_recovery_max_single_start, OPT_INT, 1)
 OPTION(osd_recovery_max_chunk, OPT_U64, 8<<20)  // max size of push chunk
+OPTION(osd_recovery_max_omap_entries_per_chunk, OPT_U64, 64000) // max number of omap entries per chunk; 0 to disable limit
 OPTION(osd_copyfrom_max_chunk, OPT_U64, 8<<20)   // max size of a COPYFROM chunk
 OPTION(osd_push_per_object_cost, OPT_U64, 1000)  // push cost per object
 OPTION(osd_max_push_cost, OPT_U64, 8<<20)  // max size of push message
index 32b9f17654f1818133acf2d082ffcbe930784f3e..708ca7855984976c14fb6c40842c13cb2b063966 100644 (file)
@@ -1985,7 +1985,9 @@ int ReplicatedBackend::build_push_op(const ObjectRecoveryInfo &recovery_info,
         iter->valid();
         iter->next(false)) {
       if (!out_op->omap_entries.empty() &&
-         available <= (iter->key().size() + iter->value().length()))
+         ((cct->_conf->osd_recovery_max_omap_entries_per_chunk > 0 &&
+           out_op->omap_entries.size() >= cct->_conf->osd_recovery_max_omap_entries_per_chunk) ||
+          available <= iter->key().size() + iter->value().length()))
        break;
       out_op->omap_entries.insert(make_pair(iter->key(), iter->value()));