How to drop predicate data

Following the doc here https://dgraph.io/docs/v1.2.2/clients/#alter-the-database-1, i drop my predicate data with

 curl -X POST localhost:8080/alter -d '{"drop_attr": "useGps"}'

Then It shows

{"data":{"code":"Success","message":"Done"}}

But it’s still there when i call

curl localhost:8080/state

Data is still there and disk usages never reduce. Does anyone know why.

Tagging @ibrahim who worked on this recently and can help with this.

@ibrahim can you help me with this problem

@JimWen The data won’t be removed from disk when you drop/delete anything. The delete operation is logical which means a new entry with delete marker will be added and it will be eventually removed (along with the older keys) by compaction/garbage collection. In simple words, the disk usage won’t be affected instantly by the drop operation.

As for the data showing up in the /state endpoint, that shouldn’t happen. Which version of dgraph are you using? Can you share some logs? It might be possible that the state endpoint is reporting stale data.

Thank you, the version is v1.2.3.
here is the log file bx-bossnlpgraphdbaction-02_202005271543_my.log (24.3 KB)

@JimWen This looks like a bug. Please file an issue on github. We’ll get it fixed soon.

The data was dropped but it looks like state endpoint was still showing it.

Sorry for late reply, i will try this problem on the latest version.

@ibrahim @JimWen is there a released fix for this issue ?
Today I’ve tried to remove one predicate but the state still show me the deleted one (which not show anymore in schema {} query)
I’ve deleted on both my staging (v20.11.3) and production (v20.11.3) server and both of them act the same. I’ve waited for more than one house and it still appear in /state.

I’ve forgotten to monitor disk usage before remove so still wonder its really cleanup space or not

I think yours might be a separate issue. Can you wait for the states to sync up?

My predicate size is 1.2GB, can we estimate how long the state will sync ?
Already around 10 hours when I removed the predicate and the state still show the same (I’ve changed to other machine so definitely no client/HTTP cache here)

hmm definitely something odd. Do you want to jump on a call?

1 Like

Sorry for late reply, I’ve been quite busy few days. I’ve direct message you about call schedule.