apple / foundationdb

FoundationDB - the open source, distributed, transactional key-value store
https://apple.github.io/foundationdb/
Apache License 2.0
14.33k stars 1.3k forks source link

Setting network option integer values via environment variables requires binary encoding #4127

Closed Daniel-B-Smith closed 2 years ago

Daniel-B-Smith commented 3 years ago

The network option setting code uses the default option code, which interprets the bytes passed to the option as a binary encoded 8 byte integer. The only way to set an integer value is to set the environment variable to the 8 byte binary encoding.

sfc-gh-abeamon commented 3 years ago

If we update the cpp option generation code here to include the argument type (o.paramType):

https://github.com/apple/foundationdb/blob/b69d0fa68e0d1b7b20e971cfbf3a66d21aa60132/fdbclient/vexillographer/cpp.cs#L51

And then update our FdbOptionInfo struct and macro to include the type:

https://github.com/apple/foundationdb/blob/b69d0fa68e0d1b7b20e971cfbf3a66d21aa60132/fdbclient/FDBOptions.h#L31 https://github.com/apple/foundationdb/blob/b69d0fa68e0d1b7b20e971cfbf3a66d21aa60132/fdbclient/FDBOptions.h#L99

We could then access the type information in the environment variable parsing code and have special logic for each type:

https://github.com/apple/foundationdb/blob/b69d0fa68e0d1b7b20e971cfbf3a66d21aa60132/fdbclient/MultiVersionTransaction.actor.cpp#L1369

vladdy commented 3 years ago

Can I try this one?