Conversation
❌ 6 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
eb124bf to
dd0c3aa
Compare
dd0c3aa to
b81f1a5
Compare
| slices.ContainsFunc(tableMapping.Columns, func(col *protos.ColumnSetting) bool { | ||
| return col.Ordering > 0 | ||
| }) | ||
| if !hasOrderingKeys && tableMapping.Engine != protos.TableEngine_CH_ENGINE_NULL { |
There was a problem hiding this comment.
&& tableMapping.Engine != protos.TableEngine_CH_ENGINE_MERGE_TREE
(if we're following the breaking change)
| var settingVal string | ||
| if err := QueryRow(ctx, logger, conn, | ||
| "SELECT value FROM system.settings WHERE name = 'allow_suspicious_primary_key'", | ||
| ).Scan(&settingVal); err == nil && settingVal == "1" { |
There was a problem hiding this comment.
A network error here would result in a confusing message
| } | ||
|
|
||
| return fmt.Errorf( | ||
| "source table %s has no primary key columns; add a primary key to the source table, "+ |
There was a problem hiding this comment.
This function doesn't really know about primary keys on the source, it only checks a setting? It also implicitly depends on the caller validating the dest sorting keys and table engine
| hasOrderingKeys := len(processedSchema.PrimaryKeyColumns) > 0 || | ||
| slices.ContainsFunc(tableMapping.Columns, func(col *protos.ColumnSetting) bool { | ||
| return col.Ordering > 0 | ||
| }) |
There was a problem hiding this comment.
What would the behavior be for missing primary key, missing sorting keys but CDC on and replica identity full? As I understand it, setup flow would just take all columns as src primary key + dest sorting key in this case, and this change would validate away that scenario (but I might be wrong). Not sure if there's a way to unify all that logic somehow, possible there's not.
In ClickHouse 25.12,
ORDER BY TUPLE()is no longer supported. This has never worked properly in the past because snapshot would end up collapsing into a single row when PK is not specified in source database. So this PR will throw a validation error when order by empty tuple is detected.The scenarios where empty tuple is allowed:
allow_suspicious_primary_keyis enabled