Hi Will,

On Fri, Apr 12, 2013 at 06:42:27AM -0700, Will Glass-Husain wrote:
>  Hi -- sorry -- should have said.  This is haproxy 1.5dev18.

OK thanks for this report. Indeed I introduced a bug in dev12 10 months
ago, the type of change you begin in the evening and not totally complete...
Because of this, "clear table foo" would do the same as "show table foo".

Here's the fix, I've pushed it to the master branch.

Joe, you should probably test on your side if your scripts are still using
the feature, because it does not work without a key anymore.

Thanks!
willy

>From 20e993239d7a650b5545a49c556b14f4a735778b Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Sat, 13 Apr 2013 09:22:25 +0200
Subject: BUG/MINOR: cli: "clear table" did not work anymore without a key

Will Glass-Husain reported this breakage which was caused by commit
dec9814e merged in 1.5-dev12, and which was incomplete, resulting in
both "clear table" and "show table" to do the same thing.

No backport is needed.
---
 src/dumpstats.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/dumpstats.c b/src/dumpstats.c
index 0c3c2ae..8ee1eec 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -3946,17 +3946,19 @@ static void cli_release_handler(struct stream_interface 
*si)
        }
 }
 
-/* This function dumps all tables' states onto the stream interface's
- * read buffer. The xprt_ctx must have been zeroed first, and the flags
- * properly set. It returns 0 if the output buffer is full and it needs
- * to be called again, otherwise non-zero.
+/* This function is used to either dump tables states (when action is set
+ * to STAT_CLI_O_TAB) or clear tables (when action is STAT_CLI_O_CLR).
+ * The xprt_ctx must have been zeroed first, and the flags properly set.
+ * It returns 0 if the output buffer is full and it needs to be called
+ * again, otherwise non-zero.
  */
-static int stats_table_request(struct stream_interface *si, int show)
+static int stats_table_request(struct stream_interface *si, int action)
 {
        struct session *s = si->conn->xprt_ctx;
        struct ebmb_node *eb;
        int dt;
        int skip_entry;
+       int show = action == STAT_CLI_O_TAB;
 
        /*
         * We have 3 possible states in si->conn->xprt_st :
-- 
1.7.12.2.21.g234cd45.dirty

Reply via email to