Afr中4种触发自修复的过程

Afr(Auto File Replication) 由于其有副本, 使得自修复(Self Heal)的特性得以实现。 self heal以下简称SH。副本数为n

 

 

1. afr_lookup触发

 

在afr模块中的调用先后关系是 afr_lookup -> n次 afr_lookup_cbk -> afr_lookup_done -> afr_lookup_perform_self_heal ->  afr_lookup_set_self_heal_params ->  afr_can_self_heal_proceed? -> afr_launch_self_heal. 

 

2. opendir 触发

 

afr_opendir -> n次 afr_opendir_cbk -> afr_examine_dir -> 2*n(?) 次 afr_examine_dir_readdir_cbk -> __checksums_differ? ->  afr_launch_self_heal. 

 

3. 发现stale subvolume时,且data_self_heal设置为open

 

afr_open_ftruncate_cbk / afr_open_cbk -> afr_open_only_data_self_heal (priv->data_self_heal)? 只有在这个data_self_heal设置为open时,才返回true. ->  afr_perform_data_self_heal -> afr_launch_self_heal.

 

4. 发现subvolume came online 时

 

在afr_open_fd_fix函数中,会比较当前subvolume与之前subvolume的个数,如果发现新增subvolume,就启动自修复

 

 

                if (fd_ctx->up_count < priv->up_count) {
                        need_self_heal = _gf_true;
                        fd_ctx->up_count   = priv->up_count;
                        fd_ctx->down_count = priv->down_count;
                }
....
        if (need_self_heal)
                afr_trigger_open_fd_self_heal (frame, this);
....
 

 

 

 

你可能感兴趣的:(过程)