-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added warning to import.go for target-db-schema flag #2241
base: main
Are you sure you want to change the base?
Added warning to import.go for target-db-schema flag #2241
Conversation
Atharva Kurhade seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
@@ -285,6 +285,10 @@ func validateTargetSchemaFlag() { | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@priyanshi-yb do we really need the if
check on line 282?
- For import-data-to-source-replica, the same limitation applies, right?
- For import-data-to-source, there's no way for the user to specify target-db-schema in the first place. so, it should be okay?
Can we do the tconf.Schema not empty check in all scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For import-data-to-source-replica, the same limitation applies, right?
yes user should not be allowed to pass schema names and should be same as source PG
Can we do the tconf.Schema not empty check in all scenarios?
I think we can't do without importRole because this validateTargetSchemaFlag()
is run in the commands - import data
and import data file
and we allow this flag for import-data-file and source is PG(dummy) in that
and for the source-replica there is separate function validateFFDBSchemaFlag
for this similar flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we want this check to run in all scenarios except import data file
and import data to source replica
. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah and I think that is only import-data then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and import-schema, for which this task was created :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atharva-kurhade-yb , let's do the following:
- Remove the new check that you've added, we can re-use the existing check with a couple of modifications
- in the existing check (line 282),
- run the check only if
importerRole
is NOT one of (SOURCE_REPLICA_DB_IMPORTER_ROLE, SOURCE_DB_IMPORTER_ROLE, IMPORT_FILE_ROLE)
- run the check only if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and import-schema, for which this task was created :)
oh yes, mybad I didn't realize that, I was just thinking about data commands 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's definitely a bit weird to rely on importerRole for this because in case of import-schema it will conveniently be empty. But I think it might be okay for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So with this change will it throw an error with import schema instead of a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's okay, too. It's something the user should definitely know, so an error makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Describe the changes in this pull request
Added a warning to import.go file.
Describe if there are any user-facing changes
How was this pull request tested?
Does your PR have changes that can cause upgrade issues?