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

How to use the StrayManager class

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly shows you "how to use the StrayManager class", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the StrayManager class" this article.

The StrayManager class description:

Class StrayManager {elist delayed_eval_stray; list ready_for_purge; MDSRank * mds; uint64_t ops_in_flight; uint64_t files_purging; uint64_t max_purge_ops; uint64_t num_strays; uint64_t num_strays_purging; uint64_t num_strays_delayed; Filer filer;}

StrayManager class methods:

StrayManager::purge (dn, op_allowance) actually deletes the inode information corresponding to the specified dentry from the cluster.

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ _ increase the num_strays_purging value |

| | _ if in is a directory |

| | _ _ get the pool location of the mds object based on the metadata_pool information where the in object is located |

| | _ _ if the in directory is not a leaf node on dirfragtree |

| | _ _ get all the leaf nodes of the in directory on dirfragtree |

| | _ _ traverse all leaf nodes |

| | _ _ get the oid information of the leaf node, that is, CInode::get_object_name (in- > inode.ino, * p, "") |

| | _ _ delete the leaf node from pool, that is: mds- > objecter- > remove (oid, oloc,...) |

| | _ _ return directly |

| | _ _ get all SnapRealm information from in |

| | _ _ SnapRealm is valid |

| | _ _ get the context information of SnapRealm, namely: snapc = & realm- > get_snap_context () |

| | _ _ SnapRealm is invalid |

| | _ _ set snapc to nullsnapc |

| | _ _ get the projected inode information of in |

| | _ _ get the oid of projected_inode, that is: oid = CInode::get_object_name (pi- > ino, frag_t (), "") |

| | _ _ Delete backtrace object, that is, mds- > objecter- > remove (oid, oloc,...) |

| | _ _ traverses the collection of old backtrace objects, that is, pi- > old_pools |

| | _ _ Delete backtrace object, that is, mds- > objecter- > remove (oid, oloc,...) |

StrayManager::_purge_stray_purged (dn, ops_allowance, only_head)

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ if only _ head==true |

| | _ _ create EUpdate class object |

| | _ _ set the start_entry of the mdlog of mds to the EUpdate class object, that is, mds- > mdlog- > start_entry (le) |

| | _ _ get the project_inode information of in |

| | _ _ initialize project_inode information |

| | _ _ set the dir_context of metablob in the LogEvent class object (le), that is, le- > metablob.add_dir_context () |

| | _ _ add primary dentry to medtablob in LogEvent class object (le), that is, le- > metablob.add_primary_dentry () |

| | _ _ submit entry to MDLog, that is: mds- > mdlog- > submit_entry () |

| | _ if only _ head==false |

| | _ _ create EUpdate class object |

| | _ _ set the start_entry of the mdlog of mds to the EUpdate class object, that is, mds- > mdlog- > start_entry (le) |

| | _ _ set the dir_context of metablob in the LogEvent class object (le), that is, le- > metablob.add_dir_context () |

| | _ _ add a dir to the metablob of LogEvent, namely: le- > metablob.add_dir () |

| | _ _ add an empty dentry to the metablob of LogEvent, that is, le- > metablob.add_null_dentry () |

| | _ _ add a destroyed inode to the metablob of LogEvent, namely: le- > metablob.add_destroyed_inode () |

| | _ _ submit entry to MDLog, that is: mds- > mdlog- > submit_entry () |

| | _ _ decreasing num_strays_purging |

| | _ _ subtract ops_allowance from ops_in_flight |

| | _ _ call _ advance () |

StrayManager::_advance ()

| | _ _ traverse the ready_for_purge collection (QueuedStray collection) |

| | _ _ call _ consume () |

| | _ if _ consume () returns true |

| | _ _ stop traversal |

| | _ _ Delete the node in the ready_for_purge collection that returns true from start to _ consume () |

StrayManager::_consume (dn, trunc, ops_required)

| | _ _ get the number of files that can be purge from the configuration file, that is, gencrypted confession-> mds_max_purge_files-files_purging |

| | _ if files _ avail0 and ops_availdir- > unlink_inode (dn) |

| | _ _ delete projected fnode from the dir directory where dn resides, namely: dn- > dir- > pop_and_dirty_projected_fnode (ls) |

