libkv icon indicating copy to clipboard operation
libkv copied to clipboard

fix etcd list recursive

Open JeffChien opened this issue 10 years ago • 2 comments

current implementation only list first layer nodes.

while fixing this bug, encounter some other issues

  1. KVPair in zookeeper doesn't contain parent name as prefix
  2. storage.put behave does not consist between backends. for example, creating keys like a/b/c, etcd will automatically create a, b items so there will be 3 items, which consul and zookeeper doesn't, this lead to the second issue I encountered.
  3. testList test case is broken, the reason state above.

I think we have to fix the consistency of storage.put first before this PR get merged.

JeffChien avatar Nov 09 '15 07:11 JeffChien

Hi @JeffChien, thanks for hacking on libkv.

I think this is intended. recursive here means getting the direct child node values but not one level deeper.

If we want this behavior and truly list everything recursively (which is a super expensive operation), it should be parameterized with a bool recursive on List in my opinion.

Concerning point number 2, see #20, it is expected too because etcd manages directories differently. I think this PR can find its way if we pass recursive as an argument (to make it optional) and wait for the issue on Put to be fixed :)

abronan avatar Nov 09 '15 20:11 abronan

It will be great if List can have parameters. if libkv not allow recursively list keys, I think there some code should be changed.

  1. consul's List function, official go api enable recurse option, can't find a trivial way to disable it, maybe through http api?
  2. etcd's recursive should be false

the response of these commands return a recursive list, even we don't handle it.

again, thanks to your reply.

JeffChien avatar Nov 10 '15 09:11 JeffChien