Re: [PATCH] BUG/MINOR: Missing stat_field_names (since f21d17bb)

2019-09-13 Thread Willy TARREAU
Hi Adis,

On Fri, Sep 13, 2019 at 12:01:57PM +0200, Adis Nezirovic wrote:
> Hello guys,
> 
> We've noticed a recently introduced a bug introduced in commit f21d17bb
> where new stat fields were defined, without proper string names.

Argh, my bad, thanks for catching this one! I don't know how I managed
to commit the patch with this part missing :-(

I've just merged and backported it, hopefully still in time for 2.0.6 :-)

Willy



[PATCH] BUG/MINOR: Missing stat_field_names (since f21d17bb)

2019-09-13 Thread Adis Nezirovic

Hello guys,

We've noticed a recently introduced a bug introduced in commit f21d17bb 
where new stat fields were defined, without proper string names.


We've noticed this with Lua Proxy class, failed calls to get_stats(). It 
also affects CLI (show stat):


 ... cache_lookups,cache_hits,(null),(null),

The attached patch solves the issue.

Best regards
--
Adis Nezirovic
Software Engineer
HAProxy Technologies - Powering your uptime!
375 Totten Pond Road, Suite 302 | Waltham, MA 02451, US
+1 (844) 222-4340 | https://www.haproxy.com
>From 807d0285c4b2e436284219d99e3e8d6c5e2be004 Mon Sep 17 00:00:00 2001
From: Adis Nezirovic 
Date: Fri, 13 Sep 2019 11:43:03 +0200
Subject: [PATCH] BUG/MINOR: Missing stat_field_names (since f21d17bb)

Recently Lua code which uses Proxy class (get_stats method) stopped
working ("table index is nil from [C] method 'get_stats'")
It probably affects other codepaths too.

This should be backported do 2.0 and 1.9.
---
 src/stats.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/stats.c b/src/stats.c
index e59ad10bb..f44f5eef7 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -244,6 +244,8 @@ const char *stat_field_names[ST_F_TOTAL_FIELDS] = {
 	[ST_F_REUSE]  = "reuse",
 	[ST_F_CACHE_LOOKUPS]  = "cache_lookups",
 	[ST_F_CACHE_HITS] = "cache_hits",
+	[ST_F_SRV_ICUR]   = "srv_icur",
+	[ST_F_SRV_ILIM]   = "src_ilim"
 };
 
 /* one line of info */
-- 
2.23.0