233933
From 713f55b4a5cc582d06a10a1c9a0cdf71a4636a10 Mon Sep 17 00:00:00 2001
233933
From: Atin Mukherjee <amukherj@redhat.com>
233933
Date: Mon, 15 Apr 2019 07:57:40 +0530
233933
Subject: [PATCH 093/124] glusterd: Change op-version of cache-invalidation in
233933
 quick-read
233933
233933
In upstream cache-invalidation option in quick read was introduced with
233933
4.0. There are two problems with it:
233933
233933
1. The key being made duplicate to md-cache xlator, so setting the same
233933
option actually enables this feature on both md-cache and quick-read.
233933
2. As the op-version tagged to this key was GD_OP_VERSION_4_0_0, with a RHGS
233933
3.5 cluster when a md-cache profile is set to a particular volume old
233933
client fails to mount which is wrong.
233933
233933
Solving 1 with out breaking backward compatibility in upstream is quite hard.
233933
This patch addresses both the problems in downstream by (a) changing the
233933
op-version to GD_OP_VERSION_6_0_0 and (b) renaming this key to
233933
quick-read-cache-invalidation. The fix is currently made downstream only till a
233933
proper solution is identified in upstream.
233933
233933
Label: DOWNSTREAM ONLY
233933
BUG: 1697820
233933
Change-Id: I1251424576d6ebbdb2a761400fd20f0aff0c80a2
233933
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
233933
Reviewed-on: https://code.engineering.redhat.com/gerrit/167823
233933
Reviewed-by: Amar Tumballi Suryanarayan <amarts@redhat.com>
233933
Tested-by: RHGS Build Bot <nigelb@redhat.com>
233933
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
233933
---
233933
 tests/basic/quick-read-with-upcall.t            |  1 +
233933
 xlators/mgmt/glusterd/src/glusterd-volume-set.c |  6 +++---
233933
 xlators/performance/quick-read/src/quick-read.c | 11 ++++++-----
233933
 3 files changed, 10 insertions(+), 8 deletions(-)
233933
233933
diff --git a/tests/basic/quick-read-with-upcall.t b/tests/basic/quick-read-with-upcall.t
233933
index 318e93a..647dacf 100644
233933
--- a/tests/basic/quick-read-with-upcall.t
233933
+++ b/tests/basic/quick-read-with-upcall.t
233933
@@ -58,6 +58,7 @@ EXPECT "$D0" cat $M1/test1.txt
233933
 sleep 60
233933
 EXPECT "$D1" cat $M1/test1.txt
233933
 
233933
+TEST $CLI volume set $V0 performance.quick-read-cache-invalidation on
233933
 TEST $CLI volume set $V0 performance.cache-invalidation on
233933
 
233933
 TEST write_to "$M0/test2.txt" "$D0"
233933
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
233933
index a877805..42ca9bb 100644
233933
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
233933
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
233933
@@ -1690,10 +1690,10 @@ struct volopt_map_entry glusterd_volopt_map[] = {
233933
      .option = "cache-timeout",
233933
      .op_version = 1,
233933
      .flags = VOLOPT_FLAG_CLIENT_OPT},
233933
-    {.key = "performance.cache-invalidation",
233933
+    {.key = "performance.quick-read-cache-invalidation",
233933
      .voltype = "performance/quick-read",
233933
-     .option = "cache-invalidation",
233933
-     .op_version = GD_OP_VERSION_4_0_0,
233933
+     .option = "quick-read-cache-invalidation",
233933
+     .op_version = GD_OP_VERSION_6_0,
233933
      .flags = VOLOPT_FLAG_CLIENT_OPT},
233933
     {.key = "performance.ctime-invalidation",
233933
      .voltype = "performance/quick-read",
233933
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
233933
index 244e8c8..59553c0 100644
233933
--- a/xlators/performance/quick-read/src/quick-read.c
233933
+++ b/xlators/performance/quick-read/src/quick-read.c
233933
@@ -1218,8 +1218,8 @@ qr_reconfigure(xlator_t *this, dict_t *options)
233933
 
233933
     GF_OPTION_RECONF("cache-timeout", conf->cache_timeout, options, int32, out);
233933
 
233933
-    GF_OPTION_RECONF("cache-invalidation", conf->qr_invalidation, options, bool,
233933
-                     out);
233933
+    GF_OPTION_RECONF("quick-read-cache-invalidation", conf->qr_invalidation,
233933
+                     options, bool, out);
233933
 
233933
     GF_OPTION_RECONF("ctime-invalidation", conf->ctime_invalidation, options,
233933
                      bool, out);
233933
@@ -1369,7 +1369,8 @@ qr_init(xlator_t *this)
233933
 
233933
     GF_OPTION_INIT("cache-timeout", conf->cache_timeout, int32, out);
233933
 
233933
-    GF_OPTION_INIT("cache-invalidation", conf->qr_invalidation, bool, out);
233933
+    GF_OPTION_INIT("quick-read-cache-invalidation", conf->qr_invalidation, bool,
233933
+                   out);
233933
 
233933
     GF_OPTION_INIT("cache-size", conf->cache_size, size_uint64, out);
233933
     if (!check_cache_size_ok(this, conf->cache_size)) {
233933
@@ -1615,10 +1616,10 @@ struct volume_options qr_options[] = {
233933
         .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
233933
     },
233933
     {
233933
-        .key = {"cache-invalidation"},
233933
+        .key = {"quick-read-cache-invalidation"},
233933
         .type = GF_OPTION_TYPE_BOOL,
233933
         .default_value = "false",
233933
-        .op_version = {GD_OP_VERSION_4_0_0},
233933
+        .op_version = {GD_OP_VERSION_6_0},
233933
         .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
233933
         .description = "When \"on\", invalidates/updates the metadata cache,"
233933
                        " on receiving the cache-invalidation notifications",
233933
-- 
233933
1.8.3.1
233933