-
Notifications
You must be signed in to change notification settings - Fork 12
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
Miscellaneous changes in export schema transformations #2378
Conversation
- fixed the console output whether recommendations are applied or not. - regression: added --skip-recommendations flag back
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 with some nits
yb-voyager/cmd/exportSchema.go
Outdated
if !skipRecommendations { | ||
transformations = append(transformations, applyShardedTableTransformation) // transform #1 | ||
transformations = append(transformations, applyMergeConstraintsTransformation) // transform #2 | ||
} else { | ||
transformations = append(transformations, applyMergeConstraintsTransformation) // transform #1 |
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.
nit:
if !skipRecommendations {
transformations = append(transformations, applyShardedTableTransformation) // transform #1
}
transformations = append(transformations, applyMergeConstraintsTransformation) // transform #1
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
newStmts, err := transformFn(transformedStmts) | ||
if err != nil { | ||
transformFuncName := utils.GetFuncName(transformFn) | ||
log.Infof("applying transformation: %s on %s", filepath.Base(transformFuncName), filePath) |
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 believe filepath.Base
is for the filePath
arg?
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.
transformFuncName also comes as fullpath to the function name
@@ -122,6 +122,7 @@ func (t *Transformer) MergeConstraints(stmts []*pg_query.RawStmt) ([]*pg_query.R | |||
Otherwise, add it to the result slice | |||
*/ | |||
alterTableCmdType := alterTableCmd.GetSubtype() | |||
log.Infof("alterTableCmdType: %v", *alterTableCmdType.Enum()) |
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.
Is this required as Info log?
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 might be useful.
@@ -146,6 +147,7 @@ func (t *Transformer) MergeConstraints(stmts []*pg_query.RawStmt) ([]*pg_query.R | |||
if !ok { | |||
return nil, fmt.Errorf("CREATE TABLE stmt not found for table %v", objectName) | |||
} | |||
log.Infof("merging constraint %v into CREATE TABLE for object %v", constrType, objectName) |
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.
can this be debug log?
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.
this might help in debugging so kept it for default log level.
@@ -103,6 +103,7 @@ func ora2pgExtractSchema(source *Source, exportDir string, schemaDir string) { | |||
} | |||
} | |||
} | |||
fmt.Println() |
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.
remove?
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 added it explicitly to print a empty line after the schema export. To make it more readable.
yb-voyager/src/srcdb/postgres.go
Outdated
@@ -113,8 +113,8 @@ func (pg *PostgreSQL) Connect() error { | |||
err := pg.db.Ping() | |||
if err == nil { | |||
log.Infof("Already connected to the source database") | |||
log.Infof("Already connected to the source database") | |||
return nil | |||
log.Infof("Already connected to the source database") |
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.
repeated log
This reverts commit 7d21b3e.
Describe the changes in this pull request
Added unit test for testing pg parser Deparsing API
Fixing bug https://yugabyte.atlassian.net/browse/DB-15613 is dependent on the upstream release.
Sample console output:


Describe if there are any user-facing changes
Console output wrt recommendations applied or not.
How was this pull request tested?
Does your PR have changes that can cause upgrade issues?