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