[Gluster-devel] Sqlite3 dependency for Data Tiering

Niels de Vos ndevos at redhat.com
Wed Feb 18 08:02:02 UTC 2015


On Tue, Feb 17, 2015 at 09:22:02PM -0500, Joseph Fernandes wrote:
> Then there will be two things 
> 1) Update the this page http://www.gluster.org/community/documentation/index.php/CompilingRPMS#Common_Steps
> i.e add yum install sqlite3-devel 

Yes, correct

> 2) Modify configure.ac to check if the sqlite3-devel packages are installed before make.

I've shared the attached patch with Dan a few weeks back. It should get
you started on the configure.ac and Makefile.am changes. The patch is
very rough, and likely needs some changes, but you should get the idea.
My preference would be to be able to have sqlite as optional dependency.
When the dependency is not available (and disabled on the ./configure
commandline), tiering would not get build at all. Enabling the feature
by default would be good, many users will be interested in it.

When tiering is enabled, it should get packaged in the glusterfs-server
RPM, and the dependency on libsqlite3.so.X should get automagically get
added while building the RPMs.

> Is there something I am missing?

The Jenkins slaves will need the sqlite3-devel package installed too.
Get in touch with the gluster-infra at gluster.org list to request
installation of the sqlite3-devel packages.

Cheers,
Niels

> 
> ~Joe 
> 
> ----- Original Message -----
> From: "Justin Clift" <justin at gluster.org>
> To: "Joseph Fernandes" <josferna at redhat.com>
> Cc: "gluster Devel" <gluster-devel at gluster.org>, "Kaleb KEITHLEY" <kkeithle at redhat.com>, "Niels de Vos" <ndevos at redhat.com>
> Sent: Wednesday, February 18, 2015 7:35:48 AM
> Subject: Re: Sqlite3 dependency for Data Tiering
> 
> On 18 Feb 2015, at 01:59, Joseph Fernandes <josferna at redhat.com> wrote:
> > Hi Guys,
> > 
> > The upcoming Data tiering/Classification feature has a dependency on Sqlite3 Devel packages.
> > Could you please suggest me, how do I include sqlite3 devel packages automatically in
> > the GlusterFS upstream code.
> 
> It'll be a dependency in the .rpm/.deb/etc won't it?
> 
> If so, it *should* (in theory) be reasonably simple. :)
> 
> + Justin
> 
> --
> GlusterFS - http://www.gluster.org
> 
> An open source, distributed file system scaling to several
> petabytes, and handling thousands of clients.
> 
> My personal twitter: twitter.com/realjustinclift
-------------- next part --------------
>From df5119c08e5c73f59b4718cec3a4e2357aa56dce Mon Sep 17 00:00:00 2001
From: Niels de Vos <ndevos at redhat.com>
Date: Mon, 2 Feb 2015 19:30:31 +0100
Subject: [PATCH] build: enable/disable tiering support

Add a check for sqlite (via pkg-config) and define USE_GFDB and
BUILD_GFDB for enabling/disabling support for tiering.

Tiering is enabled by default, but building without tiering is made
possible by passing the --disable-tiering option to ./configure.

Signed-off-by: Niels de Vos <ndevos at redhat.com>
---
 configure.ac                                       | 20 +++++++++++++++
 libgfdb.pc.in                                      |  2 +-
 libglusterfs/src/gfdb/Makefile.am                  |  3 +++
 xlators/cluster/dht/src/Makefile.am                | 30 ++++++++++++++--------
 xlators/cluster/dht/src/dht-mem-types.h            |  8 ++++++
 xlators/cluster/dht/src/dht-rebalance.c            |  2 ++
 xlators/cluster/dht/src/dht-tier.h                 | 23 +++++++++++++++++
 .../features/changetimerecorder/src/Makefile.am    |  5 +++-
 8 files changed, 81 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6625acc..5f13492 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,6 +635,25 @@ AC_SUBST(ZLIB_CFLAGS)
 AC_SUBST(ZLIB_LIBS)
 # end CDC xlator secion
 
+# Data tiering requires sqlite
+AC_ARG_ENABLE([tiering],
+               AC_HELP_STRING([--disable-tiering],
+                              [Disable data classification/tiering]),
+              [BUILD_GFDB="${enableval}"], [BUILD_GFDB="no"])
+
+if test "x${BUILD_GFDB}" = "xyes"; then
+  PKG_CHECK_MODULES([SQLITE], [sqlite3],
+                    AC_DEFINE(USE_GFDB, 1),
+                    AC_MSG_ERROR([pass --disable-tiering to build without sqlite]))
+else
+  AC_DEFINE(USE_GFDB, 0, [no sqlite, gfdb is disabled])
+fi
+
+AC_SUBST(SQLITE_CFLAGS)
+AC_SUBST(SQLITE_LIBS)
+AM_CONDITIONAL(BUILD_GFDB, test "x${BUILD_GFDB}" = "xyes")
+AM_CONDITIONAL(USE_GFDB, test "x${BUILD_GFDB}" = "xyes")
+
 # check for systemtap/dtrace
 BUILD_SYSTEMTAP=no
 AC_MSG_CHECKING([whether to include systemtap tracing support])
@@ -1178,4 +1197,5 @@ echo "Use syslog           : $USE_SYSLOG"
 echo "XML output           : $BUILD_XML_OUTPUT"
 echo "QEMU Block formats   : $BUILD_QEMU_BLOCK"
 echo "Encryption xlator    : $BUILD_CRYPT_XLATOR"
+echo "Data Classification  : $BUILD_GFDB"
 echo
diff --git a/libgfdb.pc.in b/libgfdb.pc.in
index 01b0381..9163f30 100644
--- a/libgfdb.pc.in
+++ b/libgfdb.pc.in
@@ -7,5 +7,5 @@ includedir=@includedir@
 Name: libgfdb
 Description: GlusterFS Database Library
 Version: @LIBGFDB_VERSION@
-Libs: -L${libdir} -lgfchangedb -lglusterfs -lsqlite3
+Libs: -L${libdir} -lgfchangedb -lglusterfs @SQLITE_LIBS@
 Cflags: -I${includedir}/glusterfs/gfdb
diff --git a/libglusterfs/src/gfdb/Makefile.am b/libglusterfs/src/gfdb/Makefile.am
index bbb14f7..941db6c 100644
--- a/libglusterfs/src/gfdb/Makefile.am
+++ b/libglusterfs/src/gfdb/Makefile.am
@@ -10,7 +10,10 @@ libgfdb_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
 libgfdb_la_LDFLAGS = $(GF_LDFLAGS) -version-info $(LIBGLUSTERFS_LT_VERSION)
 
 libgfdbdir = $(includedir)/glusterfs/gfdb
+
+if BUILD_GFDB
 lib_LTLIBRARIES = libgfdb.la
+endif
 
 CONTRIB_BUILDDIR = $(top_builddir)/contrib
 
diff --git a/xlators/cluster/dht/src/Makefile.am b/xlators/cluster/dht/src/Makefile.am
index 8b87560..c7af101 100644
--- a/xlators/cluster/dht/src/Makefile.am
+++ b/xlators/cluster/dht/src/Makefile.am
@@ -1,7 +1,7 @@
-xlator_LTLIBRARIES = dht.la nufa.la switch.la tier.la
+xlator_LTLIBRARIES = dht.la nufa.la switch.la
 xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/cluster
 
-dht_common_source = dht-layout.c dht-helper.c dht-linkfile.c dht-rebalance.c dht-tier.c\
+dht_common_source = dht-layout.c dht-helper.c dht-linkfile.c dht-rebalance.c \
 	dht-selfheal.c dht-rename.c dht-hashfn.c dht-diskusage.c \
 	dht-common.c dht-inode-write.c dht-inode-read.c dht-shared.c \
 	$(top_builddir)/xlators/lib/src/libxlator.c
@@ -10,12 +10,22 @@ dht_la_SOURCES = $(dht_common_source) dht.c
 
 nufa_la_SOURCES = $(dht_common_source) nufa.c
 switch_la_SOURCES = $(dht_common_source) switch.c
-tier_la_SOURCES = $(dht_common_source) tier.c
 
 dht_la_LDFLAGS = -module -avoid-version
-dht_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
-		$(top_builddir)/libglusterfs/src/gfdb/libgfdb.la \
-		-lsqlite3
+dht_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+
+if USE_GFDB
+dht_common_source += dht-tier.c
+xlator_LTLIBRARIES += tier.la
+
+dht_la_LIBADD += $(top_builddir)/libglusterfs/src/gfdb/libgfdb.la \
+		$(SQLITE_LIBS)
+
+tier_la_SOURCES = $(dht_common_source) tier.c
+
+tier_la_LDFLAGS = -module -avoid-version
+tier_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+endif
 
 nufa_la_LDFLAGS = -module -avoid-version
 nufa_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
