Tim,




First, not a a direct comment on your patches, but before I forget, I'd like to point out that there is one more thing which need fixing in regard to Lua variables:



  TXN.set_var(TXN, var, value)



where "var" is noted as:

  The var name according with the HAProxy syntax



However, nothing in the code checks that variable name is formed correctly (with correct prefix, such as "txn."), or that the rest of the variable name is correct.



Lua code using set_var() with wrong name silently fails, the variable is not set, and nothing is logged
.


With your proposal set_var() now can return result, and we could even log warning for "variable name syntax error".


---8<---

Now back on topic. Instead of adding more parameters to set_var(), I'd prefer a warning instead.



If someone is using set_var() from Lua, and that variable is never used or set in the rest of the config, we would know that. Additionally, one can set "zero-warning" option to prevent abuse by Lua scripts or to prevent bugs.

For your use case, maybe you could use maps from Lua? They should be backed by ebtree and be faster right?


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

Reply via email to