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