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