From bd3c250eb91e82ad5ebf12020a1bcda25dd1a5cb Mon Sep 17 00:00:00 2001
From: Poornima G <pgurusid@redhat.com>
Date: Wed, 1 Feb 2017 17:11:46 +0530
Subject: [PATCH 284/285] extras: Provide group set for md-cache and
invalidation options
To enable the integration of md-cache and invalidation features
we need to perform 3 volume set options in a specific order.
In order to ease this for user provide a group volume set option.
Usage: gluster vol set <VOLNAME> group metadata-cache
>Reviewed-on: https://review.gluster.org/16503
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
>Signed-off-by: Poornima G <pgurusid@redhat.com>
Change-Id: I9bf0fd4217aa2a1c7ffbdc93e879b10f87addeac
BUG: 1417955
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/96839
Reviewed-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
extras/Makefile.am | 4 +++-
extras/group-metadata-cache | 6 ++++++
glusterfs.spec.in | 5 +++++
tests/basic/md-cache/bug-1418249.t | 20 ++++++++++++++++++++
4 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 extras/group-metadata-cache
create mode 100755 tests/basic/md-cache/bug-1418249.t
diff --git a/extras/Makefile.am b/extras/Makefile.am
index 37b297f..4555d34 100644
--- a/extras/Makefile.am
+++ b/extras/Makefile.am
@@ -9,7 +9,7 @@ SUBDIRS = init.d systemd benchmarking hook-scripts $(OCF_SUBDIR) LinuxRPM \
confdir = $(sysconfdir)/glusterfs
conf_DATA = glusterfs-logrotate gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.conf \
- logger.conf.example glusterfs-georep-logrotate group-virt.example
+ logger.conf.example glusterfs-georep-logrotate group-virt.example group-metadata-cache
voldir = $(sysconfdir)/glusterfs
vol_DATA = glusterd.vol
@@ -33,3 +33,5 @@ install-data-local:
$(mkdir_p) $(DESTDIR)$(GLUSTERD_WORKDIR)/groups
$(INSTALL_DATA) $(top_srcdir)/extras/group-virt.example \
$(DESTDIR)$(GLUSTERD_WORKDIR)/groups/virt
+ $(INSTALL_DATA) $(top_srcdir)/extras/group-metadata-cache \
+ $(DESTDIR)$(GLUSTERD_WORKDIR)/groups/metadata-cache
diff --git a/extras/group-metadata-cache b/extras/group-metadata-cache
new file mode 100644
index 0000000..0f780eb
--- /dev/null
+++ b/extras/group-metadata-cache
@@ -0,0 +1,6 @@
+features.cache-invalidation=on
+features.cache-invalidation-timeout=600
+performance.stat-prefetch=on
+performance.cache-invalidation=on
+performance.md-cache-timeout=600
+network.inode-lru-limit=50000
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 9b29de3..be1865e 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1042,6 +1042,7 @@ exit 0
%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-5.8.conf
%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-7.2.conf
%exclude %{_sysconfdir}/glusterfs/group-virt.example
+%exclude %{_sysconfdir}/glusterfs/group-metadata-cache
%exclude %{_sysconfdir}/glusterfs/logger.conf.example
%exclude %_init_glusterd
%exclude %{_sysconfdir}/sysconfig/glusterd
@@ -1357,6 +1358,7 @@ exit 0
%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/bitd
%dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/groups
%attr(0644,-,-) %{_sharedstatedir}/glusterd/groups/virt
+ %attr(0644,-,-) %{_sharedstatedir}/glusterd/groups/metadata-cache
%dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/glusterfind
%dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/glusterfind/.keys
%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/glustershd
@@ -2046,6 +2048,9 @@ end
%endif
%changelog
+* Wed Feb 1 2017 Poornima G <pgurusid@redhat.com>
+- Install /var/lib/glusterd/groups/metadata-cache by default
+
* Thu Dec 7 2016 Jiffin Tony Thottan <jhottan@redhat.com>
- remove S31ganesha-reset.sh from hooks (#1397450)
diff --git a/tests/basic/md-cache/bug-1418249.t b/tests/basic/md-cache/bug-1418249.t
new file mode 100755
index 0000000..119a6ae
--- /dev/null
+++ b/tests/basic/md-cache/bug-1418249.t
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup;
+
+TEST glusterd
+
+TEST $CLI volume create $V0 $H0:$B0/$V0
+TEST $CLI volume start $V0
+
+TEST $CLI volume set $V0 group metadata-cache
+EXPECT 'on' volinfo_field $V0 'performance.cache-invalidation'
+EXPECT '600' volinfo_field $V0 'performance.md-cache-timeout'
+EXPECT 'on' volinfo_field $V0 'performance.stat-prefetch'
+EXPECT '600' volinfo_field $V0 'features.cache-invalidation-timeout'
+EXPECT 'on' volinfo_field $V0 'features.cache-invalidation'
+EXPECT '50000' volinfo_field $V0 'network.inode-lru-limit'
+cleanup;
--
2.9.3