Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the contents related to MDSTable?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant content of MDSTable, the article is very detailed, has a certain reference value, interested friends must read it!

The operation on MDSTable is mainly about saving version and state to and reading from the cluster. The specific operation handling functions are described as follows:

MDSTable::save ()

| | _ _ encode version and state |

| | _ _ set committing_version = version set committing_version |

| | _ _ set waitfor_ save [version] .push _ back (onfinish) |

| | _ _ get_object_name () gets the object name mds_$ {table_name} |

| | _ _ get the object_locator_t class instance, that is, store the data in metadata pool |

| | _ _ mds- > object_write_full () writes the encode data of version and state to the mds_$ {table_name} object in metadata pool |

MDSTable::save_2 ()

| | _ _ committed_version = v sets committed_version |

| | _ _ traverse the waitfor_save array |

| | _ _ for waitfor_ save [I]-> first objecter- > read_full () get MDSTable information from the cluster |

MDSTable::load_2 ()

| | _ state = STATE_ACTIVE |

| | _ _ if r =-EBLACKLISTED, call mds- > respawn () |

| | _ _ if r |

< 0,则调用mds->

Damaged ()

| | _ _ get the version value from the cluster and set projected_version=committed_version=version |

| | _ _ get state information from the cluster |

MDSTableServer class inherits MDSTable class

Class MDSTableServer: public MDSTable {

Int table

Map pending_for_mds; records the information that the mds operation is not completed

}

MDSTableServer::handle_request () total route scheduling function, which is responsible for dispatching requests to different handle_* () for processing

| | _ TABLESERVER_OP_QUERY |

| | _ handle_query () |

| | _ TABLESERVER_OP_PREPARE |

| | _ handle_prepare () |

| | _ TABLESERVER_OP_COMMIT |

| | _ handle_commit () |

| | _ TABLESERVER_OP_ROLLBACK |

| | _ handle_rollback () |

MDSTableServer::handle_prepare ()

| | _ _ prepare () calls the _ prepare () function of the subclass to get specific information from the request message |

| | _ note_prepare () populates the pending_for_mds array |

| | _ _ create ETableServer class object |

| | _ _ mds- > mdlog- > submit_entry () write log |

| | _ mds- > mdlog- > flush () |

MDSTableServer::_prepare_logged () this function is the callback function after handle_prepare () finishes writing log.

| | _ _ create MMDSTableRequest message (TABLESERVER_OP_AGREE) |

| | _ _ mds- > send_message_mds () sends the class message back to the peer who calls handle_prepare () |

MDSTableServer::handle_commit ()

| | _ _ check whether the corresponding item is included in the pending_for_mds array |

| | _ commit () executes the commit operation of the subclass |

| | _ note_commit () deletes the corresponding entry in the pending_for_mds array |

| | _ _ mds- > mdlog- > start_submit_entry () write log |

MDSTableServer::_commit_logged () this function is the callback function after handle_commit () finishes writing log.

| | _ _ create MMDSTableRequest message (TABLESERVER_OP_ACK) |

| | _ _ mds- > send_message_mds () sends the class message back to the peer who calls handle_prepare () |

MDSTableServer::handle_rollback ()

| | _ rollback () executes the rollback operation of the subclass |

| | _ note_rollback () deletes the corresponding entry in the pending_for_mds array |

| | _ _ mds- > mdlog- > start_submit_entry () write log |

MDSTableServer::do_server_update ()

| | _ _ create ETableServer class instance |

| | _ mds- > mdlog- > start_entry () |

| | _ _ mds- > mdlog- > submit_entry () write log |

MDSTableServer::finish_recovery ()

| | _ _ traverse the mds_rank_t collection in the parameter |

| | _ handle_mds_recovery () |

MDSTableServer::handle_mds_recovery ()

| | _ _ traverse the pending_for_mds array |

| | _ _ create MMDSTableRequest message (TABLESERVER_OP_AGREE) |

| | _ _ mds- > send_message_mds () sends mds messages |

| | _ _ create MMDSTableRequest message (TABLESERVER_OP_SERVER_READY) |

| | _ _ mds- > send_message_mds () sends mds messages |

The SnapServer class inherits from MDSTableServer and is used to record relevant information that requires Snap operations.

