MCPcopy
hub / github.com/dgraph-io/dgraph / InsertDropRecord

Function InsertDropRecord

edgraph/server.go:338–351  ·  view source on GitHub ↗

InsertDropRecord is used to insert a helper record when a DROP operation is performed. This helper record lets us know during backup that a DROP operation was performed and that we need to write this information in backup manifest. So that while restoring from a backup series, we can create an exact

(ctx context.Context, dropOp string)

Source from the content-addressed store, hash-verified

336// then restoring from the incremental backup of such a DB would restore even the dropped
337// data back. This is also used to capture the delete namespace operation during backup.
338func InsertDropRecord(ctx context.Context, dropOp string) error {
339 _, err := (&Server{}).doQuery(context.WithValue(ctx, IsGraphql, true), &Request{
340 req: &api.Request{
341 Mutations: []*api.Mutation{{
342 Set: []*api.NQuad{{
343 Subject: "_:r",
344 Predicate: "dgraph.drop.op",
345 ObjectValue: &api.Value{Val: &api.Value_StrVal{StrVal: dropOp}},
346 }},
347 }},
348 CommitNow: true,
349 }, doAuth: NoAuthorize})
350 return err
351}
352
353// Alter handles requests to change the schema or remove parts or all of the
354// data. It enforces the admin-IP-whitelist and ACL authorization checks.

Callers 2

resolveDeleteNamespaceFunction · 0.92
alterMethod · 0.85

Calls 1

doQueryMethod · 0.80

Tested by

no test coverage detected