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