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

fix(backup/restore): fixes backup and restore with DROP operations (GRAPHQL-735) #6844

Merged
merged 16 commits into from
Nov 9, 2020

Conversation

abhimanyusinghgaur
Copy link
Contributor

@abhimanyusinghgaur abhimanyusinghgaur commented Nov 4, 2020

Fixes GRAPHQL-735.
See RFC for more details.


This change is Reviewable

Docs Preview: Dgraph Preview

@github-actions github-actions bot added the area/schema Issues related to the schema language and capabilities. label Nov 4, 2020
Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got some comments.

worker/backup_processor.go Outdated Show resolved Hide resolved
worker/backup_processor.go Outdated Show resolved Hide resolved
worker/backup_ee.go Outdated Show resolved Hide resolved
worker/backup_ee.go Outdated Show resolved Hide resolved
worker/backup_ee.go Show resolved Hide resolved
@abhimanyusinghgaur abhimanyusinghgaur changed the title fix(backup/restore): fixes backup and restore with DROP operations fix(backup/restore): fixes backup and restore with DROP operations (GRAPHQL-735) Nov 6, 2020
Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 15 of 26 files at r1, 6 of 13 files at r2, 15 of 15 files at r3.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @abhimanyusinghgaur, @jarifibrahim, @manishrjain, @MichaelJCompton, and @vvbalaji-dgraph)


edgraph/server.go, line 339 at r3 (raw file):

		}

		// insert a helper record for backup & restore, indicating that drop_all was done

Add a comment that if the server crashes before storing this, that would be an issue.


protos/pb.proto, line 613 at r3 (raw file):

	}
	DropOp drop_op    = 1;
	string drop_value = 2;

Add a comment that this would only be present when DropOp is ATTR.


systest/online-restore/online_restore_test.go, line 587 at r3 (raw file):

	// remove backup directories to make sure this test doesn't leave anything behind
	// TODO: This is having some problem on TeamCity
	//cleanupDirs(t, localFsDirs)

Can you create a JIRA ticket to look into it when you come back?


worker/backup_ee.go, line 173 at r3 (raw file):

	defer cancel()

	resOrErrCh := make(chan interface{}, len(state.Groups))

type backupRes {
res *BackupResponse
err error
}

chan backupRes


