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

Separate query issues for unsupported datatypes and PK/UK on complex datatypes #2361

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

Conversation

ShivanshGahlot
Copy link
Collaborator

@ShivanshGahlot ShivanshGahlot commented Feb 25, 2025

Describe the changes in this pull request

Describe if there are any user-facing changes

Unsupported datatypes analyze schema report:
image

Callhome data for unsupported datatypes:
image

Schema Report for UK on complex datatypes:
image

Schema Report for PK on complex datatypes:
image

Callhome data for PK on complex datatypes:
image

How was this pull request tested?

Manually

Does your PR have changes that can cause upgrade issues?

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

@ShivanshGahlot ShivanshGahlot changed the title Shivansh/separate issues for datatypes Separate query issues for unsupported datatypes and PK/UK on complex datatypes Mar 4, 2025
@ShivanshGahlot ShivanshGahlot marked this pull request as ready for review March 4, 2025 12:29
@ShivanshGahlot ShivanshGahlot force-pushed the shivansh/separate-issues-for-datatypes branch from 1921abc to 44b4ef6 Compare March 5, 2025 12:03
Comment on lines +627 to +633
queryissue.POINT_DATATYPE,
queryissue.LINE_DATATYPE,
queryissue.LSEG_DATATYPE,
queryissue.BOX_DATATYPE,
queryissue.PATH_DATATYPE,
queryissue.POLYGON_DATATYPE,
queryissue.CIRCLE_DATATYPE,
Copy link
Contributor

Choose a reason for hiding this comment

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

lets have a list of these in queryissue like unsupportedDatatypeIssuesInLiveMigration and unsupportedDatatypeIssuesInLiveMigrationWithFFOrFB so that we these list in a single place

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

queryissue.PK_UK_ON_TXID_SNAPSHOT_DATATYPE,
queryissue.PK_UK_ON_PGLSN_DATATYPE,
queryissue.PK_UK_ON_ARRAY_DATATYPE,
queryissue.PK_UK_ON_USER_DEFINED_DATATYPE,
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly for these have a list pkOrUkOnComplexDatatypesIssues

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

log.Infof("fetching unsupported features for PK/UK on complex datatypes...")
unsupportedFeatures := make([]UnsupportedFeature, 0)

unsupportedFeatures = append(unsupportedFeatures, getUnsupportedFeaturesFromSchemaAnalysisReport(queryissue.PK_UK_ON_CITEXT_DATATYPE_ISSUE_NAME, "", queryissue.PK_UK_ON_CITEXT_DATATYPE, schemaAnalysisReport, false))
Copy link
Contributor

Choose a reason for hiding this comment

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

once you have that list, you can use that list here directly to loop over and reduce the number of lines here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -222,24 +225,299 @@ func (d *TableIssueDetector) DetectIssues(obj queryparser.DDLObject) ([]QueryIss
return issues, nil
}

func reportPKOrUniqueConstraintOnUnsupportedDatatypesIssue(objType string, objName string, typeName string, constraintName string, issues *[]QueryIssue) {
switch typeName {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you see if we can merge this function with already existing reportIndexOnComplexDatatypes function as the types are same in both the cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@priyanshi-yb priyanshi-yb left a comment

Choose a reason for hiding this comment

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

LGTM with some comments.

@@ -410,183 +612,473 @@ func (d *IndexIssueDetector) DetectIssues(obj queryparser.DDLObject) ([]QueryIss
return issues, nil
}

func reportIndexOnComplexDatatypesIssue(objType string, objName string, typeName string) QueryIssue {
func reportIndexOnComplexDatatypesIssue(objType string, objName string, typeName string, isPkorUk bool, constraintName string) QueryIssue {
Copy link
Contributor

Choose a reason for hiding this comment

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

Change function name to reportIndexOrConstraintIssuesOnComplexDatatypes

@@ -623,18 +623,71 @@ var MigrationCaveatsIssues = []string{
queryissue.ALTER_TABLE_ADD_PK_ON_PARTITIONED_TABLE,
queryissue.FOREIGN_TABLE,
queryissue.POLICY_WITH_ROLES,
queryissue.UNSUPPORTED_DATATYPE_LIVE_MIGRATION,
queryissue.UNSUPPORTED_DATATYPE_LIVE_MIGRATION_WITH_FF_FB,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you put this migrationCaveatsIssues inside the convertIssueInstanceToAnalyzeIssue , to avoid any usage of it outside that function as its not complete now.

queryissue.UNSUPPORTED_DATATYPE_LIVE_MIGRATION_WITH_FF_FB,
}

var UnsupportedDatatypesInLiveMigrationIssues = []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

put these lists in the queryissue package.

Comment on lines +619 to +632
if !isPkorUk {
queryIssue = NewIndexOnCitextDatatypeIssue(
objType,
objName,
"",
)
} else {
queryIssue = NewPrimaryOrUniqueConstraintOnCitextDatatypeIssue(
objType,
objName,
"",
typeName,
constraintName,
)
Copy link
Contributor

@priyanshi-yb priyanshi-yb Mar 7, 2025

Choose a reason for hiding this comment

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

you can use lo.Ternary for this.

queryissue = lo.Ternary(isPkorUk, NewPrimaryOrUniqueConstraintOnCitextDatatypeIssue(objType,objName,"",typeName,constraintName),NewIndexOnCitextDatatypeIssue(objType,objName,""))

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.

In assess-migration/analyze-schema payload, create separate items for "unsupported datatypes"
2 participants