网站建设资讯

NEWS

网站建设资讯

CephOSD处理客户端写操作处理流程的示例分析

这篇文章主要介绍Ceph OSD处理客户端写操作处理流程的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联专注于兰陵网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供兰陵营销型网站建设,兰陵网站制作、兰陵网页设计、兰陵网站官网定制、成都微信小程序服务,打造兰陵网络公司原创品牌,更为您提供兰陵网站排名全网营销落地服务。

1、OSD从client端收到请求的处理流程

OSD::ms_fast_dispatch()

|__OSD::dispatch_session_waiting()

     |__OSD::dispatch_op_fast()

          |__OSD::handle_op()

               |__OSD::get_pg_or_queue_for_pg()

               |__OSD::enqueue_op()

                    |__PG::queue_op()

                         |__OSD::op_wq.queue()          将client的请求写入到队列

主OSD处理从client端请求的处理流程

OSD::ShardOpWQ::_process()

|__OSD::dequeue_op()

     |__ReplicatedPG::do_request()

          |__ReplicatedPG::do_op()

               |__ReplicatedPG::execute_ctx()

                    |__ReplicatedPG::preapare_transcation()

                         |__ReplicatedPG::do_osd_ops()

                    |__ReplicatedPG::issue_repop()

                         |__ReplicateBackend::submit_transaction()

                              |__ReplicateBackend::issue_op()                    主OSD将写请求发送到从OSDs

                              |__ReplicatedPG::queue_transcations()          写主OSD FileJournal

                                   |__ObjectStore::queue_transactions()

                                        |__FileStore::queue_transactions()

                                             |__JournalingObjectStore::_op_journal_transactions()

                                                  |__FileJournal::submit_entry()     将日志写入到FileJournal的writeq队列

                    |__ReplicatedPG::eval_repop()

主OSD的FileJournal写线程

FileJournal::write_thread_entry()           负责从writeq队列中获取待写入的日志

|__FileJournal::prepare_multi_write()     构成日志

|__FileJournal::do_write()                       实际写日志

     |__FIleJournal::queue_completions_thru()

          |__completion_peek_front()          获取C_JournalAhead类实例

          |__finisher->queue()

          |__finisher_cond.Signal()               启动FileJournal的finisher线程处理C_JournalAhead类实例

主OSD的C_JournalAhead类处理

C_JournalAhead::finish()

|__FileStore::_journaled_ahead()

     |__FileStore::queue_op()

          |__FileStore::op_wq.queue()          将数据写入到FileStore写线程队列中

     |__ondisk_finisher.queue(ondisk)     调用ReplicatedBackend->op_commit()回调函数

主OSD的FileStore写数据线程类处理

FileStore::op_wq

|__FileStore::op_wq._process()

     |__FileStore::_do_op()

          |__FileStore::_do_transactions()

               |__FileStore::_do_transaction()

                    |__FileStore::_write()          落盘到FileStore中(写入指定的文件中)

|__FileStore::op_wq._process_finish()

     |__FileStore::_finish_op()

          |__op_finisher.queue()                    调用ReplicatedPG::op_applied()回调函数


2、从OSD处理主OSD端发送过来的请求

OSD::ms_fast_dispatch()

|__OSD::dispatch_session_waiting()

     |__OSD::dispatch_op_fast()

          |__OSD::handle_replica_op()

               |__OSD::get_pg_or_queue_for_pg()

               |__OSD::enqueue_op()

                    |__PG::queue_op()

                         |__OSD::op_wq.queue()          将主OSD的请求写入到从OSD处理队列中

从OSD处理workqueue

OSD::ShardOpWQ::_process()

|__OSD::dequeue_op()

     |__ReplicatedPG::do_request()

          |__ReplicatedBackend::handle_message()

               |__ReplicatedBackend::sub_op_modify()

                    |__ReplicatedBackend::sub_op_modify_impl()

                         |__注册commit回调函数类C_OSD_RepModifyCommit()

                         |__注册Apply回调函数类C_OSD_RepModifyApply()

                         |__ReplicatedPG::queue_transcations()          从OSD写FileJournal

                                   |__ObjectStore::queue_transactions()

                                        |__FileStore::queue_transactions()

                                             |__JournalingObjectStore::_op_journal_transactions()

                                                  |__FileJournal::submit_entry()     将日志写入到FileJournal的writeq队列

                    |__ReplicatedPG::eval_repop()

