[master] 2f991e1 Require all storage to be at least 1M

Tollef Fog Heen tfheen at varnish-cache.org
Wed May 11 12:06:03 CEST 2011


commit 2f991e163c6d9a93f94246ea8e6587139ea39cb5
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Wed May 11 09:56:58 2011 +0200

    Require all storage to be at least 1M
    
    It does not make sense to specify less that 1M of storage, so error
    out if a user specifies -smalloc,512 for instance.  They probably
    meant -smalloc,512M, but require them to be explicit.
    
    Adjust C00027 test case to match

diff --git a/bin/varnishd/stevedore_utils.c b/bin/varnishd/stevedore_utils.c
index 1a4227c..8242df8 100644
--- a/bin/varnishd/stevedore_utils.c
+++ b/bin/varnishd/stevedore_utils.c
@@ -201,6 +201,10 @@ STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx)
 
 		if (q != NULL)
 			ARGV_ERR("(%s) size \"%s\": %s\n", size, ctx, q);
+
+		if (l < 1024*1024)
+			ARGV_ERR("(-spersistent) size \"%s\": too small, "
+				 "did you forget to specify M or G?\n", size);
 	}
 
 	/*
diff --git a/bin/varnishd/storage_malloc.c b/bin/varnishd/storage_malloc.c
index 658ca6e..5cd6b84 100644
--- a/bin/varnishd/storage_malloc.c
+++ b/bin/varnishd/storage_malloc.c
@@ -187,6 +187,9 @@ sma_init(struct stevedore *parent, int ac, char * const *av)
 		ARGV_ERR("(-smalloc) size \"%s\": %s\n", av[0], e);
 	if ((u != (uintmax_t)(size_t)u))
 		ARGV_ERR("(-smalloc) size \"%s\": too big\n", av[0]);
+	if (u < 1024*1024)
+		ARGV_ERR("(-smalloc) size \"%s\": too small, "
+			 "did you forget to specify M or G?\n", av[0]);
 
 	printf("SMA.%s: max size %ju MB.\n", parent->ident,
 	    u / (1024 * 1024));
diff --git a/bin/varnishtest/tests/c00027.vtc b/bin/varnishtest/tests/c00027.vtc
index 5f49fcb..62d0716 100644
--- a/bin/varnishtest/tests/c00027.vtc
+++ b/bin/varnishtest/tests/c00027.vtc
@@ -18,7 +18,7 @@ server s1 {
 	txresp -body "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
 } -start
 
-varnish v1 -arg "-s malloc,40k" -vcl+backend {
+varnish v1 -arg "-s malloc,1M" -vcl+backend {
 	sub vcl_fetch { 
 		set beresp.ttl = 10m; 
 	}



More information about the varnish-commit mailing list