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

predicate is not deleted from "_predicates_" #2484

Closed
makitka2007 opened this issue Jul 11, 2018 · 5 comments
Closed

predicate is not deleted from "_predicates_" #2484

makitka2007 opened this issue Jul 11, 2018 · 5 comments
Assignees
Labels
kind/bug Something is broken.

Comments

@makitka2007
Copy link

makitka2007 commented Jul 11, 2018

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

  • What version of Dgraph are you using?
    1.0.6

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

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

when I remove predicate - it doesn't disappear from _predicate_ field whereas actually it doesn't exist anymore.

POST localhost:8081/alter

entity_key: string @index(hash) .

POST localhost:8080/mutate

{
    set {
        _:entity1 <entity_key> "entity1" .
        _:entity2 <entity_key> "entity2" .
        _:entity1 <has> _:entity2 .
	}
}

{
    "data": {
        "code": "Success",
        "message": "Done",
        "uids": {
            "entity1": "0x7a",
            "entity2": "0x7b"
        }
    },
    "extensions": {
        "server_latency": {
            "parsing_ns": 9890,
            "processing_ns": 7999410
        },
        "txn": {
            "start_ts": 337,
            "commit_ts": 338,
            "lin_read": {
                "ids": {
                    "1": 329
                }
            }
        }
    }
}

POST localhost:8080/query

{
	result(func: eq(entity_key, "entity1")) {
		_predicate_
		has {
			uid
		}
	}
}

{
    "data": {
        "result": [
            {
                "_predicate_": [
                    "has",
                    "entity_key"
                ],
                "has": [
                    {
                        "uid": "0x7b"
                    }
                ]
            }
        ]
    },
    "extensions": {
        "server_latency": {
            "parsing_ns": 12686,
            "processing_ns": 119183,
            "encoding_ns": 397711
        },
        "txn": {
            "start_ts": 343,
            "lin_read": {
                "ids": {
                    "1": 330
                }
            }
        }
    }
}

POST localhost:8080/mutate

{
    delete {
        <0x7a> <has> <0x7b> .
	}
}

{
    "data": {
        "code": "Success",
        "message": "Done",
        "uids": {}
    },
    "extensions": {
        "server_latency": {
            "parsing_ns": 7024,
            "processing_ns": 4936211
        },
        "txn": {
            "start_ts": 344,
            "commit_ts": 345,
            "lin_read": {
                "ids": {
                    "1": 331
                }
            }
        }
    }
}

POST localhost:8080/query

{
	result(func: eq(entity_key, "entity1")) {
		_predicate_
		has {
			uid
		}
	}
}

{
    "data": {
        "result": [
            {
                "_predicate_": [
                    "has",
                    "entity_key"
                ]
            }
        ]
    },
    "extensions": {
        "server_latency": {
            "parsing_ns": 24228,
            "processing_ns": 142555,
            "encoding_ns": 408005
        },
        "txn": {
            "start_ts": 346,
            "lin_read": {
                "ids": {
                    "1": 332
                }
            }
        }
    }
}
  • Expected behaviour and actual result.
    "has" predicate should be removed from _predicate_
@makitka2007
Copy link
Author

tested on 1.0.6 - the same behaviour, so updated issue with that

@MichelDiz
Copy link
Contributor

MichelDiz commented Jul 14, 2018

I'm able to reproduce this, it seems to me related to #2212

If I do (this is after delete):

{

 result(func: eq(entity_key, "entity1")) {
   uid
   _predicate_
   entity_key
   has {expand(_all_)}
	}

 result2(func: has(has)) {
   uid
   _predicate_
   entity_key
   has {expand(_all_)}
      }
}

Returns:

{
  "data": {
    "result": [
      {
        "_predicate_": [
          "has",
          "entity_key"
        ],
        "uid": "0x5",
        "entity_key": "entity1"
      }
    ],
    "result2": [
      {
        "_predicate_": [
          "has",
          "entity_key"
        ],
        "uid": "0x5",
        "entity_key": "entity1"
      }
    ]
  }

before delete:

{
  "data": {
    "result": [
      {
        "_predicate_": [
          "has",
          "entity_key"
        ],
        "uid": "0x5",
        "entity_key": "entity1",
        "has": [
          {
            "entity_key": "entity2"
          }
        ]
      }
    ],
    "result2": [
      {
        "_predicate_": [
          "has",
          "entity_key"
        ],
        "uid": "0x5",
        "entity_key": "entity1",
        "has": [
          {
            "entity_key": "entity2"
          }
        ]
      }
    ]
  }

@MichelDiz MichelDiz added kind/bug Something is broken. investigate Requires further investigation labels Jul 14, 2018
@MichelDiz
Copy link
Contributor

This is partially fixed. By #2585 . In theory this fix would not have side effects with the existence of "ghost" predicates in the Node. But it still need to clean them.

A solution usage.

{
	result(func: has(has)) @filter(eq(entity_key, "entity1")) {
          entity_key
          uid
          has {
              uid
              }
          }
}

or

{
	result(func: eq(entity_key, "entity1") ) @filter(has(has)) {
          entity_key
          uid
          has {
              uid
              }
          }
}

@srfrog
Copy link
Contributor

srfrog commented Dec 13, 2018

The original issue with _predicate_ is cache related, which should be resolved soon. @MichelDiz your test will return an error in 1.0.11. I'm going to close this, but re-open if you reproduce sans _predicate_.

@srfrog srfrog closed this as completed Dec 13, 2018
@MichelDiz
Copy link
Contributor

erro: : Unhandled pb.node expand with parent has
Not sure what is this, but if I change to other predicate, works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something is broken.
Development

No branches or pull requests

3 participants