Mutation always get stuck and Timeout 。。。

@Ro0tk1t Like @chewxy, I could not reproduce this the error. I used rdf (data.rdf) and schema with indexes (data.schema) mentioned above, and using a similar vagrant environment to simulate your environment, I was able to successfully apply the mutation and schema them.

Apply schema

ALPHA="192.168.3.4:8080"

# data
curl --silent "$ALPHA/mutate?commitNow=true" \
  --header "Content-Type: application/rdf"  \
  --request POST \
  --data-binary "@data.rdf" | jq

# apply schema
curl "$ALPHA/alter" --silent \
  --request POST \
  --data-binary "@data.schema" | jq

Dump and verify schema

ALPHA="192.168.3.4:8080"
curl --silent "$ALPHA/query"\
  --header "Content-Type: application/dql" \
  --request POST  --data $'schema {}'

yields:

{"data":{"schema":[{"predicate":"APP","type":"uid","reverse":true,"list":true},{"predicate":"BACKEND","type":"uid","reverse":true,"list":true},{"predicate":"Cache-Control","type":"default"},{"predicate":"Connection","type":"default"},{"predicate":"Content-Length","type":"default"},{"predicate":"Content-Type","type":"default"},{"predicate":"DATABASE","type":"uid","reverse":true,"list":true},{"predicate":"Date","type":"default"},{"predicate":"Expires","type":"default"},{"predicate":"FAVICON","type":"uid","list":true},{"predicate":"FRONTEND","type":"uid","reverse":true,"list":true},{"predicate":"HEADERS","type":"uid","list":true},{"predicate":"IP","type":"uid","reverse":true,"list":true},{"predicate":"LANGUAGE","type":"uid","reverse":true,"list":true},{"predicate":"Location","type":"default"},{"predicate":"OS","type":"uid","reverse":true,"list":true},{"predicate":"PORT","type":"uid","reverse":true,"list":true},{"predicate":"PRODUCT","type":"uid","reverse":true,"list":true},{"predicate":"RESPONSE","type":"uid","reverse":true,"list":true},{"predicate":"SERVICE","type":"uid","reverse":true,"list":true},{"predicate":"Server","type":"default"},{"predicate":"TAG","type":"uid","reverse":true,"list":true},{"predicate":"TRANSPORT","type":"uid","reverse":true,"list":true},{"predicate":"VENDOR","type":"uid","reverse":true,"list":true},{"predicate":"app","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"asn","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"backend","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"body","type":"string","index":true,"tokenizer":["trigram"]},{"predicate":"data","type":"string"},{"predicate":"database","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"dgraph.drop.op","type":"string"},{"predicate":"dgraph.graphql.p_query","type":"string","index":true,"tokenizer":["sha256"]},{"predicate":"dgraph.graphql.schema","type":"string"},{"predicate":"dgraph.graphql.xid","type":"string","index":true,"tokenizer":["exact"],"upsert":true},{"predicate":"dgraph.type","type":"string","index":true,"tokenizer":["exact"],"list":true},{"predicate":"frontend","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"hash","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"idc","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"ip","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"isp","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"language","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"location","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"md5","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"os","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"port","type":"int","index":true,"tokenizer":["int"]},{"predicate":"product","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"response","type":"string","index":true,"tokenizer":["fulltext"],"upsert":true},{"predicate":"service","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"status_code","type":"int","index":true,"tokenizer":["int"]},{"predicate":"tag","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"tags","type":"uid","reverse":true,"list":true},{"predicate":"taskid","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"time","type":"datetime","index":true,"tokenizer":["month"]},{"predicate":"title","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"transport","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"type","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"url","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"uuid","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"uuids","type":"uid","reverse":true,"list":true},{"predicate":"vendor","type":"string","index":true,"tokenizer":["hash"]},{"predicate":"version","type":"string","index":true,"tokenizer":["hash"]}],"types":[{"fields":[{"name":"app"},{"name":"version"}],"name":"APP"},{"fields":[{"name":"backend"},{"name":"version"}],"name":"BACKEND"},{"fields":[{"name":"database"},{"name":"version"}],"name":"DATABASE"},{"fields":[{"name":"data"},{"name":"hash"},{"name":"location"}],"name":"FAVICON"},{"fields":[{"name":"frontend"},{"name":"version"}],"name":"FRONTEND"},{"fields":[{"name":"ip"},{"name":"type"},{"name":"isp"},{"name":"asn"},{"name":"idc"}],"name":"IP"},{"fields":[{"name":"language"},{"name":"version"}],"name":"LANGUAGE"},{"fields":[{"name":"os"},{"name":"version"}],"name":"OS"},{"fields":[{"name":"port"}],"name":"PORT"},{"fields":[{"name":"product"},{"name":"version"}],"name":"PRODUCT"},{"fields":[{"name":"url"},{"name":"md5"},{"name":"title"},{"name":"status_code"},{"name":"body"},{"name":"response"}],"name":"RESPONSE"},{"fields":[{"name":"service"},{"name":"version"}],"name":"SERVICE"},{"fields":[{"name":"tag"}],"name":"TAG"},{"fields":[{"name":"transport"}],"name":"TRANSPORT"},{"fields":[{"name":"uuid"},{"name":"time"},{"name":"taskid"}],"name":"UUID"},{"fields":[{"name":"vendor"}],"name":"VENDOR"},{"fields":[{"name":"dgraph.graphql.schema"},{"name":"dgraph.graphql.xid"}],"name":"dgraph.graphql"},{"fields":[{"name":"dgraph.graphql.p_query"}],"name":"dgraph.graphql.persisted_query"}]},"extensions":{"server_latency":{"parsing_ns":26590,"processing_ns":917826,"assign_timestamp_ns":6239776,"total_ns":9406401},"txn":{"start_ts":6},"metrics":{"num_uids":{"_total":0}}}}(3.9.0/e

Dgraph version and build environment

The dgraph version was built from release/v21.03 branch and commit SHA-1 is f9d045acd.

The dgraph binary was placed alongside the other files:

.
└── vagrant_env
    ├── data.rdf
    ├── data.schema
    ├── dgraph
    └── Vagrantfile

So, something like this to build and copy the binary over to Vagrant env:

cd ~/dgraph && git checkout release/v21.03 && git pull && make 
cp ~/dgraph/dgraph/dgraph ~/vagrant_env

cd ~/vagrant_env
vagrant up # see below

Vagrant environment v2

I used the similar vagrant environment mentioned in the other issue, but added provisioning to automate the setup:

@hosts = {"zero"=>"192.168.3.2", "alpha"=>"192.168.3.4"}

$script = <<-SCRIPT
[[ -f /vagrant/dgraph ]] && cp /vagrant/dgraph /usr/local/bin/dgraph

if [[ $1 == "zero" ]]; then
  COMMAND="/usr/local/bin/dgraph zero --bindall=true --my 192.168.3.2:5080 --raft idx=1 &"
  firewall-cmd --zone=public --permanent --add-port=5080/tcp
  firewall-cmd --zone=public --permanent --add-port=6080/tcp
  firewall-cmd --reload
elif [[ $1 == "alpha" ]]; then
  COMMAND="/usr/local/bin/dgraph alpha --bindall=true --zero=192.168.3.2:5080 -v 5 --my=192.168.3.4:7080 --security whitelist=192.168.3.1/16 &"
  firewall-cmd --zone=public --permanent --add-port=7080/tcp
  firewall-cmd --zone=public --permanent --add-port=8080/tcp
  firewall-cmd --zone=public --permanent --add-port=9080/tcp
  firewall-cmd --reload
fi

cat <<-EOF > /etc/rc.d/rc.local
#!/bin/bash
touch /var/lock/subsys/local
${COMMAND}
EOF

chmod +x /etc/rc.d/rc.local
sudo systemctl enable rc-local
sudo systemctl start rc-local
SCRIPT

Vagrant.configure("2") do |config|
  @hosts.each do |hostname, ipaddr|
    config.vm.define hostname do |node|
      node.vm.box = "generic/centos7"
      node.vm.hostname = "#{hostname}"
      node.vm.network "private_network", ip: ipaddr
      node.vm.synced_folder ".", "/vagrant"

      node.vm.provision "shell" do |shell|
        shell.inline = $script
        shell.args = [hostname]
        shell.privileged = true
      end
    end
  end
end

To use that environment:

## bring up 2 VMs + provision (firewall, rc.local for dgraph)
vagrant up 


## test health/state
ZERO="192.168.3.2:6080"
ALPHA="192.168.3.4:8080"
curl -s $ZERO/state | jq '.zeros."1"'
curl -s $ALPHA/health | jq '.[0]'