diff options
author | Jeff Darcy <jdarcy@fb.com> | 2017-09-27 13:18:25 -0700 |
---|---|---|
committer | Jeff Darcy <jdarcy@fb.com> | 2017-09-27 16:03:35 -0700 |
commit | d9f9be442808ed13135f560698a2f95fe66282a5 (patch) | |
tree | 2a18c75ca3c3ab59bf8f42381e48911a7744f9d6 /xlators/cluster/afr/src/afr.h | |
parent | e3e7c56323a21467e7e0a0d8f2adc5b05ce40a54 (diff) |
self-heal: fix automatic split-brain resolution options
Differential Revision: https://phabricator.intern.facebook.com/D5927193
Change-Id: Ife04c8738b9ee721e7be9bc843b2f6d54bbb468e
Diffstat (limited to 'xlators/cluster/afr/src/afr.h')
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 3314f865781..f6b8fa1b8b8 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -68,12 +68,16 @@ typedef int (*afr_changelog_resume_t) (call_frame_t *frame, xlator_t *this); uuid_utoa (local->inode->gfid)); \ } while (0) +/* + * These *must* be defined in order of decreasing precedence in order for + * afr_sh_get_fav_by_policy to work correctly. + */ typedef enum { - AFR_FAV_CHILD_NONE, - AFR_FAV_CHILD_BY_SIZE, - AFR_FAV_CHILD_BY_CTIME, + AFR_FAV_CHILD_NONE = 0, + AFR_FAV_CHILD_BY_MAJORITY, /* Highest precedence. */ AFR_FAV_CHILD_BY_MTIME, - AFR_FAV_CHILD_BY_MAJORITY, + AFR_FAV_CHILD_BY_CTIME, + AFR_FAV_CHILD_BY_SIZE, /* Lowest precedence. */ AFR_FAV_CHILD_POLICY_MAX, } afr_favorite_child_policy; @@ -136,8 +140,13 @@ typedef struct _afr_private { int favorite_child; /* subvolume to be preferred in resolving split-brain cases */ - afr_favorite_child_policy fav_child_policy;/*Policy to use for automatic - resolution of split-brains.*/ + /* + * Policy to use for automatic resolution of split-brains. This needs + * to be a bit-field so that we can iterate over multiple policies when + * earlier ones yield ties. The actual bits used are (1 << X) where X + * is one of the enum values from afr_favorite_child_policy. + */ + uint32_t fav_child_policy; gf_boolean_t inodelk_trace; gf_boolean_t entrylk_trace; |