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

Added warning to import.go for target-db-schema flag #2241

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

atharva-kurhade-yb
Copy link

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?

Component Breaking changes?
MetaDB Yes/No
Name registry json Yes/No
Data File Descriptor Json Yes/No
Export Snapshot Status Json Yes/No
Import Data State Yes/No
Export Status Json Yes/No
Data .sql files of tables Yes/No
Export and import data queue Yes/No
Schema Dump Yes/No
AssessmentDB Yes/No
Sizing DB Yes/No
Migration Assessment Report Json Yes/No
Callhome Json Yes/No
YugabyteD Tables Yes/No
TargetDB Metadata Tables Yes/No

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


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() {
}
Copy link
Collaborator

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?

Copy link
Contributor

@priyanshi-yb priyanshi-yb Jan 24, 2025

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.

Copy link
Collaborator

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?

Copy link
Contributor

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.

Copy link
Collaborator

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 :)

Copy link
Collaborator

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)

Copy link
Contributor

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 😅

Copy link
Collaborator

@makalaaneesh makalaaneesh Jan 24, 2025

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.

Copy link
Author

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?

Copy link
Collaborator

@makalaaneesh makalaaneesh Jan 24, 2025

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.

Copy link
Collaborator

@makalaaneesh makalaaneesh left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants