[master] 0f7baca Disable deprecated persistent storage by default

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Mar 5 08:21:09 UTC 2018


commit 0f7baca494d06c07f9fc34e9594b36e8748f15b2
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Mar 5 09:17:33 2018 +0100

    Disable deprecated persistent storage by default

diff --git a/autogen.des b/autogen.des
index 6b75a76..0cc52dc 100755
--- a/autogen.des
+++ b/autogen.des
@@ -36,4 +36,5 @@ $SRCDIR/configure \
     --enable-developer-warnings \
     --enable-debugging-symbols \
     --enable-dependency-tracking \
+    --with-persistent-storage \
     "$@"
diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index 66907db..a135f80 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -91,15 +91,11 @@ varnishd_SOURCES = \
 	mgt/mgt_vcl.c \
 	proxy/cache_proxy_proto.c \
 	storage/mgt_stevedore.c \
-	storage/mgt_storage_persistent.c \
 	storage/stevedore.c \
 	storage/stevedore_utils.c \
 	storage/storage_file.c \
 	storage/storage_lru.c \
 	storage/storage_malloc.c \
-	storage/storage_persistent.c \
-	storage/storage_persistent_silo.c \
-	storage/storage_persistent_subr.c \
 	storage/storage_simple.c \
 	storage/storage_umem.c \
 	waiter/cache_waiter.c \
@@ -109,6 +105,14 @@ varnishd_SOURCES = \
 	waiter/cache_waiter_ports.c \
 	waiter/mgt_waiter.c
 
+if WITH_PERSISTENT_STORAGE
+varnishd_SOURCES += \
+	storage/mgt_storage_persistent.c \
+	storage/storage_persistent.c \
+	storage/storage_persistent_silo.c \
+	storage/storage_persistent_subr.c
+endif
+
 nodist_varnishd_SOURCES = \
 	builtin_vcl.c
 
diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index d1ab577..e2381a4 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -360,9 +360,11 @@ child_main(int sigmagic, size_t altstksz)
 
 	CLI_AddFuncs(debug_cmds);
 
+#if WITH_PERSISTENT_STORAGE
 	/* Wait for persistent storage to load if asked to */
 	if (FEATURE(FEATURE_WAIT_SILO))
 		SMP_Ready();
+#endif
 
 	CLI_Run();
 
diff --git a/bin/varnishd/storage/mgt_stevedore.c b/bin/varnishd/storage/mgt_stevedore.c
index 8ebfca2..ba7e5b1 100644
--- a/bin/varnishd/storage/mgt_stevedore.c
+++ b/bin/varnishd/storage/mgt_stevedore.c
@@ -92,6 +92,7 @@ static struct cli_proto cli_stv[] = {
 /*--------------------------------------------------------------------
  */
 
+#ifdef WITH_PERSISTENT_STORAGE
 static void v_matchproto_(storage_init_f)
 smp_fake_init(struct stevedore *parent, int ac, char * const *av)
 {
@@ -111,6 +112,7 @@ static const struct stevedore smp_fake_stevedore = {
 	.name = "deprecated_persistent",
 	.init = smp_fake_init,
 };
+#endif
 
 /*--------------------------------------------------------------------
  * Parse a stevedore argument on the form:
@@ -120,8 +122,10 @@ static const struct stevedore smp_fake_stevedore = {
 static const struct choice STV_choice[] = {
 	{ "file",			&smf_stevedore },
 	{ "malloc",			&sma_stevedore },
+#ifdef WITH_PERSISTENT_STORAGE
 	{ "deprecated_persistent",	&smp_stevedore },
 	{ "persistent",			&smp_fake_stevedore },
+#endif
 #if defined(HAVE_LIBUMEM)
 	{ "umem",			&smu_stevedore },
 	{ "default",			&smu_stevedore },
diff --git a/bin/varnishtest/tests/a00009.vtc b/bin/varnishtest/tests/a00009.vtc
index e4d0aa6..37565c7 100644
--- a/bin/varnishtest/tests/a00009.vtc
+++ b/bin/varnishtest/tests/a00009.vtc
@@ -23,10 +23,6 @@ shell "varnishd -x vsl > ${tmpdir}/_.vsl"
 shell "varnishd -x cli > ${tmpdir}/_.cli"
 shell "varnishd -x builtin > ${tmpdir}/_.builtin"
 
-shell -err -expect {-spersistent has been deprecated} {
-	varnishd -spersistent -f ''
-}
-
 shell -err -expect {-C needs either -b <backend> or -f <vcl_file>} {
 	varnishd -C
 }
@@ -50,3 +46,10 @@ shell -err -expect {-d makes no sense with -C} "varnishd -C -b 127.0.0.1:80 -d "
 shell -err -expect {-F makes no sense with -C} "varnishd -C -b 127.0.0.1:80 -F "
 shell -err -expect {Neither -b nor -f given} { varnishd -n ${tmpdir}/v0  }
 
+# This check is kept last because it may be skipped
+
+feature persistent_storage
+
+shell -err -expect {-spersistent has been deprecated} {
+	varnishd -spersistent -f ''
+}
diff --git a/bin/varnishtest/tests/p00000.vtc b/bin/varnishtest/tests/p00000.vtc
index a2cdc2c..e3d2302 100644
--- a/bin/varnishtest/tests/p00000.vtc
+++ b/bin/varnishtest/tests/p00000.vtc
@@ -1,5 +1,7 @@
 varnishtest "Test Basic persistence"
 
+feature persistent_storage
+
 server s1 {
 	rxreq
 	txresp
diff --git a/bin/varnishtest/tests/p00002.vtc b/bin/varnishtest/tests/p00002.vtc
index 44d6c26..77a393b 100644
--- a/bin/varnishtest/tests/p00002.vtc
+++ b/bin/varnishtest/tests/p00002.vtc
@@ -1,5 +1,7 @@
 varnishtest "Ban a persistent object"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per[12]"
 
 server s1 {
diff --git a/bin/varnishtest/tests/p00003.vtc b/bin/varnishtest/tests/p00003.vtc
index 1367fe8..9504393 100644
--- a/bin/varnishtest/tests/p00003.vtc
+++ b/bin/varnishtest/tests/p00003.vtc
@@ -1,5 +1,7 @@
 varnishtest "Ban a persistent object"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per"
 
 server s1 {
diff --git a/bin/varnishtest/tests/p00004.vtc b/bin/varnishtest/tests/p00004.vtc
index 4e7326f..986f7ec 100644
--- a/bin/varnishtest/tests/p00004.vtc
+++ b/bin/varnishtest/tests/p00004.vtc
@@ -1,5 +1,7 @@
 varnishtest "Check object references"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per"
 
 server s1 {
diff --git a/bin/varnishtest/tests/p00005.vtc b/bin/varnishtest/tests/p00005.vtc
index 7d46d40..353c930 100644
--- a/bin/varnishtest/tests/p00005.vtc
+++ b/bin/varnishtest/tests/p00005.vtc
@@ -1,5 +1,7 @@
 varnishtest "Check expiry of non-instantiated object"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per"
 
 server s1 {
diff --git a/bin/varnishtest/tests/p00006.vtc b/bin/varnishtest/tests/p00006.vtc
index 38e2993..dfec357 100644
--- a/bin/varnishtest/tests/p00006.vtc
+++ b/bin/varnishtest/tests/p00006.vtc
@@ -1,5 +1,7 @@
 varnishtest "Check that Vary headers are stored"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per"
 
 server s1 {
diff --git a/bin/varnishtest/tests/p00007.vtc b/bin/varnishtest/tests/p00007.vtc
index ddae80d..08c5c27 100644
--- a/bin/varnishtest/tests/p00007.vtc
+++ b/bin/varnishtest/tests/p00007.vtc
@@ -1,5 +1,7 @@
 varnishtest "test reload of object spanning incomplete segment"
 
+feature persistent_storage
+
 barrier b1 cond 2
 barrier b2 cond 2
 
diff --git a/bin/varnishtest/tests/p00008.vtc b/bin/varnishtest/tests/p00008.vtc
index c3973b4..cde88be 100644
--- a/bin/varnishtest/tests/p00008.vtc
+++ b/bin/varnishtest/tests/p00008.vtc
@@ -1,5 +1,7 @@
 varnishtest "Ban list sync across silos"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per[12]"
 
 # Silo 1 & 2
diff --git a/bin/varnishtest/tests/p00009.vtc b/bin/varnishtest/tests/p00009.vtc
index 184beca..6a53adf 100644
--- a/bin/varnishtest/tests/p00009.vtc
+++ b/bin/varnishtest/tests/p00009.vtc
@@ -1,5 +1,7 @@
 varnishtest "Check that reloaded bans with completed flag are really completed on restart"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per[12]"
 
 server s1 {
diff --git a/bin/varnishtest/tests/r00915.vtc b/bin/varnishtest/tests/r00915.vtc
index 1add7cd..794a994 100644
--- a/bin/varnishtest/tests/r00915.vtc
+++ b/bin/varnishtest/tests/r00915.vtc
@@ -1,5 +1,7 @@
 varnishtest "error object allocation with persistent"
 
+feature persistent_storage
+
 server s1 {
 	rxreq
 	txresp
diff --git a/bin/varnishtest/tests/r00962.vtc b/bin/varnishtest/tests/r00962.vtc
index 7f96219..84f5eea 100644
--- a/bin/varnishtest/tests/r00962.vtc
+++ b/bin/varnishtest/tests/r00962.vtc
@@ -1,5 +1,7 @@
 varnishtest "Test address remapping"
 
+feature persistent_storage
+
 feature disable_aslr
 
 # VM-remapping is too random on OSX
diff --git a/bin/varnishtest/tests/r01225.vtc b/bin/varnishtest/tests/r01225.vtc
index 2cbf448..607f786 100644
--- a/bin/varnishtest/tests/r01225.vtc
+++ b/bin/varnishtest/tests/r01225.vtc
@@ -1,5 +1,7 @@
 varnishtest "Test bans_req counter on persistent reload - #1225"
 
+feature persistent_storage
+
 shell "rm -f ${tmpdir}/_.per"
 
 server s1 {
diff --git a/bin/varnishtest/tests/r01266.vtc b/bin/varnishtest/tests/r01266.vtc
index 3d20685..f93f7a0 100644
--- a/bin/varnishtest/tests/r01266.vtc
+++ b/bin/varnishtest/tests/r01266.vtc
@@ -1,5 +1,7 @@
 varnishtest "#1266 - Check persisted truncated completed bans"
 
+feature persistent_storage
+
 # Test that bans which has been completed, truncated and persisted works
 
 shell "rm -f ${tmpdir}/_.per1"
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 4b90c2f..26a2002 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -714,13 +714,22 @@ cmd_delay(CMD_ARGS)
  *        Do not fail the test if a string of the form ${...} is not
  *        recognized as a macro.
  * term
- *	  Support for ADM3A terminal
+ *        Support for ADM3A terminal
+ *
+ * persistent_storage
+ *        Varnish was built with the deprecated persistent storage.
  *
  * Be careful with ignore_unknown_macro, because it may cause a test with a
  * misspelled macro to fail silently. You should only need it if you must
  * run a test with strings of the form "${...}".
  */
 
+#if WITH_PERSISTENT_STORAGE
+static const unsigned with_persistent_storage = 1;
+#else
+static const unsigned with_persistent_storage = 0;
+#endif
+
 static int
 test_term(struct vtclog *vl)
 {
@@ -787,6 +796,7 @@ cmd_feature(CMD_ARGS)
 		FEATURE("user_vcache", getpwnam("vcache") != NULL);
 		FEATURE("group_varnish", getgrnam("varnish") != NULL);
 		FEATURE("term", test_term(vl));
+		FEATURE("persistent_storage", with_persistent_storage);
 
 		if (!strcmp(*av, "disable_aslr")) {
 			good = 1;
diff --git a/configure.ac b/configure.ac
index 42ed74a..cf14412 100644
--- a/configure.ac
+++ b/configure.ac
@@ -372,6 +372,21 @@ else
 	ac_cv_func_port_create=no
 fi
 
+# --with-persistent-storage
+AC_ARG_WITH(persistent-storage,
+    AS_HELP_STRING([--with-persistent-storage],
+	[use deprecated persistent storage (default is NO)]),
+    [],
+    [with_persistent_storage=no])
+
+if test "$with_persistent_storage" = yes; then
+	AC_DEFINE([WITH_PERSISTENT_STORAGE], [1],
+		[Define to 1 to build the deprecated peristent storage.])
+fi
+
+AM_CONDITIONAL([WITH_PERSISTENT_STORAGE],
+	[test "$with_persistent_storage" = yes])
+
 AM_MISSING_HAS_RUN
 
 AC_CHECK_DECL([SO_ACCEPTFILTER],
diff --git a/doc/sphinx/phk/persistent.rst b/doc/sphinx/phk/persistent.rst
index 6587e67..2e0c40f 100644
--- a/doc/sphinx/phk/persistent.rst
+++ b/doc/sphinx/phk/persistent.rst
@@ -5,7 +5,8 @@ A persistent message
 ====================
 
 This message is about -spersistent and why you should not use it,
-even though it is still present in Varnish 4.x.
+even though it is still present in Varnish 4.x. Starting with Varnish
+6 it is only present when explicitly enabled at compile time.
 
 TL;DR:
 ------


More information about the varnish-commit mailing list