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