diff options
author | Sage Weil <sage@inktank.com> | 2013-10-01 13:43:02 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-10-01 13:43:02 -0700 |
commit | f17432b90282cb971680af67ebeec108c42534f4 (patch) | |
tree | 47ecc63f661bc0d7b1f007358cded8cd37b1c8d0 /src | |
parent | a2fc66793f66d359bdb93549acd6aad0893ac5ce (diff) | |
download | ceph-wip-tmap.tar.gz |
osd: remove magical tmap -> omap conversionwip-tmap
This is incomplete and unfortunately unusable in its current state:
- it would only set USES_TMAP for old encoded object_info_t and tmapput,
but would NOT set it for tmapup
- a config option turned that off by default.
That means that the mds conversion from tmap -> omap won't be able to use
this because any existing cluster has tmap objects without the USES_TMAP
flag set. And we don't want to unconditionally try a tmap->omap conversion
on omap operations because there are lots of existing librados users out
there that will be negatively impacted by this.
Instead, the MDS will need to handle this conversion on the client side by
reading either tmap or omap objects and explicitly rewriting the content
with omap (while truncating the tmap data away).
The auto-conversion function was added in v0.44.
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/common/config_opts.h | 6 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 115 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 1 | ||||
-rw-r--r-- | src/osd/osd_types.h | 2 |
4 files changed, 1 insertions, 123 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h index d7505306b6e..fad831f5543 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -362,12 +362,6 @@ OPTION(mds_standby_replay, OPT_BOOL, false) // If true, compact leveldb store on mount OPTION(osd_compact_leveldb_on_mount, OPT_BOOL, false) -// If true, uses tmap as initial value for omap on old objects -OPTION(osd_auto_upgrade_tmap, OPT_BOOL, true) - -// If true, TMAPPUT sets uses_tmap DEBUGGING ONLY -OPTION(osd_tmapput_sets_uses_tmap, OPT_BOOL, false) - // Maximum number of backfills to or from a single osd OPTION(osd_max_backfills, OPT_U64, 10) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index aa20bbb57b8..4e7cbf1e22e 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3290,11 +3290,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) } } - if (cct->_conf->osd_tmapput_sets_uses_tmap) { - assert(cct->_conf->osd_auto_upgrade_tmap); - oi.set_flag(object_info_t::FLAG_USES_TMAP); - } - // write it vector<OSDOp> nops(1); OSDOp& newop = nops[0]; @@ -3340,29 +3335,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) } set<string> out_set; - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - dout(20) << "CEPH_OSD_OP_OMAPGETKEYS: " - << " Reading " << oi.soid << " omap from tmap" << dendl; - map<string, bufferlist> vals; - bufferlist header; - int r = _get_tmap(ctx, &vals, &header); - if (r == 0) { - map<string, bufferlist>::iterator iter = - vals.upper_bound(start_after); - for (uint64_t i = 0; - i < max_return && iter != vals.end(); - ++i, iter++) { - out_set.insert(iter->first); - } - ::encode(out_set, osd_op.outdata); - ctx->delta_stats.num_rd_kb += SHIFT_ROUND_UP(osd_op.outdata.length(), 10); - ctx->delta_stats.num_rd++; - break; - } - dout(10) << "failed, reading from omap" << dendl; - // No valid tmap, use omap - } - { ObjectMap::ObjectMapIterator iter = osd->store->get_omap_iterator( coll, soid @@ -3398,30 +3370,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) } map<string, bufferlist> out_set; - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - dout(20) << "CEPH_OSD_OP_OMAPGETVALS: " - << " Reading " << oi.soid << " omap from tmap" << dendl; - map<string, bufferlist> vals; - bufferlist header; - int r = _get_tmap(ctx, &vals, &header); - if (r == 0) { - map<string, bufferlist>::iterator iter = vals.upper_bound(start_after); - if (filter_prefix > start_after) iter = vals.lower_bound(filter_prefix); - for (uint64_t i = 0; - i < max_return && iter != vals.end() && - iter->first.substr(0, filter_prefix.size()) == filter_prefix; - ++i, iter++) { - out_set.insert(*iter); - } - ::encode(out_set, osd_op.outdata); - ctx->delta_stats.num_rd_kb += SHIFT_ROUND_UP(osd_op.outdata.length(), 10); - ctx->delta_stats.num_rd++; - break; - } - // No valid tmap, use omap - dout(10) << "failed, reading from omap" << dendl; - } - { ObjectMap::ObjectMapIterator iter = osd->store->get_omap_iterator( coll, soid @@ -3449,19 +3397,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_OMAPGETHEADER: ++ctx->num_read; { - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - dout(20) << "CEPH_OSD_OP_OMAPGETHEADER: " - << " Reading " << oi.soid << " omap from tmap" << dendl; - map<string, bufferlist> vals; - bufferlist header; - int r = _get_tmap(ctx, &vals, &header); - if (r == 0) { - osd_op.outdata.claim(header); - break; - } - // No valid tmap, fall through to omap - dout(10) << "failed, reading from omap" << dendl; - } osd->store->omap_get_header(coll, soid, &osd_op.outdata); ctx->delta_stats.num_rd_kb += SHIFT_ROUND_UP(osd_op.outdata.length(), 10); ctx->delta_stats.num_rd++; @@ -3480,28 +3415,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) goto fail; } map<string, bufferlist> out; - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - dout(20) << "CEPH_OSD_OP_OMAPGET: " - << " Reading " << oi.soid << " omap from tmap" << dendl; - map<string, bufferlist> vals; - bufferlist header; - int r = _get_tmap(ctx, &vals, &header); - if (r == 0) { - for (set<string>::iterator iter = keys_to_get.begin(); - iter != keys_to_get.end(); - ++iter) { - if (vals.count(*iter)) { - out.insert(*(vals.find(*iter))); - } - } - ::encode(out, osd_op.outdata); - ctx->delta_stats.num_rd_kb += SHIFT_ROUND_UP(osd_op.outdata.length(), 10); - ctx->delta_stats.num_rd++; - break; - } - // No valid tmap, use omap - dout(10) << "failed, reading from omap" << dendl; - } osd->store->omap_get_values(coll, soid, keys_to_get, &out); ::encode(out, osd_op.outdata); ctx->delta_stats.num_rd_kb += SHIFT_ROUND_UP(osd_op.outdata.length(), 10); @@ -3579,9 +3492,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_OMAPSETVALS: ++ctx->num_write; { - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - _copy_up_tmap(ctx); - } if (!obs.exists) { ctx->delta_stats.num_objects++; obs.exists = true; @@ -3609,9 +3519,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_OMAPSETHEADER: ++ctx->num_write; { - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - _copy_up_tmap(ctx); - } if (!obs.exists) { ctx->delta_stats.num_objects++; obs.exists = true; @@ -3629,9 +3536,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) result = -ENOENT; break; } - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - _copy_up_tmap(ctx); - } t.touch(coll, soid); t.omap_clear(coll, soid); ctx->delta_stats.num_wr++; @@ -3645,9 +3549,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) result = -ENOENT; break; } - if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) { - _copy_up_tmap(ctx); - } t.touch(coll, soid); set<string> to_rm; try { @@ -3821,22 +3722,6 @@ int ReplicatedPG::_get_tmap(OpContext *ctx, return 0; } -int ReplicatedPG::_copy_up_tmap(OpContext *ctx) -{ - dout(20) << "copying up tmap for " << ctx->new_obs.oi.soid << dendl; - ctx->new_obs.oi.clear_flag(object_info_t::FLAG_USES_TMAP); - map<string, bufferlist> vals; - bufferlist header; - int r = _get_tmap(ctx, &vals, &header); - if (r < 0) - return 0; - ctx->op_t.omap_setkeys(coll, ctx->new_obs.oi.soid, - vals); - ctx->op_t.omap_setheader(coll, ctx->new_obs.oi.soid, - header); - return 0; -} - inline int ReplicatedPG::_delete_head(OpContext *ctx) { SnapSet& snapset = ctx->new_snapset; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index abee57ffe7d..83fd9fd1889 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -855,7 +855,6 @@ private: int _get_tmap(OpContext *ctx, map<string, bufferlist> *out, bufferlist *header); - int _copy_up_tmap(OpContext *ctx); int _delete_head(OpContext *ctx); int _rollback_to(OpContext *ctx, ceph_osd_op& op); public: diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 240040a308d..616e6acdc69 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -2100,7 +2100,7 @@ struct object_info_t { FLAG_LOST = 1<<0, FLAG_WHITEOUT = 1<<1, // object logically does not exist // ... - FLAG_USES_TMAP = 1<<8, + FLAG_USES_TMAP = 1<<8, // deprecated; no longer used. } flag_t; flag_t flags; |