#include "tracing/osd.h"
#endif
+static coll_t META_COLL("meta");
+
#define dout_subsys ceph_subsys_osd
#undef dout_prefix
#define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch())
if (found)
return true;
found = store->read(
- coll_t::META_COLL, OSD::get_osdmap_pobject_name(e), 0, 0, bl) >= 0;
+ META_COLL, OSD::get_osdmap_pobject_name(e), 0, 0, bl) >= 0;
if (found)
_add_map_bl(e, bl);
return found;
if (found)
return true;
found = store->read(
- coll_t::META_COLL, OSD::get_inc_osdmap_pobject_name(e), 0, 0, bl) >= 0;
+ META_COLL, OSD::get_inc_osdmap_pobject_name(e), 0, 0, bl) >= 0;
if (found)
_add_map_inc_bl(e, bl);
return found;
OSDSuperblock sb;
bufferlist sbbl;
- ret = store->read(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);
+ ret = store->read(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);
if (ret >= 0) {
dout(0) << " have superblock" << dendl;
if (whoami != sb.whoami) {
object_t oid("disk_bw_test");
for (int i=0; i<1000; i++) {
ObjectStore::Transaction *t = new ObjectStore::Transaction;
- t->write(coll_t::META_COLL, hobject_t(sobject_t(oid, 0)), i*bl.length(), bl.length(), bl);
+ t->write(META_COLL, hobject_t(sobject_t(oid, 0)), i*bl.length(), bl.length(), bl);
store->queue_transaction_and_cleanup(NULL, t);
}
store->sync();
end -= start;
dout(0) << "measured " << (1000.0 / (double)end) << " mb/sec" << dendl;
ObjectStore::Transaction tr;
- tr.remove(coll_t::META_COLL, hobject_t(sobject_t(oid, 0)));
+ tr.remove(META_COLL, hobject_t(sobject_t(oid, 0)));
ret = store->apply_transaction(tr);
if (ret) {
derr << "OSD::mkfs: error while benchmarking: apply_transaction returned "
::encode(sb, bl);
ObjectStore::Transaction t;
- t.create_collection(coll_t::META_COLL);
- t.write(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
+ t.create_collection(META_COLL);
+ t.write(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
ret = store->apply_transaction(t);
if (ret) {
derr << "OSD::mkfs: error while writing OSD_SUPERBLOCK_POBJECT: "
}
// make sure info object exists
- if (!store->exists(coll_t::META_COLL, service.infos_oid)) {
+ if (!store->exists(META_COLL, service.infos_oid)) {
dout(10) << "init creating/touching infos object" << dendl;
ObjectStore::Transaction t;
- t.touch(coll_t::META_COLL, service.infos_oid);
+ t.touch(META_COLL, service.infos_oid);
r = store->apply_transaction(t);
if (r < 0)
goto out;
}
// make sure snap mapper object exists
- if (!store->exists(coll_t::META_COLL, OSD::make_snapmapper_oid())) {
+ if (!store->exists(META_COLL, OSD::make_snapmapper_oid())) {
dout(10) << "init creating/touching snapmapper object" << dendl;
ObjectStore::Transaction t;
- t.touch(coll_t::META_COLL, OSD::make_snapmapper_oid());
+ t.touch(META_COLL, OSD::make_snapmapper_oid());
r = store->apply_transaction(t);
if (r < 0)
goto out;
bufferlist bl;
::encode(superblock, bl);
- t.write(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
+ t.write(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
}
int OSD::read_superblock()
{
bufferlist bl;
- int r = store->read(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, bl);
+ int r = store->read(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, bl);
if (r < 0)
return r;
object_t oid(nm);
hobject_t soid(sobject_t(oid, 0));
ObjectStore::Transaction *t = new ObjectStore::Transaction;
- t->write(coll_t::META_COLL, soid, 0, bsize, bl);
+ t->write(META_COLL, soid, 0, bsize, bl);
store->queue_transaction_and_cleanup(NULL, t);
- cleanupt->remove(coll_t::META_COLL, soid);
+ cleanupt->remove(META_COLL, soid);
}
store->sync_and_flush();
utime_t end = ceph_clock_now(cct);
last_marked_full = e;
hobject_t fulloid = get_osdmap_pobject_name(e);
- t.write(coll_t::META_COLL, fulloid, 0, bl.length(), bl);
+ t.write(META_COLL, fulloid, 0, bl.length(), bl);
pin_map_bl(e, bl);
pinned_maps.push_back(add_map(o));
continue;
dout(10) << "handle_osd_map got inc map for epoch " << e << dendl;
bufferlist& bl = p->second;
hobject_t oid = get_inc_osdmap_pobject_name(e);
- t.write(coll_t::META_COLL, oid, 0, bl.length(), bl);
+ t.write(META_COLL, oid, 0, bl.length(), bl);
pin_map_inc_bl(e, bl);
OSDMap *o = new OSDMap;
o->encode(fbl);
hobject_t fulloid = get_osdmap_pobject_name(e);
- t.write(coll_t::META_COLL, fulloid, 0, fbl.length(), fbl);
+ t.write(META_COLL, fulloid, 0, fbl.length(), fbl);
pin_map_bl(e, fbl);
pinned_maps.push_back(add_map(o));
continue;
service.map_cache.cached_key_lower_bound()));
for (epoch_t e = superblock.oldest_map; e < min; ++e) {
dout(20) << " removing old osdmap epoch " << e << dendl;
- t.remove(coll_t::META_COLL, get_osdmap_pobject_name(e));
- t.remove(coll_t::META_COLL, get_inc_osdmap_pobject_name(e));
+ t.remove(META_COLL, get_osdmap_pobject_name(e));
+ t.remove(META_COLL, get_inc_osdmap_pobject_name(e));
superblock.oldest_map = e+1;
num++;
if (num >= cct->_conf->osd_target_transaction_size &&
#define dout_subsys ceph_subsys_osd
#undef dout_prefix
#define dout_prefix _prefix(_dout, this)
+
+static coll_t META_COLL("meta");
+
template <class T>
static ostream& _prefix(std::ostream *_dout, T *t)
{
//dout(20) << "write_info bigbl " << bigbl.length() << dendl;
}
- t.omap_setkeys(coll_t::META_COLL, infos_oid, v);
+ t.omap_setkeys(META_COLL, infos_oid, v);
return 0;
}
set<string> keys;
keys.insert(get_epoch_key(pgid));
map<string,bufferlist> values;
- store->omap_get_values(coll_t::META_COLL, infos_oid, keys, &values);
+ store->omap_get_values(META_COLL, infos_oid, keys, &values);
assert(values.size() == 1);
tmpbl = values[ek];
bufferlist::iterator p = tmpbl.begin();
}
dout(10) << "append_log adding " << keys.size() << " keys" << dendl;
- t.omap_setkeys(coll_t::META_COLL, log_oid, keys);
+ t.omap_setkeys(META_COLL, log_oid, keys);
pg_log.trim(&handler, trim_to, info);
::decode(struct_v, p);
} else {
if (struct_v < 6) {
- int r = store->read(coll_t::META_COLL, biginfo_oid, 0, 0, lbl);
+ int r = store->read(META_COLL, biginfo_oid, 0, 0, lbl);
if (r < 0)
return r;
p = lbl.begin();
keys.insert(k);
keys.insert(bk);
map<string,bufferlist> values;
- store->omap_get_values(coll_t::META_COLL, infos_oid, keys, &values);
+ store->omap_get_values(META_COLL, infos_oid, keys, &values);
assert(values.size() == 2);
lbl = values[k];
p = lbl.begin();
#define dout_subsys ceph_subsys_osd
+static coll_t META_COLL("meta");
+
//////////////////// PGLog::IndexedLog ////////////////////
void PGLog::IndexedLog::advance_rollback_info_trimmed_to(
keys_to_remove.insert(PG::get_biginfo_key(pgid));
keys_to_remove.insert(PG::get_info_key(pgid));
- t->remove(coll_t::META_COLL, log_oid);
- t->omap_rmkeys(coll_t::META_COLL, infos_oid, keys_to_remove);
+ t->remove(META_COLL, log_oid);
+ t->omap_rmkeys(META_COLL, infos_oid, keys_to_remove);
}
void PGLog::trim(
}
::encode(log.can_rollback_to, keys["can_rollback_to"]);
- t.omap_rmkeys(coll_t::META_COLL, log_oid, to_remove);
- t.omap_setkeys(coll_t::META_COLL, log_oid, keys);
+ t.omap_rmkeys(META_COLL, log_oid, to_remove);
+ t.omap_setkeys(META_COLL, log_oid, keys);
}
bool PGLog::read_log(ObjectStore *store, coll_t coll, hobject_t log_oid,
// legacy?
struct stat st;
- int r = store->stat(coll_t::META_COLL, log_oid, &st);
+ int r = store->stat(META_COLL, log_oid, &st);
assert(r == 0);
if (st.st_size > 0) {
read_log_old(store, coll, log_oid, info, divergent_priors, log, missing, oss, log_keys_debug);
log.tail = info.log_tail;
// will get overridden below if it had been recorded
log.can_rollback_to = info.last_update;
- ObjectMap::ObjectMapIterator p = store->get_omap_iterator(coll_t::META_COLL, log_oid);
+ ObjectMap::ObjectMapIterator p = store->get_omap_iterator(META_COLL, log_oid);
if (p) for (p->seek_to_first(); p->valid() ; p->next()) {
bufferlist bl = p->value();//Copy bufferlist before creating iterator
bufferlist::iterator bp = bl.begin();
if (ondisklog_head > 0) {
// read
bufferlist bl;
- store->read(coll_t::META_COLL, log_oid, ondisklog_tail, ondisklog_length, bl);
+ store->read(META_COLL, log_oid, ondisklog_tail, ondisklog_length, bl);
if (bl.length() < ondisklog_length) {
std::ostringstream oss;
oss << "read_log got " << bl.length() << " bytes, expected "