Skip to content

Commit 4e5ae89

Browse files
Bug fixes related to metaDB and pg_dump schema.sql file parsing (#1511)
* Ignoring meta DB rollback to log failures/errors in case of Transaction is done/aborted already * Adding 'ALTER TABLE .. ADD CONSTRAINT ...' in table.sql instead of uncategoried.sql for example: below DDL was present in uncategorized.sql -- -- Name: rna constraint_rna_seq_long_n; Type: CHECK CONSTRAINT; Schema: rnacen; Owner: - -- ALTER TABLE rnacen.rna ADD CONSTRAINT constraint_rna_seq_long_n CHECK (((seq_long IS NULL) OR (((len - length(replace(seq_long, 'N'::text, ''::text))))::numeric <= round((0.1 * (len)::numeric))))) NOT VALID;
1 parent a538ee0 commit 4e5ae89

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

yb-voyager/src/metadb/metadataDB.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func UpdateJsonObjectInMetaDB[T any](m *MetaDB, key string, updateFn func(obj *T
331331
}
332332
defer func() {
333333
err := tx.Rollback()
334-
if err != nil {
334+
if err != nil && !errors.Is(err, sql.ErrTxDone) {
335335
log.Errorf("failed to rollback transaction on meta db: %v", err)
336336
}
337337
}()

yb-voyager/src/srcdb/pg_dump_extract_schema.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func parseSchemaFile(exportDir string, schemaDir string, exportObjectTypesList [
9292
if utils.FileOrFolderExists(filepath.Join(schemaDir, "schema.sql")) { // assess-migration workflow
9393
schemaFilePath = filepath.Join(schemaDir, "schema.sql")
9494
}
95-
95+
9696
log.Infof("begun parsing the schema file %q", schemaFilePath)
9797
lines := readSchemaFile(schemaFilePath)
9898
var delimiterIndexes []int
@@ -135,7 +135,7 @@ func parseSchemaFile(exportDir string, schemaDir string, exportObjectTypesList [
135135
objSqlStmts["SEQUENCE"].WriteString(stmts)
136136
case "INDEX", "INDEX ATTACH":
137137
objSqlStmts["INDEX"].WriteString(stmts)
138-
case "TABLE", "DEFAULT", "CONSTRAINT", "FK CONSTRAINT":
138+
case "TABLE", "DEFAULT", "CONSTRAINT", "FK CONSTRAINT", "CHECK CONSTRAINT":
139139
objSqlStmts["TABLE"].WriteString(stmts)
140140
case "TABLE ATTACH":
141141
alterAttachPartition.WriteString(stmts)

0 commit comments

Comments
 (0)