ntdb: reduce default hashsize on ntdbtorture.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 19 Jun 2012 03:13:08 +0000 (12:43 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 19 Jun 2012 03:38:07 +0000 (05:38 +0200)
Just like tdbtorture, having a hashsize of 2 stresses us much more!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
lib/ntdb/tools/ntdbtorture.c

index d611563a7af52b494a0e97d98184e83b32d83fba..717f5dd1f506dfb846c8fe964eded3af8d975ba6 100644 (file)
@@ -46,6 +46,7 @@ static int loopnum;
 static int count_pipe;
 static union ntdb_attribute log_attr;
 static union ntdb_attribute seed_attr;
+static union ntdb_attribute hsize_attr;
 
 static void ntdb_log(struct ntdb_context *ntdb,
                    enum ntdb_log_level level,
@@ -247,7 +248,7 @@ static void usage(void)
 #if TRANSACTION_PROB
               " [-t]"
 #endif
-              " [-k] [-n NUM_PROCS] [-l NUM_LOOPS] [-s SEED] [-S]\n");
+              " [-k] [-n NUM_PROCS] [-l NUM_LOOPS] [-s SEED] [-S] [-H HASH_SIZE]\n");
        exit(0);
 }
 
@@ -364,9 +365,12 @@ int main(int argc, char * const *argv)
        log_attr.base.next = &seed_attr;
        log_attr.log.fn = ntdb_log;
        seed_attr.base.attr = NTDB_ATTRIBUTE_SEED;
-       seed_attr.base.next = NULL;
+       seed_attr.base.next = &hsize_attr;
+       hsize_attr.base.attr = NTDB_ATTRIBUTE_HASHSIZE;
+       hsize_attr.base.next = NULL;
+       hsize_attr.hashsize.size = 2; /* stress it by default. */
 
-       while ((c = getopt(argc, argv, "n:l:s:thkS")) != -1) {
+       while ((c = getopt(argc, argv, "n:l:s:thkSH:")) != -1) {
                switch (c) {
                case 'n':
                        num_procs = strtol(optarg, NULL, 0);
@@ -391,6 +395,9 @@ int main(int argc, char * const *argv)
                case 'k':
                        kill_random = 1;
                        break;
+               case 'H':
+                       hsize_attr.hashsize.size = strtol(optarg, NULL, 0);
+                       break;
                default:
                        usage();
                }