Skip to content

Conversation

Shubham8287
Copy link
Contributor

@Shubham8287 Shubham8287 commented Sep 5, 2025

Description of Changes

  • add_columns_to_table api to handle AutoMigrateStep::AddColumns -- Look at doc comment for more Info.

depends on: centril/clear-table-and-fix-drop-table

TODO: handle AutoMigrateStep::DisconnectAllUsers.

API and ABI breaking changes

N/A.

Expected complexity level and risk

2? Changes are not in hotpath but a bug in migration can corrupt tables.

Testing

a test to exercise the API.

@Shubham8287 Shubham8287 requested a review from Centril September 5, 2025 11:53
@Shubham8287 Shubham8287 changed the base branch from master to centril/clear-table-and-fix-drop-table September 5, 2025 11:53
@Centril Centril force-pushed the centril/clear-table-and-fix-drop-table branch from 08b70cf to 813f34c Compare September 8, 2025 12:15
@bfops bfops added the release-any To be landed in any release window label Sep 8, 2025
@Shubham8287 Shubham8287 requested a review from Centril September 12, 2025 11:50

let mut tx = begin_mut_tx(&datastore);
// insert a row in tx_state when before adding column
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When before?

@@ -3466,4 +3456,58 @@ mod tests {

Ok(())
}

#[test]
fn test_table_schemas_consistency() -> ResultTest<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comments to the test, for example explaining what it tests, why 5000 is used, etc?

let table_schema = tx.schema_for_table(table_id).unwrap();
let table_schema_raw = tx.schema_for_table_raw(table_id).unwrap();

//TODO: Fix the bug and update the assert
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you file an issue for this and assign it to me?

let default_value = default_values
.get(idx)
.ok_or_else(|| make_err(AddColumnsErrorReason::DefaultValueMissing(new_col.col_pos)))?;
if Some(new_col.col_type.clone()) != default_value.type_of() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a sound check but its unnecessarily incomplete. Rather than using type_of, it would be better to introduce AlgebraicType::type_check to check if the value is compatible with the type. That would be a complete check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants