cortoproject / corto

A hierarchical object store for connecting realtime machine data with web applications, historians & more
https://www.corto.io
MIT License
86 stars 14 forks source link

Recursive query on a mount from parent of mountpoint produces incorrect results #677

Open SanderMertens opened 6 years ago

SanderMertens commented 6 years ago

Recursive queries do not produce correct results when the result includes objects from a mount that is mounted on a child of the from clause. The following code demonstrates the scenario:

corto_mount m = corto_subscribe("//")
    .from("/data/mounted")
    .mount(corto_mount_o, NULL, NULL);

corto_select("//").from("/data").iter(&it)

The mount is matched when corto_select evaluates /data. When computing the relative mount query from /data and /data/mounted, the resulting from is set to ., which is correct. However, when a mount then returns an object with, for example, id x, this id is then added to the corto_select location as /data/x and not /data/mounted/x.

When computing the next mount query, the relative parent from /data/x and /data/mounted will still evaluate to ., which results in the exact same query being made to the mount. This process will repeat a few times which eventually yields undefined results.