Deleted node appears after alpha restart

Report a Dgraph Bug

What version of Dgraph are you using?

Dgraph Version

Have you tried reproducing the issue with the latest release?

What is the hardware spec (RAM, OS)?


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

  1. Start Alpha and Zero with docker-compose:
version: "3.2"
    image: dgraph/dgraph:latest
      - /data/zero4:/dgraph4
      # - 5080:5080
      - 6084:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080 
    image: dgraph/dgraph:latest
      - /data/server17:/dgraph
      - ./hmac_secret_file:/dgraph/acl/hmac_secret_file
      - 8084:8080
      - 9084:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security whitelist=,,,,,,,,, --graphql lambda-url=http://lambda:8686/graphql-worker
  1. Create schema with node type:
type User @secret(field: "password") {
  id: ID!
  email: String! @id @search(by: [hash])
  1. Update schema
  2. Create a node of the User type:
curl --location --request POST 'localhost:8084/graphql' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"# Creation of the User1\nmutation {\n  addUser (input: {email:\"[email protected]\"}) {\n      user {\n          id \n          email\n      }\n  }\n}","variables":{}}'
  1. Delete a node of the type User from Ratel and check if the node is deleted:
upsert {  
  query {
    users as var (func: has(<dgraph.type>)) @filter(eq(<dgraph.type>, "User")) {
  mutation {
    delete {
      uid(users) * * .
  q(func: type(User)) {
  1. Shut down Alpha and Zero with docker-compose down
  2. Start Alpha and Zero with docker-compose up -d
  3. Go to Ratel and check if the deleted User node exists (keep trying several times)

Expected behavior and actual result.

  1. Deleted node appears.
    (some times it appears for just a period of time, but sometimes it stays. It will appear on any dgraph restart)
  2. GraphQL endpoint returns an error that schema does not exist after the restart.