| | _ _ Delete in from MDCache, that is: in- > mdcache- > remove_inode (in) |

| | _ _ if dn is new |

| | _ _ delete the dn from the dir directory where the dn resides, namely: dn- > dir- > remove_dentry (dn) |

| | _ _ if dn is not new |

| | _ _ set dn to the bottom of dentry in MDCache, that is, in- > mdcache- > touch_dentry_bottom (dn) |

StrayManager::_calculate_ops_required (in, trunc)

| | _ if in is a directory |

| | _ _ ops_reqired number = the number of leaf nodes of 1+in under dirfragtree |

| | _ if in is not a directory |

| | the number of _ _ ops_reqired = 1 percent confession-> filer_max_purge_ops |

StrayManager::enqueue (dn, trunc)

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ _ sets the status of dn to STATE_PURGING |

| | _ _ sets the status of in to STATE_PURGING |

| | _ _ calculate the number of ops required based on in and trunc, that is, _ calculate_ops_required (in, trunc) |

| | _ _ if ready _ for_purge array is not empty |

| | _ _ call _ consume (dn, trunc, ops_required) |

| | _ if _ consume () returns false |

| | _ _ reinsert dn into the ready_for_purge array, namely: ready_for_purge.push_back () |

StrayManager::advance_delayed ()

| | _ _ traverse the delayed_eval_stray array |

| | _ _ delete yourself from the item_stray array of dn, that is, dn- > item_stray.remove_myself () |

| | _ _ decreasing num_strays_delayed |

StrayManager::_eval_stray (dn, delay) checks whether dn and its corresponding CInode meet the conditions of stray, and returns true if so, false otherwise

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ _ if dn does not belong to auth |

| _ _ set dn to the bottom of dentry in MDCache, and then it will be dropped by trim immediately. That is: in- > mdcache- > touch_dentry_bottom (dn)

| | _ _ returns false |

| | _ _ if dn is in item_stray array |

| | _ _ delete yourself from the item_stray array, that is, dn- > item_stray.remove_myself () |

| | _ _ decreasing num_strays_delayed |

| | _ _ if inode link of in is 0 |

| | _ _ if snaprealm is included in in |

| | _ _ if the snaprealm of in has no past_parents_open and no open parents |

| | _ _ returns false |

| | _ _ delete past parents from the snaprealm of in, that is: in- > snaprealm- > prune_past_parents () |

| | _ _ delete stale snap data from in, that is: in- > purge_stale_snap_data () |

| | _ if in is a directory |

| | _ _ if the in contains snaprealm and the snamrealm of in contains past parents |

| | _ _ returns false |

| | _ _ if the in contains dirfrags |

| | _ _ get all the dirfrags under the in |

| | _ _ traverses all dirfrags |

| | _ _ delete all dirfrags, that is: (* p)-> try_remove_dentries_for_stray () |

| | _ _ if the remote parents of in is not empty, the in still has a remote link |

| | _ _ traverses in's remote parents array |

| | _ _ Delete remote link, that is, remote_dn- > unlink_remote (remote_dn- > get_linkage ()) |

| | _ _ if dn is replicted, that is, the replica_map of dn is not empty |

| | _ _ returns false |

| | _ _ if dn still has any leases or any caps |

| | _ _ returns false |

| | _ _ if the current status of dn is STATE_NEEDSRECOVER or STATE_RECOVERING |

| | _ _ returns false |

| | _ _ if the reference count of in > the number of dirty of in + 1 |

| | _ _ returns false |

| | _ if delay==true |

| | _ _ if dn is not in item_stray array |

| | _ _ insert dn- > item_stray array into delayed_eval_stray array, that is, delayed_eval_stray.push_back (dn- > item_stray) |

| | _ _ if delay==false and in has snaprealm and the snaprealm of in contains past parents and the old_inodes of in is not empty |

| | _ _ if in is a file and the size of the projected inode of in is greater than 0 |

| | _ enqueue (dn, true) |

| | _ other conditions |

| | _ if in is a directory |

| | _ _ disable all dirfrags of in, that is, in- > close_dirfrags () |

| | _ enqueue (dn, false) |

| | _ _ returns true |

| | _ _ if the inode link of in is not 0 |

| | _ _ call eval_remote_stray (dn, NULL) |

| | _ _ returns false |

StrayManager::eval_stray (dn, delay)