worker/backup_ee.go, line 190 at r3 (raw file):

	var dropOperations []*pb.DropOperation
	for range groups {
		if resOrErr := <-resOrErrCh; resOrErr != nil {

res.err != nil


worker/backup_processor.go, line 136 at r3 (raw file):

		tl := pr.threads[itr.ThreadId]
		tl.alloc = stream.Allocator(itr.ThreadId)
		kvList, dropOp, err := tl.toBackupList(key, itr)

if err != nil {
return nil, err
}
// append
// return kvList, nil


worker/backup_processor.go, line 346 at r3 (raw file):

		val, ok := vals[0].Value.([]byte)
		if !ok {
			return nil, errors.Errorf("cannot convert value of dgraph.drop.op to byte array, "+

Also, add the value that is stored.


x/keys.go, line 560 at r3 (raw file):

	"dgraph.graphql.schema":            {},
	"dgraph.cors":                      {},
	"dgraph.drop.op":                   {},

Add a TODO that we should rename this map.

Copy link
Contributor Author

@abhimanyusinghgaur abhimanyusinghgaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 30 of 36 files reviewed, 13 unresolved discussions (waiting on @jarifibrahim, @manishrjain, @MichaelJCompton, @pawanrawal, and @vvbalaji-dgraph)


edgraph/server.go, line 339 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

Add a comment that if the server crashes before storing this, that would be an issue.

Done.


protos/pb.proto, line 613 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

Add a comment that this would only be present when DropOp is ATTR.

Done.


systest/online-restore/online_restore_test.go, line 587 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

Can you create a JIRA ticket to look into it when you come back?

Done.


worker/backup_ee.go, line 173 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

type backupRes {
res *BackupResponse
err error
}

chan backupRes

Done.


worker/backup_ee.go, line 190 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

res.err != nil

Done.


worker/backup_processor.go, line 136 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

if err != nil {
return nil, err
}
// append
// return kvList, nil

Done.


worker/backup_processor.go, line 346 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

Also, add the value that is stored.

Done.


x/keys.go, line 560 at r3 (raw file):

Previously, pawanrawal (Pawan Rawal) wrote…

Add a TODO that we should rename this map.

Done.

rahulgurnani pushed a commit that referenced this pull request Nov 10, 2020
abhimanyusinghgaur added a commit that referenced this pull request Nov 19, 2020
…RAPHQL-735) (#6844)

Fixes GRAPHQL-735.
See [RFC](https://discuss.dgraph.io/t/backup-and-restore-with-operations-like-drop-all/11218) for more details.

(cherry picked from commit 3179f57)

# Conflicts:
#	dgraph/cmd/alpha/run_test.go
#	dgraph/cmd/bulk/systest/test-bulk-schema.sh
#	ee/acl/acl_test.go
#	graphql/e2e/common/admin.go
#	graphql/e2e/directives/schema_response.json
#	graphql/e2e/normal/schema_response.json
#	graphql/e2e/schema/schema_test.go
#	protos/pb/pb.pb.go
#	schema/schema.go
#	systest/backup/encryption/backup_test.go
#	systest/backup/filesystem/backup_test.go
#	systest/backup/minio/backup_test.go
#	systest/export/export_test.go
#	systest/mutations_test.go
#	systest/online-restore/online_restore_test.go
#	systest/queries_test.go
#	tlstest/mtls_internal/backup/encryption/backup_test.go
#	tlstest/mtls_internal/backup/filesystem/backup_test.go
#	tlstest/mtls_internal/backup/minio/backup_test.go
#	worker/backup_processor.go
#	worker/export.go
#	worker/online_restore_ee.go
#	worker/restore.go
#	x/keys.go
#	x/x.go
abhimanyusinghgaur added a commit that referenced this pull request Nov 20, 2020
…RAPHQL-735) (#6844)

Fixes GRAPHQL-735.
See [RFC](https://discuss.dgraph.io/t/backup-and-restore-with-operations-like-drop-all/11218) for more details.

(cherry picked from commit 3179f57)

# Conflicts:
#	dgraph/cmd/alpha/run_test.go
#	dgraph/cmd/bulk/systest/test-bulk-schema.sh
#	edgraph/server.go
#	ee/acl/acl_test.go
#	graphql/e2e/common/admin.go
#	graphql/e2e/directives/schema_response.json
#	graphql/e2e/normal/schema_response.json
#	graphql/e2e/schema/schema_test.go
#	protos/pb.proto
#	protos/pb/pb.pb.go
#	schema/schema.go
#	systest/backup/encryption/backup_test.go
#	systest/backup/filesystem/backup_test.go
#	systest/backup/minio/backup_test.go
#	systest/export/export_test.go
#	systest/mutations_test.go
#	systest/online-restore/online_restore_test.go
#	systest/queries_test.go
#	testutil/graphql.go
#	tlstest/mtls_internal/backup/encryption/backup_test.go
#	tlstest/mtls_internal/backup/filesystem/backup_test.go
#	tlstest/mtls_internal/backup/minio/backup_test.go
#	worker/backup_common.go
#	worker/backup_processor.go
#	worker/export.go
#	worker/file_handler.go
#	worker/online_restore_ee.go
#	worker/restore.go
#	x/keys.go
#	x/x.go
abhimanyusinghgaur added a commit that referenced this pull request Nov 23, 2020
…RAPHQL-735) (#6844)

Fixes GRAPHQL-735.
See [RFC](https://discuss.dgraph.io/t/backup-and-restore-with-operations-like-drop-all/11218) for more details.

(cherry picked from commit 3179f57)

# Conflicts:
#	dgraph/cmd/alpha/run_test.go
#	dgraph/cmd/bulk/systest/test-bulk-schema.sh
#	ee/acl/acl_test.go
#	graphql/e2e/common/admin.go
#	graphql/e2e/directives/schema_response.json
#	graphql/e2e/schema/schema_test.go
#	protos/pb/pb.pb.go
#	systest/backup/encryption/backup_test.go
#	systest/backup/filesystem/backup_test.go
#	systest/backup/minio/backup_test.go
#	systest/mutations_test.go
#	systest/queries_test.go
#	tlstest/mtls_internal/backup/encryption/backup_test.go
#	tlstest/mtls_internal/backup/filesystem/backup_test.go
#	tlstest/mtls_internal/backup/minio/backup_test.go
#	worker/backup_processor.go
#	worker/export.go
#	x/keys.go
#	x/x.go
abhimanyusinghgaur added a commit that referenced this pull request Nov 23, 2020
…tions (G… (#6933)

...RAPHQL-735) (#6844)

Fixes GRAPHQL-735.
See [RFC](https://discuss.dgraph.io/t/backup-and-restore-with-operations-like-drop-all/11218) for more details.

(cherry picked from commit 3179f57)

# Conflicts:
#	dgraph/cmd/alpha/run_test.go
#	dgraph/cmd/bulk/systest/test-bulk-schema.sh
#	edgraph/server.go
#	ee/acl/acl_test.go
#	graphql/e2e/common/admin.go
#	graphql/e2e/directives/schema_response.json
#	graphql/e2e/normal/schema_response.json
#	graphql/e2e/schema/schema_test.go
#	protos/pb.proto
#	protos/pb/pb.pb.go
#	schema/schema.go
#	systest/backup/encryption/backup_test.go
#	systest/backup/filesystem/backup_test.go
#	systest/backup/minio/backup_test.go
#	systest/export/export_test.go
#	systest/mutations_test.go
#	systest/online-restore/online_restore_test.go
#	systest/queries_test.go
#	testutil/graphql.go
#	tlstest/mtls_internal/backup/encryption/backup_test.go
#	tlstest/mtls_internal/backup/filesystem/backup_test.go
#	tlstest/mtls_internal/backup/minio/backup_test.go
#	worker/backup_common.go
#	worker/backup_processor.go
#	worker/export.go
#	worker/file_handler.go
#	worker/online_restore_ee.go
#	worker/restore.go
#	x/keys.go
#	x/x.go
abhimanyusinghgaur added a commit that referenced this pull request Nov 23, 2020
…tions (G… (#6922)

...RAPHQL-735) (#6844)

Fixes GRAPHQL-735.
See [RFC](https://discuss.dgraph.io/t/backup-and-restore-with-operations-like-drop-all/11218) for more details.

(cherry picked from commit 3179f57)

# Conflicts:
#	dgraph/cmd/alpha/run_test.go
#	dgraph/cmd/bulk/systest/test-bulk-schema.sh
#	ee/acl/acl_test.go
#	graphql/e2e/common/admin.go
#	graphql/e2e/directives/schema_response.json
#	graphql/e2e/normal/schema_response.json
#	graphql/e2e/schema/schema_test.go
#	protos/pb/pb.pb.go
#	schema/schema.go
#	systest/backup/encryption/backup_test.go
#	systest/backup/filesystem/backup_test.go
#	systest/backup/minio/backup_test.go
#	systest/export/export_test.go
#	systest/mutations_test.go
#	systest/online-restore/online_restore_test.go
#	systest/queries_test.go
#	tlstest/mtls_internal/backup/encryption/backup_test.go
#	tlstest/mtls_internal/backup/filesystem/backup_test.go
#	tlstest/mtls_internal/backup/minio/backup_test.go
#	worker/backup_processor.go
#	worker/export.go
#	worker/online_restore_ee.go
#	worker/restore.go
#	x/keys.go
#	x/x.go
abhimanyusinghgaur added a commit that referenced this pull request Nov 23, 2020
… operations (G… (#6942)

...RAPHQL-735) (#6844)

Fixes GRAPHQL-735.
See [RFC](https://discuss.dgraph.io/t/backup-and-restore-with-operations-like-drop-all/11218) for more details.

(cherry picked from commit 3179f57)

# Conflicts:
#	dgraph/cmd/alpha/run_test.go
#	dgraph/cmd/bulk/systest/test-bulk-schema.sh
#	ee/acl/acl_test.go
#	graphql/e2e/common/admin.go
#	graphql/e2e/directives/schema_response.json
#	graphql/e2e/schema/schema_test.go
#	protos/pb/pb.pb.go
#	systest/backup/encryption/backup_test.go
#	systest/backup/filesystem/backup_test.go
#	systest/backup/minio/backup_test.go
#	systest/mutations_test.go
#	systest/queries_test.go
#	tlstest/mtls_internal/backup/encryption/backup_test.go
#	tlstest/mtls_internal/backup/filesystem/backup_test.go
#	tlstest/mtls_internal/backup/minio/backup_test.go
#	worker/backup_processor.go
#	worker/export.go
#	x/keys.go
#	x/x.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/schema Issues related to the schema language and capabilities.
Development

Successfully merging this pull request may close these issues.

3 participants