Class SnapServer: public MDSTableServer {

MonClient * client side of the interaction between mon_client; and monitor

Snapid_t last_snap

Map snaps

Map need_to_purge

Map pending_update

Map pending_destroy

Set pending_noop

Version_t last_checked_osdmap

}

SnapServer::reset_state () clears the arrays snaps and need_to_purge, and then gets the last_ snapvalue

| | _ _ set last_snap=1 |

| | _ _ clear snaps and need_to_purge arrays |

| | _ _ traverses the osdmap used by mds |

| | _ _ traverses all data pools used by mdsmap |

| | _ _ get the pg_pool_t structure of data pool from osdmap |

| | _ _ if the removed_snaps array in the pg_pool_t structure is not empty, take the maximum value of removed_snaps.range_end () |

| | _ _ sets the maximum value of last_snap = removed_snaps.range_end () |

SnapServer::_prepare ()

| | _ TABLE_OP_CREATE |

| | _ _ update the version value (version++) |

| | _ _ get SnapInfo information (ino/name/stamp) from parameter bufferlist |

| | _ _ set snapid of SnapInfo = + + last_snap/long_name= "create" |

| | _ _ update pending_ [version] = info |

| | _ TABLE_OP_DESTROY |

| | _ _ get the values of inodeno_t and snapid_t from the parameter bufferlist |

| | _ _ update version and last_ snapshots (version++/++last_snap) |

| | _ _ update the pending_ destroy array |

| | _ TABLE_OP_UPDATE |

| | _ _ get SnapInfo information (ino/snapid/name/stamp) from parameter bufferlist |

| | _ _ update version and last_ snapshots (version++/++last_snap) |

| | _ _ update pending_ [version] = info |

SnapServer::_is_prepared ()

| | _ _ determines whether the pending_update or pending_destroy array contains the tid specified by the parameter |

SnapServer::_commit ()

| | _ _ the tid to be commit is in the pending_update array |

| | _ _ gets the SnapInfo value of the specified tid from the pending_update array |

| | _ _ update snaps [info.snapid] = info |

| | _ _ delete pending_ update [tid] |

| | _ _ the tid to be commit is in the pending_destroy array |

| | _ _ get the snapid and last_snapid corresponding to the specified tid from the pending_destroy array |

| | _ _ delete the value corresponding to snapid from the snaps array |

| | _ _ traverses all data pools of mdsmap |

| | _ _ update need_to_purge array (need_to_purge [* p] .insert (snapid) / need_to_purge [* p] .insert (last_snapid) |

| | _ _ delete pending_ destroy [tid] |

| | _ _ update version (version++) |

SnapServer::_rollback ()

| | _ _ delete the value of the specified tid in the pending_update/pending_destroy array |

SnapServer::_server_update ()

| | _ _ get the map purge value from the parameter bufferlist |

| | _ _ traverses purge |

| | _ _ Delete the specified content in need_to_purge |

| | _ _ update version |

SnapServer::check_osd_map ()

| | _ _ traverses all osdmap corresponding to mds |

| | _ _ traverse the need_to_purge array |

| | _ _ get the value of pg_pool_t data structure from osdmap |

| | _ _ if PG _ pool_t is empty, set all_ purged [id] = need_to_ purged [id] .all |

| | _ _ traverses the second parameter of need_to_purge array |

| | _ _ if PG _ pool_t- > is_removed_snap (I), set all_ purged [id] .push _ back (I), otherwise set all_ purge [id] .push _ back (I) |

| | _ _ is not empty for all_purged array |

| | _ _ serialize the all_purged array |

| | _ MDSTableServer::do_server_update () |

| | _ SnapServer::_server_update () |

| | _ _ create ETableServer class object |

| | _ mds- > mdlog- > start_entry () |

| | _ _ mds- > mdlog- > submit_entry () write log |

| | _ _ is not empty for all_purge array |

| | _ _ create a MRemoveSnaps message |

| | _ _ mon_client- > send_mon_message () sends a message to monitor to delete the corresponding snaps |

The relationship between MDSTable/MDSTableServer/SnapServer is shown in the following figure:

The above is all the content of this article "what is the content related to MDSTable?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report