如何通过bluestore读写分析实现长尾词优化?
- 内容介绍
- 文章标签
- 相关推荐
本文共计245个文字,预计阅读时间需要1分钟。
plaintext写入BlueStore队列事务:通过添加事务、写入数据,根据事务大小选择小批量或大批量写入。
write
BlueStore::queue_transactions => BlueStore::_txc_add_transaction => BlueStore::_write => BlueStore::_do_write_data
=>
if (head) _do_write_small(txc, c, o, head_offset, head_length, p, wctx);
_do_write_big(txc, c, o, middle_offset, middle_length, p, wctx);
if (tail) _do_write_small(txc, c, o, tail_offset, tail_length, p, wctx);
_txc_add_transaction 分析
1、查找CollectionRef
CollectionRef &c = cvec[op->cid];
2、循环列表,获取op
for (int pos = 0; i.have_op(); ++pos) {
Transaction::Op *op = i.decode_op();
...
}
3、获取onnode,不存在就创建一个
OnodeRef &o = ovec[op->oid];
if (!o) {
ghobject_t oid = i.get_oid(op->oid);
o = c->get_onode(oid, create, op->op == Transaction::OP_CREATE);
}
4、分配WriteContext
int BlueStore::_do_write {
WriteContext wctx;
...
}
5、
BlueStore::_do_write_small
本文共计245个文字,预计阅读时间需要1分钟。
plaintext写入BlueStore队列事务:通过添加事务、写入数据,根据事务大小选择小批量或大批量写入。
write
BlueStore::queue_transactions => BlueStore::_txc_add_transaction => BlueStore::_write => BlueStore::_do_write_data
=>
if (head) _do_write_small(txc, c, o, head_offset, head_length, p, wctx);
_do_write_big(txc, c, o, middle_offset, middle_length, p, wctx);
if (tail) _do_write_small(txc, c, o, tail_offset, tail_length, p, wctx);
_txc_add_transaction 分析
1、查找CollectionRef
CollectionRef &c = cvec[op->cid];
2、循环列表,获取op
for (int pos = 0; i.have_op(); ++pos) {
Transaction::Op *op = i.decode_op();
...
}
3、获取onnode,不存在就创建一个
OnodeRef &o = ovec[op->oid];
if (!o) {
ghobject_t oid = i.get_oid(op->oid);
o = c->get_onode(oid, create, op->op == Transaction::OP_CREATE);
}
4、分配WriteContext
int BlueStore::_do_write {
WriteContext wctx;
...
}
5、
BlueStore::_do_write_small

