-
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
Refactor migration assessment codepath: flatten reported issues #2153
Conversation
return assessmentIssues | ||
} | ||
|
||
// TODO: will replace fetchUnsupportedPGFeaturesFromSchemaReport() |
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.
These functions will replace the existing codepath after UI updates are implemented.
@sanyamsinghal if we will be replacing the old functions after UI changes then how will it still work to get the previous structure as I believe we still need that for YugabyteD and maybe callhome. cc: @makalaaneesh
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.
hmm good catch, we might have to retain this then till the time ybd versions have moved to flattened AssessmentIssue approach.
To hide the current unflatten things in AssessmentReport struct, we can mark their json tag as "-"
to avoid it getting in the assessmentReport.json
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.
we can't remove them from the json either, unfortunately 🥲
because we send the json to yugabyted.
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 rights, thats bad, we send the complete assessment report json, not the require fields.
408ff8f
to
134b147
Compare
yb-voyager/cmd/analyzeSchema.go
Outdated
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.
In this file, changes are mostly due to update in the reportCase
function signature to have impact
also as an argument.
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.
(did not review the impact levels for each issue.)
@@ -973,38 +985,59 @@ func areMinVersionsFixedInEqual(m1 map[string]*ybversion.YBVersion, m2 map[strin | |||
return true | |||
} | |||
|
|||
func getUnsupportedFeaturesFromSchemaAnalysisReport(featureName string, issueReason string, issueType string, schemaAnalysisReport utils.SchemaReport, displayDDLInHTML bool, description string) UnsupportedFeature { | |||
func getUnsupportedFeaturesFromSchemaAnalysisReport(category string, featureName string, issueReason string, issueType string, schemaAnalysisReport utils.SchemaReport, displayDDLInHTML bool, description string) UnsupportedFeature { |
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.
I thought category
was already present in AnalyzeSchemaIssue as IssueType
, right? Why, then do we need to explicitly pass this again here?
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.
I was not sure if category present in analyzeschema issue is reliable.
Here i see that we are assigning it inside the convert function
func convertIssueInstanceToAnalyzeIssue(issueInstance queryissue.QueryIssue, fileName string, isPlPgSQLIssue bool) utils.AnalyzeSchemaIssue {
issueType := UNSUPPORTED_FEATURES
switch true {
case isPlPgSQLIssue:
issueType = UNSUPPORTED_PLPGSQL_OBJECTS
case slices.ContainsFunc(MigrationCaveatsIssues, func(i string) bool {
//Adding the MIGRATION_CAVEATS issueType of the utils.Issue for these issueInstances in MigrationCaveatsIssues
return strings.Contains(issueInstance.Name, i)
}):
issueType = MIGRATION_CAVEATS
case strings.HasPrefix(issueInstance.Name, UNSUPPORTED_DATATYPE):
//Adding the UNSUPPORTED_DATATYPES issueType of the utils.Issue for these issues whose TypeName starts with "Unsupported datatype ..."
issueType = UNSUPPORTED_DATATYPES
}
Also we are naming it differently right now for assessment issue.
I thought its safer to provide when the caller already know.
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 can confirm this, but I think we have to actually rely on the category set by the convertIssueInstanceToAnalyzeIssue
. Caller of getUnsupportedFeaturesFromSchemaAnalysisReport
is just looking for certain issue types, but issueType:category is not 1:1. For example, advisory locks can come up in a DML_QUERY or in PLPGSQL. Same issue type, different category.
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.
Yes we can rely on convertIssueInstanceToAnalyzeIssue
's IssueType which is the actual category of FEATURE, PLPGPSQL, DATATYPE
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.
done
- goal is to eventually get rid of using issue reason for lookups
- Temporarily added new code to assessMigrationCommandV2.go - These functions will replace the existing codepath after UI updates are implemented.
…sues detected using regexp in analyze schema
- having V2 file and function will increase the scope to maintain the code
3cee8cf
to
3ca100c
Compare
@@ -19,10 +19,24 @@ const ( | |||
// Database Object types | |||
TABLE = "table" | |||
FUNCTION = "function" | |||
COLUMN = "column" |
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.
db object types are mostly used all in caps in code TABLE
, FUNCTION
or COLUMN
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 has been there like that before, lets change it later. Don't want to risk the scope of this PR.
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
Fixes: DB-14718, DB-14709, DB-14710, DB-14711, DB-14712, DB-14713, DB-14714, DB-14715
Sample of the how/what all info is stored in the AssessmentIssue struct
TODO: Ensure all the issues (categories, types) are getting generation under AssessmentIssue
Describe if there are any user-facing changes
How was this pull request tested?
existing tests
Does your PR have changes that can cause upgrade issues?