Predicate names in the /state endpoint contain NULL characters

Report a Dgraph Bug

What version of Dgraph are you using?

21.03.0

Dgraph Version
$ dgraph version
 
Dgraph version   : v21.03.0
Dgraph codename  : rocket
Dgraph SHA-256   : b4e4c77011e2938e9da197395dbce91d0c6ebb83d383b190f5b70201836a773f
Commit SHA-1     : a77bbe8ae
Commit timestamp : 2021-04-07 21:36:38 +0530
Branch           : HEAD
Go version       : go1.16.2
jemalloc enabled : true

Have you tried reproducing the issue with the latest release?

This is the latest release.

What is the hardware spec (RAM, OS)?

Not relevant.

Steps to reproduce the issue (command/config used to run Dgraph).

Start a local Dgraph instance and fetch the /state endpoint: http://localhost:8080/state.

Expected behaviour and actual result.

The predicates are prefixed with NULL-characters:

{
  "counter": "25",
  "groups": {
    "1": {
      "members": {
        "1": {
          "id": "1",
          "groupId": 1,
          "addr": "localhost:7081",
          "leader": true,
          "amDead": false,
          "lastUpdate": "1619348857",
          "learner": false,
          "clusterInfoOnly": false,
          "forceGroupId": false
        }
      },
      "tablets": {
        "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000dgraph.drop.op": {
          "groupId": 1,
          "predicate": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000dgraph.drop.op",
          "force": false,
          "onDiskBytes": "0",
          "remove": false,
          "readOnly": false,
          "moveTs": "0",
          "uncompressedBytes": "0"
        },
        "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000dgraph.graphql.schema": {
          "groupId": 1,
          "predicate": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000dgraph.graphql.schema",
          "force": false,
          "onDiskBytes": "0",
          "remove": false,
          "readOnly": false,
          "moveTs": "0",
          "uncompressedBytes": "0"
        },
        "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000dgraph.graphql.xid": {
          "groupId": 1,
          "predicate": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000dgraph.graphql.xid",
          "force": false,
          "onDiskBytes": "0",
          "remove": false,
          "readOnly": false,
          "moveTs": "0",
          "uncompressedBytes": "0"
        },
...

These characters are not displayed, but string comparison fails.

At least the predicate strings should not contain any NULL characters, e.g.:

          "predicate": "dgraph.drop.op",

The prefix would be the namespace, the multi-tenancy feature added in v21.03.

1 Like

yep, these are a namespace thing. Ignore it, it will be polished soon. Also, we gonna hide those internal predicates.

So neither the tablets’ keys, nor the predicate value refer to a predicate name?