Multiple values for the GraphQL schema

Hi
I want to get export from my database

I use the following command:
curl localhost:8080/admin/export
i get this error
{“errors”:[{“message”:“Export failed.”,“extensions”:{“code”:“Export failed at readTs 30079: found multiple values for the GraphQL schema”}}]}

what’s the solution?

This might help you

Thank you for your answer

But I do not want to go export schema alone

I want to export all the database data and import it into another server

when use “curl localhost:8080/admin/export” in linux terminal get error

Hi @javadnasrollahi, can you share the logs of alpha if you are able to reproduce this error?

Hi @minhaj

Oct 11 12:36:23 rooot dgraph[4181]: I1011 12:36:23.174537    4206 log.go:34] Export Sent 0 keys
Oct 11 19:21:21 rooot dgraph[4181]: I1011 19:21:21.806834    4206 export.go:716] Got readonly ts from Zero: 30107
Oct 11 19:21:21 rooot dgraph[4181]: I1011 19:21:21.806898    4206 export.go:720] Requesting export for groups: [1]
Oct 11 19:21:21 rooot dgraph[4181]: I1011 19:21:21.806945    4206 export.go:394] Export requested at 30107.
Oct 11 19:21:21 rooot dgraph[4181]: I1011 19:21:21.809713    4206 export.go:400] Running export for group 1 at timestamp 30107.
Oct 11 19:21:21 rooot dgraph[4181]: I1011 19:21:21.810012    4206 export.go:421] Exporting data for group: 1 at /export/dgraph.r30107.u1011.1551/g01.rdf.gz
Oct 11 19:21:21 rooot dgraph[4181]: I1011 19:21:21.811699    4206 export.go:432] Exporting schema for group: 1 at /export/dgraph.r30107.u1011.1551/g01.schema.gz
Oct 11 19:21:21 rooot dgraph[4181]: I1011 19:21:21.812949    4206 export.go:443] Exporting GraphQL schema at /export/dgraph.r30107.u1011.1551/g01.gql_schema.gz
Oct 11 19:21:22 rooot dgraph[4181]: I1011 19:21:22.816147    4206 log.go:34] Export Time elapsed: 01s, bytes sent: 0 B, speed: 0 B/sec
Oct 11 19:21:23 rooot dgraph[4181]: E1011 19:21:23.144782    4206 export.go:739] Export failed at readTs 30107: found multiple values for the GraphQL schema
Oct 11 19:21:23 rooot dgraph[4181]: I1011 19:21:23.144819    4206 log.go:34] Export Sent 0 keys

Hi @javadnasrollahi, can you post the logs after updating the schema, or if this is not the case(you are not starting cluster afresh but the schema is already there), Can you post the logs of alpha at the time of start(little bit detailed). Since there is one bug similar to this and we believe it is unrelated to export (the problem might be in re-uploading the schema). We want to ensure if this is the case in your situation. Thanks.

hi @minhaj

Yes, please:

root@rooot:~# systemctl -n 500 status dga0.service
● dga0.service - dgraph alpha node 0
   Loaded: loaded (/etc/systemd/system/dga0.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2020-10-11 22:18:18 +0330; 2min 5s ago
 Main PID: 23884 (dgraph)
    Tasks: 28 (limit: 4915)
   CGroup: /system.slice/dga0.service
           ├─23884 /usr/local/bin/dgraph alpha --config /db/a0/config.json
           └─23911 /usr/local/bin/dgraph alpha --config /db/a0/config.json

Oct 11 22:18:18 rooot systemd[1]: Started dgraph alpha node 0.
Oct 11 22:18:18 rooot dgraph[23884]: [Decoder]: Using assembly version of decoder
Oct 11 22:18:18 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:18 Integration installed: ContextifyFrames
Oct 11 22:18:18 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:18 Integration installed: Environment
Oct 11 22:18:18 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:18 Integration installed: Modules
Oct 11 22:18:18 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:18 Integration installed: IgnoreErrors
Oct 11 22:18:18 rooot dgraph[23884]: [Decoder]: Using assembly version of decoder
Oct 11 22:18:19 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:19 Integration installed: ContextifyFrames
Oct 11 22:18:19 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:19 Integration installed: Environment
Oct 11 22:18:19 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:19 Integration installed: Modules
Oct 11 22:18:19 rooot dgraph[23884]: [Sentry] 2020/10/11 22:18:19 Integration installed: IgnoreErrors
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.870373   23911 init.go:99]
Oct 11 22:18:19 rooot dgraph[23884]: Dgraph version   : v20.03.3
Oct 11 22:18:19 rooot dgraph[23884]: Dgraph SHA-256   : 08424035910be6b6720570427948bab8352a0b5a6d59a0d20c3ec5ed29533121
Oct 11 22:18:19 rooot dgraph[23884]: Commit SHA-1     : fa3c19120
Oct 11 22:18:19 rooot dgraph[23884]: Commit timestamp : 2020-06-02 16:47:25 -0700
Oct 11 22:18:19 rooot dgraph[23884]: Branch           : HEAD
Oct 11 22:18:19 rooot dgraph[23884]: Go version       : go1.14.1
Oct 11 22:18:19 rooot dgraph[23884]: For Dgraph official documentation, visit https://docs.dgraph.io.
Oct 11 22:18:19 rooot dgraph[23884]: For discussions about Dgraph     , visit http://discuss.dgraph.io.
Oct 11 22:18:19 rooot dgraph[23884]: To say hi to the community       , visit https://dgraph.slack.com.
Oct 11 22:18:19 rooot dgraph[23884]: Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Oct 11 22:18:19 rooot dgraph[23884]: Copyright 2015-2020 Dgraph Labs, Inc.
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.870979   23911 run.go:608] x.Config: {PortOffset:0 QueryEdgeLimit:1000000 NormalizeNodeLimit:10000}
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.871022   23911 run.go:609] x.WorkerConfig: {ExportPath:export NumPendingProposals:256 Tracing:0.01 MyAddr:localhos
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.871076   23911 run.go:610] worker.Config: {PostingDir:/db/a0/p BadgerTables:mmap BadgerVlog:mmap BadgerKeyFile: Ba
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.871137   23911 server_state.go:75] Setting Badger Compression Level: 3
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.871158   23911 server_state.go:84] Setting Badger table load option: mmap
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.871167   23911 server_state.go:96] Setting Badger value log load option: mmap
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.871175   23911 server_state.go:141] Opening write-ahead log BadgerDB with options: {Dir:/db/a0/w ValueDir:/db/a0/w
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.879248   23911 log.go:34] All 1 tables opened in 1ms
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.881897   23911 log.go:34] Replaying file id: 4 at offset: 613754
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.881927   23911 log.go:34] Replay took: 7.285µs
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.882070   23911 server_state.go:75] Setting Badger Compression Level: 3
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.882090   23911 server_state.go:84] Setting Badger table load option: mmap
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.882118   23911 server_state.go:96] Setting Badger value log load option: mmap
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.882129   23911 server_state.go:164] Opening postings BadgerDB with options: {Dir:/db/a0/p ValueDir:/db/a0/p SyncWr
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.906597   23911 log.go:34] All 1 tables opened in 5ms
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.922307   23911 log.go:34] Replaying file id: 0 at offset: 31560118
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.922337   23911 log.go:34] Replay took: 7.178µs
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.923350   23911 groups.go:107] Current Raft Id: 0x1
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.923474   23911 worker.go:96] Worker listening at address: [::]:7080
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.924802   23911 run.go:480] Bringing up GraphQL HTTP API at 0.0.0.0:8080/graphql
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.924832   23911 run.go:481] Bringing up GraphQL HTTP admin API at 0.0.0.0:8080/admin
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.924870   23911 run.go:512] gRPC server started.  Listening on port 9080
Oct 11 22:18:19 rooot dgraph[23884]: I1011 22:18:19.924886   23911 run.go:513] HTTP server started.  Listening on port 8080
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.024323   23911 pool.go:160] CONNECTING to localhost:5080
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.031559   23911 groups.go:135] Connected to group zero. Assigned group: 0
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.031588   23911 groups.go:137] Raft Id after connection to Zero: 0x1
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.031997   23911 draft.go:200] Node ID: 0x1 with GroupID: 1
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.032024   23911 pool.go:160] CONNECTING to localhost:7080
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.032192   23911 node.go:148] Setting raft.Config to: &{ID:1 peers:[] learners:[] ElectionTick:20 HeartbeatTick:1 St
Oct 11 22:18:20 rooot dgraph[23884]: W1011 22:18:20.034098   23911 pool.go:254] Connection lost with localhost:7080. Error: rpc error: code = Unknown desc = No node h
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.035523   23911 node.go:306] Found Snapshot.Metadata: {ConfState:{Nodes:[1] Learners:[] XXX_unrecognized:[]} Index:
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.035793   23911 node.go:317] Found hardstate: {Term:4 Vote:1 Commit:14393 XXX_unrecognized:[]}
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.043236   23911 node.go:326] Group 1 found 2909 entries
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.043261   23911 draft.go:1544] Restarting node for group: 1
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.043381   23911 node.go:185] Setting conf state to nodes:1
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.044568   23911 log.go:34] 1 became follower at term 4
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.045571   23911 log.go:34] newRaft 1 [peers: [1], term: 4, commit: 14393, applied: 11484, lastindex: 14393, lastter
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.045620   23911 draft.go:147] Operation started with id: opRollup
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.045650   23911 groups.go:155] Server is ready
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.045742   23911 groups.go:782] Got address of a Zero leader: localhost:5080
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.045883   23911 draft.go:962] Found Raft progress: 14392
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.045883   23911 groups.go:796] Starting a new membership stream receive from localhost:5080.
Oct 11 22:18:20 rooot dgraph[23884]: I1011 22:18:20.048733   23911 groups.go:813] Received first state update from Zero: counter:3762 groups:<key:1 value:<members:<ke
Oct 11 22:18:23 rooot dgraph[23884]: I1011 22:18:23.846420   23911 log.go:34] 1 is starting a new election at term 4
Oct 11 22:18:23 rooot dgraph[23884]: I1011 22:18:23.846485   23911 log.go:34] 1 became pre-candidate at term 4
Oct 11 22:18:23 rooot dgraph[23884]: I1011 22:18:23.846500   23911 log.go:34] 1 received MsgPreVoteResp from 1 at term 4
Oct 11 22:18:23 rooot dgraph[23884]: I1011 22:18:23.847165   23911 log.go:34] 1 became candidate at term 5
Oct 11 22:18:23 rooot dgraph[23884]: I1011 22:18:23.847218   23911 log.go:34] 1 received MsgVoteResp from 1 at term 5
Oct 11 22:18:23 rooot dgraph[23884]: I1011 22:18:23.848561   23911 log.go:34] 1 became leader at term 5
Oct 11 22:18:23 rooot dgraph[23884]: I1011 22:18:23.849198   23911 log.go:34] raft.node: 1 elected leader 1 at term 5
Oct 11 22:18:24 rooot dgraph[23884]: I1011 22:18:24.046488   23911 groups.go:864] Leader idx=0x1 of group=1 is connecting to Zero for txn updates
Oct 11 22:18:24 rooot dgraph[23884]: I1011 22:18:24.046536   23911 groups.go:873] Got Zero leader: localhost:5080
Oct 11 22:18:24 rooot dgraph[23884]: I1011 22:18:24.937400   23911 admin.go:583] No GraphQL schema in Dgraph; serving empty GraphQL API
Oct 11 22:19:56 rooot dgraph[23884]: I1011 22:19:56.056607   23911 http.go:560] Got alter request via HTTP from 176.65.165.116:14619
Oct 11 22:19:56 rooot dgraph[23884]: I1011 22:19:56.057355   23911 server.go:137] Received ALTER op: schema:"<Balanced>: bool .\n<URL>: string .\n<URLL>: string .\n<U
Oct 11 22:19:56 rooot dgraph[23884]: I1011 22:19:56.060806   23911 server.go:268] Got schema: &{Preds:[predicate:"Balanced" value_type:BOOL  predicate:"URL" value_typ
Oct 11 22:19:56 rooot dgraph[23884]: I1011 22:19:56.071840   23911 draft.go:147] Operation started with id: opIndexing
Oct 11 22:19:56 rooot dgraph[23884]: I1011 22:19:56.072178   23911 draft.go:112] Operation completed with id: opRollup
Oct 11 22:19:56 rooot dgraph[23884]: I1011 22:19:56.089041   23911 draft.go:112] Operation completed with id: opIndexing
Oct 11 22:19:56 rooot dgraph[23884]: I1011 22:19:56.089139   23911 server.go:287] ALTER op: schema:"<Balanced>: bool .\n<URL>: string .\n<URLL>: string .\n<URLM>: str
Oct 11 22:20:06 rooot dgraph[23884]: I1011 22:20:06.089376   23911 draft.go:147] Operation started with id: opRollup
lines 36-93/93 (END)


Hey @javadnasrollahi

Here is a workaround that you can use for now while we get this bug figured out and fixed for you.

  1. Find out the uid of the node having the GraphQL schema and delete it. This query and mutation is a DQL query/mutation.
{
  me(func: has(dgraph.graphql.xid)) {
    uid
  }
}

Pickup the uid returned from the previous step and use it

{
	delete {
          <uid> * * .
        }
}
  1. Re upload your GraphQL schema using /admin/schema endpoint. If this doesn’t work directly then wait or a bit or restart your Alpha first.

I have some more questions that would help reproducing this issue.

  1. Are you using GraphQL and did you upload a GraphQL schema earlier? Seems like you don’t have a GraphQL schema so maybe you are not using it but I just want to confirm.
  2. Can you share the full logs of your Alpha instance?
  3. Did you use restore or drop_all operations?

Hi @pawan

I did what you said, but again my problem was not solved

The PR for this fix has been merged in master: fix(export): don't return an error if there was no GraphQL schema by abhimanyusinghgaur · Pull Request #6815 · dgraph-io/dgraph · GitHub.