从OSD的FileJournal写线程

FileJournal::write_thread_entry()           负责从writeq队列中获取待写入的日志

|__FileJournal::prepare_multi_write()     构成日志

|__FileJournal::do_write()                       实际写日志

     |__FIleJournal::queue_completions_thru()

          |__completion_peek_front()          获取C_JournalAhead类实例

          |__finisher->queue()

          |__finisher_cond.Signal()               启动FileJournal的finisher线程处理C_JournalAhead类实例

从OSD的C_JournalAhead类处理

C_JournalAhead::finish()

|__FileStore::_journaled_ahead()

     |__FileStore::queue_op()

          |__FileStore::op_wq.queue()          将数据写入到FileStore写线程队列中

     |__ondisk_finisher.queue(ondisk)     调用ReplicatedBackend->op_commit()回调函数

从OSD的日志写完成后的处理

C_OSD_RepModifyCommit()

|__finish()

     |__ReplicatedBackend::sub_op_modify_commit()

          |__生成MOSDRepOpReply消息                                   CEPH_OSD_FLAG_ONDISK

          |__ReplicatedPG::send_message_osd_cluster()          将从OSD回复信息发给主OSD

               |__OSD::send_message_osd_cluster()

从OSD的FileStore写数据线程类处理

FileStore::op_wq

|__FileStore::op_wq._process()

     |__FileStore::_do_op()

          |__FileStore::_do_transactions()

               |__FileStore::_do_transaction()

                    |__FileStore::_write()          落盘到FileStore中(写入指定的文件中)

|__FileStore::op_wq._process_finish()

     |__FileStore::_finish_op()

          |__op_finisher.queue()                    调用ReplicatedPG::op_applied()回调函数

从OSD的落盘完成后的处理

C_OSD_RepModifyApply()

|__finish()

     |__ReplicatedBackend::sub_op_modify_applied()

          |__生成MOSDRepOpReply消息                                   CEPH_OSD_FLAG_ACK

          |__ReplicatedPG::send_message_osd_cluster()          将从OSD回复信息发给主OSD

               |__OSD::send_message_osd_cluster()


3、主OSD处理从OSD发送Reply处理流程

从OSD处理主OSD端发送过来的请求

OSD::ms_fast_dispatch()

|__OSD::dispatch_session_waiting()

     |__OSD::dispatch_op_fast()

          |__OSD::handle_replica_op()

               |__OSD::get_pg_or_queue_for_pg()

               |__OSD::enqueue_op()

                    |__PG::queue_op()

                         |__OSD::op_wq.queue()          将从OSD的reply写入到主OSD处理队列中

主OSD处理从OSD端发送过来的reply

OSD::ShardOpWQ::_process()

|__OSD::dequeue_op()

     |__ReplicatedPG::do_request()

          |__ReplicatedBackend::handle_message()

               |__ReplicatedBackend::sub_op_modify_reply()

                    |__ip_op.waiting_for_commit.erase()

                    |__ip_op.waiting_for_applied.erase()

                    |__对于ip_op.waiting_for_applied为空,则调用ip_op.on_applied->complete(0),即:调用on_all_applied回调函数处理。on_all_applied回调函数在ReplicatedPG.cc::execute_ctx()函数中注册,用来对所有副本都落盘完成后的处理。on_all_applied()函数创建一个MOSDOpReply消息并且设置消息的flags=CEPH_OSD_FLAG_ACK且将该消息发送给客户端;

                    |__对于ip_op.waiting_for_commit为空,则调用ip_op.on_commit->complete(0),即:调用on_all_commit回调函数处理。on_all_commit回调函数在ReplicatedPG.cc::execute_ctx()函数中注册,用来对所有副本在写FileJournal完成后的处理。on_all_commit()函数创建一个MOSDOpReply消息并且设置消息的flags=CEPH_OSD_FLAG_ACK|CEPH_OSD_FLAG_ONDISK且将该消息发送给客户端;

以上是“Ceph OSD处理客户端写操作处理流程的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


名称栏目:CephOSD处理客户端写操作处理流程的示例分析
网站地址:http://cdweb.net/article/gohehd.html