Understanding bulk data loads, and bulk updates, with XID in v0.8

Hey guys,

I have a case where I will have multiple dgraph instances. Different instances will be the master of certain information. I need to periodically sync that info from one Dgraph instance to the other.

What I am trying to wrap my head around is how not only to load the data initially, but also perform updates, efficiently with UUIDS (or other unique strings) from origin DB to destination DB. Looking at this github issue: Support UUIDs in Dgraph · Issue #600 · dgraph-io/dgraph · GitHub, I see the last comment by @janardhan is:

we support xid natively now. Each xid would be assigned an unique uid internally.

But the current docs say:

As of version 0.8 Dgraph doesn’t natively support such external IDs as node identifiers. Instead, external IDs can be stored as properties of a node with an xid edge.

At the end of the day, I would like to do something like:

Initial bulk (or dgraphloader) Load:
_:newNode <Prop> "Initial Value"
_:newNode <xid> "0x123"

Subsequent dgraphloader (or normal mutation) with updated data:
<xid:[0x123]> <Prop> "Updated Value"

How would I accomplish this most efficiently with 0.8 features?

We don’t support XIDs natively, but we allow some level of support at client level. Therefore, dgraphloader and bulk loader, both maintain a local cache of XID → UID mapping.

If you have already loaded all the XIDs, then you could query for that XID, and mutate the data, using variables. You could also look into upsert operations, which got added recently, which do this atomically.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.