Add maxLeaseId to /state output when no data has been loaded

Moved from GitHub dgraph/5741

Posted by fl-max:

Experience Report

Note: Feature requests are judged based on user experience and modeled on Go Experience Reports. These reports should focus on the problems: they should not focus on and need not propose solutions.

What you wanted to do

Have the maxLeaseId key from the http://<zero_endpoint>:6080/state output be present, even when data has not been loaded. ie. maxLeaseId: -1

What you actually did

Deploy a new instance, checked that maxLeaseId was not greater than the maxLeaseId that I wanted to set on post-install. This key/value is not present.

Why that wasn’t great, with examples

When building logic workflows downstream of the Dgraph deployment, checking the maxLeaseId via curl -sS 'http://<zero_endpoint>:6080/state' | jq .maxLeaseId -r will return null when data has not been loaded.

I would propose that the above scenario return maxLeaseId: -1 instead. This has a number of advantages:

  • Schema is static (at least for this key)
  • We explicitly know a max has not been set yet
  • Single data type
  • Downstream workflows do not need to check for a null condition

Any external references to support your case