diff options
| author | Kaushal M <kaushal@redhat.com> | 2013-04-22 12:17:59 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2013-06-05 05:25:31 -0700 | 
| commit | 6cfc9c7f1d447451dc3d4af02a22058b861235eb (patch) | |
| tree | dabb67f7c93f7a97ee95e6c7b31b8c27267aac16 | |
| parent | 6cedf2d7a61aa3f26522033c0fb12467b7631dbc (diff) | |
glusterd: Set op-version on startup based on install status
This is a backport of change
        fa227c0 glusterd: Set op-version on startup based on install status
from master.
If the current installation of glusterfs doesn't have a stored
op-version and is,
a. a fresh install, then set op-version to maximum
b. an upgrade from release which didn't have op-version support, set it
to minimum.
The install status is detected using the peer-uuid.
If both peer-uuid and op-version are not present in the store, the
installation is fresh.
If peer-uuid is present, but op-version is absent in the store, the
installation has been upgraded from a version which didn't support
op-versions.
By setting the initial op-version as above, we can ensure that
a. features are not enabled accidentally during upgrades
b. a fresh install starts with all possible features enabled.
BUG: 954256
Change-Id: I5cdd0c63fd16ecfa2fede99684da6fd6167823a8
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5001
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 28 | 
1 files changed, 23 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 75f34c9c4f5..211f4a7de00 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -1739,11 +1739,29 @@ glusterd_restore_op_version (xlator_t *this)                  goto out;          } -        gf_log (this->name, GF_LOG_INFO, "op-version not found in store, " -                "setting it to minimum op-version : %d", GD_OP_VERSION_MIN); - -        /* If op-version is missing, set it to  GD_OP_VERSION_MIN */ -        conf->op_version = GD_OP_VERSION_MIN; +        /* op-version can be missing from the store file in 2 cases, +         * 1. This is a new install of glusterfs +         * 2. This is an upgrade of glusterfs from a version without op-version +         *    to a version with op-version (eg. 3.3 -> 3.4) +         * +         * Detection of a new install or an upgrade from an older install can be +         * done by checking for the presence of the its peer-id in the store +         * file.  If peer-id is present, the installation is an upgrade else, it +         * is a new install. +         * +         * For case 1, set op-version to GD_OP_VERSION_MAX. +         * For case 2, set op-version to GD_OP_VERSION_MIN. +         */ +        ret = glusterd_retrieve_uuid(); +        if (ret) { +                gf_log (this->name, GF_LOG_INFO, "Detected new install. Setting" +                        " op-version to maximum : %d", GD_OP_VERSION_MAX); +                conf->op_version = GD_OP_VERSION_MAX; +        } else { +                gf_log (this->name, GF_LOG_INFO, "Upgrade detected. Setting" +                        " op-version to minimum : %d", GD_OP_VERSION_MIN); +                conf->op_version = GD_OP_VERSION_MIN; +        }          ret = 0;  out:          return ret;  | 
