MINOR: pools: preset the allocation failure rate to 1% with -dMfail

Using -dMfail alone does nothing unless tune.fail-alloc is set, which
renders it pretty useless as-is, and is not intuitive. Let's change
this so that the filure rate is preset to 1% when the option is set on
the command line. This allows to inject failures without having to edit
the configuration.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index 446d1a2..0c22b82 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -2865,7 +2865,9 @@
   If compiled with DEBUG_FAIL_ALLOC or started with "-dMfail", gives the
   percentage of chances an allocation attempt fails. Must be between 0 (no
   failure) and 100 (no success). This is useful to debug and make sure memory
-  failures are handled gracefully.
+  failures are handled gracefully. When not set, the ratio is 0. However the
+  command-line "-dMfail" option automatically sets it to 1% failure rate so that
+  it is not necessary to change the configuration for testing.
 
 tune.fd.edge-triggered { on | off }  [ EXPERIMENTAL ]
   Enables ('on') or disables ('off') the edge-triggered polling mode for FDs
diff --git a/doc/management.txt b/doc/management.txt
index 94451b5..96bd30c 100644
--- a/doc/management.txt
+++ b/doc/management.txt
@@ -290,7 +290,8 @@
       - fail / no-fail:
         This enables randomly failing memory allocations, in conjunction with
         the global "tune.fail-alloc" setting. This is used to detect missing
-        error checks in the code.
+        error checks in the code. Setting the option presets the ratio to 1%
+        failure rate.
 
       - no-merge / merge:
         By default, pools of very similar sizes are merged, resulting in more
diff --git a/src/pool.c b/src/pool.c
index 4ea8d81..345681a 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -1080,10 +1080,16 @@
 				 */
 				if (dbg_options[v].flg == POOL_DBG_UAF)
 					new_dbg |= POOL_DBG_NO_CACHE;
+				/* fail should preset the tune.fail-alloc ratio to 1%  */
+				if (dbg_options[v].flg == POOL_DBG_FAIL_ALLOC)
+					mem_fail_rate = 1;
 				break;
 			}
 			else if (isteq(feat, ist(dbg_options[v].clr))) {
 				new_dbg &= ~dbg_options[v].flg;
+				/* no-fail should reset the tune.fail-alloc ratio */
+				if (dbg_options[v].flg == POOL_DBG_FAIL_ALLOC)
+					mem_fail_rate = 0;
 				break;
 			}
 		}