Fdbcli option usage: "option on TIMEOUT 0" results in error 2006

Looking for an example for how to properly use options in fdbcli or a (probably simple) explanation for why the following straightforward command results in an error:

fdbcli --exec "option on TIMEOUT 0; getrange \x00 \xFF"
>>> option on TIMEOUT 0
Option enabled for all transactions
>>> getrange \x00 \xff
ERROR: Option set with an invalid value (2006)

Interesting. What seems to be happening is that options take byte strings as their parameter, and in this case the value “0” is being passed in as a byte string. The option code tries to interpret the byte string as an 8-byte little endian integer and that of course fails.

It works if you instead try:

option on TIMEOUT \x00\x00\x00\x00\x00\x00\x00\x00

Of course, that’s a bit awkward. I’m not sure I’ve ever tried to set a numeric option in fdbcli, so I hadn’t really ever considered that it would behave this way.

For the specific case of setting a timeout, though, we have an option that you can pass in (which is for some reason undocumented) called --timeout, and it only works with --exec. For example:

fdbcli --exec "getrange \x00 \xff" --timeout 5

The default behavior is to have no timeout, so if you want the value 0 you don’t need to do anything special.

1 Like