Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot re-import exported rdf/schema with special-character predicate names #2925

Closed
danielmai opened this issue Jan 23, 2019 · 0 comments
Closed
Assignees
Labels
exp/beginner Something most people could solve. kind/bug Something is broken.

Comments

@danielmai
Copy link
Contributor

If you suspect this could be a bug, follow the template.

  • What version of Dgraph are you using?
    v1.0.12-rc5

  • Have you tried reproducing the issue with latest release?
    yes

  • What is the hardware spec (RAM, OS)?
    n/a

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

  1. Run a Dgraph cluster.
  2. Run a mutation with predicates that have special characters:
{
  set {
    _:a <pred/slash> "1" .
    _:b <pred*star> "2" .
  }
}
  1. Export the data with /admin/export. The schema file has the following lines:
pred*star:default . 
pred/slash:default . 
  1. Run the live loader with the rdf and schema file from the export:
$ dgraph live -r ./g01.rdf.gz -s ./g01.schema.gz -d localhost:9080 -z localhost:5080
...
Processing ./g01.schema.gz
Error while processing schema file "./g01.schema.gz": rpc error: code = Unknown desc = Missing colon

We can repeat the same steps with IRI-named predicates which results in a similar but different error. e.g. this mutation:

{
  set {
    _:c <故障> "3" .
  }
}

The exported schema file will contain:

故障:default . 

And the live load will show this error:

Processing ./g01.schema.gz
Error while processing schema file "./dgraph.r48.u0123.0232/g01.schema.gz": rpc error: code = Unknown desc = while lexing 故障:default . 

: Invalid schema. Unexpected 故
  • Expected behavior

I expect that an export can be imported as-is without any modifications.

  • Additional comments

The schema update works if I modify the exported schema file by surrounding the predicate names with <>.

<pred*star>:default . 
<pred/slash>:default . 
<故障>:default . 
@codexnull codexnull self-assigned this Jan 23, 2019
@codexnull codexnull added the kind/bug Something is broken. label Jan 23, 2019
@codexnull codexnull added the exp/beginner Something most people could solve. label Jan 24, 2019
codexnull added a commit that referenced this issue Jan 24, 2019
Fixes #2925.

* Add angle brackets to more exported predicates.

* Add more predicate export tests.
dna2github pushed a commit to dna2fork/dgraph that referenced this issue Jul 19, 2019
Fixes dgraph-io#2925.

* Add angle brackets to more exported predicates.

* Add more predicate export tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/beginner Something most people could solve. kind/bug Something is broken.
Development

No branches or pull requests

2 participants