@@ -23,16 +33,16 @@ nufa_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
 switch_la_LDFLAGS = -module -avoid-version
 switch_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
 
-tier_la_LDFLAGS = -module -avoid-version
-tier_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-
 noinst_HEADERS = dht-common.h dht-mem-types.h dht-messages.h dht-helper.h dht-tier.h\
 	$(top_builddir)/xlators/lib/src/libxlator.h
 
 AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
-	-I$(top_srcdir)/libglusterfs/src/gfdb\
 	-I$(top_srcdir)/xlators/lib/src
 
+if USE_GFDB
+AM_CPPFLAGS += -I$(top_srcdir)/libglusterfs/src/gfdb
+endif
+
 AM_CFLAGS = -Wall $(GF_CFLAGS)
 
 CLEANFILES =
diff --git a/xlators/cluster/dht/src/dht-mem-types.h b/xlators/cluster/dht/src/dht-mem-types.h
index 5604a7d..62e5fe0 100644
--- a/xlators/cluster/dht/src/dht-mem-types.h
+++ b/xlators/cluster/dht/src/dht-mem-types.h
@@ -12,10 +12,18 @@
 #ifndef __DHT_MEM_TYPES_H__
 #define __DHT_MEM_TYPES_H__
 
+#if USE_GFDB
 #include "gfdb_mem-types.h"
+#else
+#include "mem-types.h"
+#endif
 
 enum gf_dht_mem_types_ {
+#if USE_GFDB
         gf_dht_mt_dht_du_t = gfdb_mt_end + 1,
+#else
+        gf_dht_mt_dht_du_t = gf_common_mt_end + 1,
+#endif
         gf_dht_mt_dht_conf_t,
         gf_dht_mt_char,
         gf_dht_mt_int32_t,
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 2616d37..dd7e923 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2167,6 +2167,7 @@ out:
         return 0;
 }
 
+#if USE_GFDB
 int
 gf_tier_status_get (gf_defrag_info_t *defrag, dict_t *dict)
 {
@@ -2270,6 +2271,7 @@ log:
 out:
         return 0;
 }
+#endif /* USE_GFDB */
 
 int
 gf_defrag_stop (gf_defrag_info_t *defrag, gf_defrag_status_t status,
diff --git a/xlators/cluster/dht/src/dht-tier.h b/xlators/cluster/dht/src/dht-tier.h
index 872df1d..f1ae716 100644
--- a/xlators/cluster/dht/src/dht-tier.h
+++ b/xlators/cluster/dht/src/dht-tier.h
@@ -15,6 +15,8 @@
 #include "config.h"
 #endif
 
+/* conditionally enable support for tiering */
+#if USE_GFDB
 
 /******************************************************************************/
 /* This is from dht-rebalancer.c as we dont have dht-rebalancer.h */
@@ -115,4 +117,25 @@ do {\
         }\
 } while (0);
 
+#else /* !USE_GFDB: no support for tiering */
+
+/* The functions here are placeholders that can be called when tiering is not
+ * enabled. This should make it easier to conditionally enable/disable tiering
+ * while building. */
+
+#warning TODO: check and correct the functions below
+
+static inline int
+gf_run_tier(xlator_t *this, gf_defrag_info_t *defrag)
+{
+        return ENOSYS;
+}
+
+static inline int
+gf_tier_status_get (gf_defrag_info_t *defrag, dict_t *dict)
+{
+        return ENOSYS;
+}
+
+#endif /* USE_GFDB */
 #endif
diff --git a/xlators/features/changetimerecorder/src/Makefile.am b/xlators/features/changetimerecorder/src/Makefile.am
index b124728..ffe9d87 100644
--- a/xlators/features/changetimerecorder/src/Makefile.am
+++ b/xlators/features/changetimerecorder/src/Makefile.am
@@ -1,4 +1,7 @@
+if BUILD_GFDB
 xlator_LTLIBRARIES = changetimerecorder.la
+endif
+
 xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features
 
 changetimerecorder_la_LDFLAGS = -module -avoid-version
@@ -9,7 +12,7 @@ changetimerecorder_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la\
 			$(top_builddir)/libglusterfs/src/gfdb/libgfdb.la\
 			$(top_builddir)/api/src/libgfapi.la\
 			$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la\
-			-lsqlite3
+			$(SQLITE_LIBS)
 
 noinst_HEADERS = changetimerecorder.h ctr_mem_types.h ctr-helper.h
 
-- 
2.1.0



More information about the Gluster-devel mailing list