| | _ eval_stray (dn, delay) |

-

StrayManager::eval_remote_stray (stray_dn, remote_dn) when the nlink of the dn to be evaluated is greater than 0, you need to evaluate whether the remote dn is stray

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ if remote _ dn is empty |

| | _ _ if stray _ in remote_parents is not empty |

| | _ _ traverses stray_in 's remote_parents array |

| | _ _ if the last==CEPH_NOSNAP of the member in the array |

| | _ _ assign members of the array to remote_dn |

| | _ _ if remote _ dn is empty, that is, last==CEPH_NOSNAP 's is not found in stray_in 's remote parents array |

| | _ _ return directly |

| | _ _ if remote _ dn is not projected |

| | _ _ if remote _ dn is auth and the CDir corresponding to remote_dn can auth pin |

| | _ reintegrate_stray (stray_dn, remote_dn) |

| | _ _ otherwise, if remote_dn is not auth and stray_dn is auth |

| | _ migrate_stray (stray_dn, remote_dn- > authority () .first) |

StrayManager::reintegrate_stray (straydn, rdn)

| | _ _ get the full path of straydn, that is: straydn- > make_path (src) |

| | _ _ get the full path of remotedn, that is: rdn- > make_path (dst) |

| | _ _ create a MClientRequest message with a message type of CEPH_MDS_OP_RENAME |

| | _ _ set source and destination filepath |

| | _ _ set tid |

| | _ _ send the message to the first MDS process authorized by rdn, namely: mds- > send_message_mds (req, rdn- > authority () .first) |

StrayManager::migrate_stray (dn, to)

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ _ get the CInode class object diri of the dir corresponding to dn |

| | _ _ get the full path of dn, that is: dn- > make_path (src) |

| | _ _ get the stray dentry name of in, that is: in- > name_stray_dentry (dname) |

| | _ _ create a MClientRequest message with a message type of CEPH_MDS_OP_RENAME |

| | _ _ set source and destination filepath |

| | _ _ set tid |

| | _ _ send the message to the MDS process to, namely: mds- > send_message_mds (req, to) |

StrayManager::abort_queue ()

| | _ _ traverse the ready_for_purge collection |

| | _ _ get CDentry from collection member QueuedStray |

| | _ _ get CInode from Cdentry |

| | _ _ clear the STATE_PURGING status of dn, that is, dn- > state_clear (STATE_PURGING) |

| | _ _ clear the STATE_PURGING status of in, that is, in- > state_clear (STATE_PURGING) |

| | _ _ clear the ready_for_purge collection |

StrayManager::truncate (dn, op_allowance)

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ _ get snaprealm information from in |

| | _ _ get SnapContext information from snaprealm |

| | _ _ get the maximum values of in- > inode.size and in- > inode.get_max_size () and in- > inode.max_size_ever |

| | _ _ if the maximum value is greater than 0 |

| | _ _ get the number of stripes of the inode from Striper, that is, Striper::get_num_objects (in- > inode.layout, to) |

| | _ _ if the number of stripes is greater than 1 |

| | _ _ number of stripes specified through filer purge, namely: filer.purge_range () |

| | _ _ clear the specified inode via filer, that is, filer.zero () |

StrayManager::_truncate_stray_logged (dn, ls)

| | _ _ get the CInode class object in corresponding to CDentry from dn |

| | _ _ clear the STATE_PURGING status of dn, that is, dn- > state_clear (STATE_PURGING) |

| | _ _ dirty projected inode from in, that is, in- > pop_and_dirty_projected_inode (ls) |

| | _ eval_stray (dn) |

StrayManager::update_op_limit ()

| | _ _ get the current osdmap from the objecter of mds |

| | _ _ get all data pool from mdspmap |

| | _ _ traverses data pool |

| | _ _ accumulate the number of pg of all data pool |

| | _ _ get the maximum number of mds currently available from mdsmap |

| | _ _ calculates the number of operations that can be used for purge, that is: nroompgsUniverse > mds_max_purge_ops_per_pg. |

| | _ _ if the configuration file contains mds_max_purge_ops |

| | _ _ assign the minimum value of max_purge_ops and mds_max_purge_ops in the configuration file to max_purge_ops |

The above is all the content of this article "how to use StrayManager Class". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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