Skip to content

Commit

Permalink
Reporting case-sensitive tables and partitioned tables as not support…
Browse files Browse the repository at this point in the history
…ed in PG live migration
  • Loading branch information
priyanshi-yb committed Feb 1, 2024
1 parent 5a231e4 commit a6db481
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion yb-voyager/cmd/exportData.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

"github.com/davecgh/go-spew/spew"
"github.com/fatih/color"

"github.com/samber/lo"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -349,6 +348,36 @@ func getPGDumpSequencesAndValues() (map[*sqlname.SourceName]int64, error) {
return result, nil
}

func reportUnsupportedTables(finalTableList []*sqlname.SourceName) {
//report Partitions or case sensitive tables
var caseSensitiveTables []string
var partitionedTables []string
for _, table := range finalTableList {
if table.ObjectName.MinQuoted != table.ObjectName.Unquoted {
caseSensitiveTables = append(caseSensitiveTables, table.Qualified.MinQuoted)
}
if source.DB().ParentTableOfPartition(table) == "" { //For root tables only
if len(source.DB().GetPartitions(table)) > 0 {
partitionedTables = append(partitionedTables, table.Qualified.MinQuoted)
}
} else {
if source.TableList != "" { //If user has passed table list with leaf partition
partitionedTables = append(partitionedTables, table.Qualified.MinQuoted)
}
}
}
if len(caseSensitiveTables) > 0 {
if len(partitionedTables) > 0 {
utils.PrintAndLog("The following partitioned tables are not supported for live migration: %v", partitionedTables)
}
utils.ErrExit("The following case sensitive tables are not supported for live migration: %v", caseSensitiveTables)
}
if len(partitionedTables) > 0 {
utils.ErrExit("The following partitioned tables are not supported for live migration: %v", partitionedTables)
}
}


func getFinalTableColumnList() ([]*sqlname.SourceName, map[*sqlname.SourceName][]string) {
var tableList []*sqlname.SourceName
// store table list after filtering unsupported or unnecessary tables
Expand All @@ -361,6 +390,9 @@ func getFinalTableColumnList() ([]*sqlname.SourceName, map[*sqlname.SourceName][
tableList = fullTableList
}
finalTableList = sqlname.SetDifference(tableList, excludeTableList)
if source.DBType == POSTGRESQL && changeStreamingIsEnabled(exportType) {
reportUnsupportedTables(finalTableList)
}
log.Infof("initial all tables table list for data export: %v", tableList)

if !changeStreamingIsEnabled(exportType) {
Expand Down

0 comments on commit a6db481

Please sign in to comment.