I am using recursive blocking requests on K/V API with the index
parameter.
When I do this kind of requests:
curl 'https://consul.example.com/v1/kv/path/to/my/folder?consistent=true&recurse=true&wait=5m&index=3753837'
I get an HTTP 200 OK response with these Consul HTTP headers:
- X-Consul-Default-Acl-Policy: deny
- X-Consul-Index: 10652800
- X-Consul-Knownleader: true
- X-Consul-Lastcontact: 0
- X-Consul-Query-Backend: blocking-query
What I would like to point at here is the returned X-Consul-Index
HTTP header value.
I am expecting the X-Consul-Index
HTTP header value to be the highest ModifyIndex
value of all the leaves under the monitored path.
If I use the returned X-Consul-Index
value as the index
parameter for my subsequent calls, I never get updated before the end of the wait
time since its value is way above the highest ModifyIndex
value of all the leaves under the monitored path.
When I run the following command:
curl 'https://consul.example.com/v1/kv/path/to/my/folder?consistent=true&recurse=true' | jq '.[] | { Key: .Key, CreateIndex: .CreateIndex, ModifyIndex: .ModifyIndex }'
Here is what I get:
{
"Key": "path/to/my/folder/MY_FIRST_VALUE",
"CreateIndex": 3018609,
"ModifyIndex": 4094393
}
{
"Key": "path/to/my/folder/MY_SECOND_VALUE",
"CreateIndex": 3074122,
"ModifyIndex": 3076151
}
Where does this 10652800
X-Consul-Index
value come from?
Why didn’t get I the 4094393
value?
I currently manage negative and going backwards X-Consul-Index
values.
How can I manage way over current index values?