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

Try DISTKey migration only if key is specified #212

Merged
merged 1 commit into from
May 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions redshiftsink/pkg/redshift/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,13 +1087,14 @@ func checkColumnsAndOrdering(
targetTableSortColumns := getSortColumns(targetTable)
if !checkColumnsExactlySame(inputTableSortColumns, targetTableSortColumns) {
klog.V(5).Infof(
"SortKeys needs migration: before: %v, now: %v\n",
"%s, SortKey is different, SortKey in config: %v, target: %v\n",
inputTable.Name,
inputTableSortColumns,
targetTableSortColumns,
)
if len(inputTableSortColumns) == 0 {
klog.Warningf(
"SortKey in table %s looks manually modified, skipped.",
klog.V(3).Infof(
"%s, SortKey is AUTO or manually modified, skipped.",
inputTable.Name,
)
} else {
Expand All @@ -1111,7 +1112,21 @@ func checkColumnsAndOrdering(
inputTableDistColumns := getDistColumns(inputTable)
targetTableDistColumns := getDistColumns(targetTable)
if !checkColumnsExactlySame(inputTableDistColumns, targetTableDistColumns) {
columnOps = append(columnOps, "ALTER DISTKEY using table migration")
klog.V(5).Infof(
"%s, DistKey is different, DistKey in config: %v, target: %v\n",
inputTable.Name,
inputTableDistColumns,
targetTableDistColumns,
)
if len(inputTableDistColumns) == 0 {
klog.V(3).Infof(
"%s, DistKey is AUTO or manually modified, skipped.",
inputTable.Name,
)
} else {
// TODO: #121 DISTKEY support is required
columnOps = append(columnOps, "ALTER DISTKEY using table migration")
}
}

return transactColumnOps, columnOps, varCharColumnOps, errors
Expand Down