Skip to content

Conversation

@gefjon
Copy link
Contributor

@gefjon gefjon commented Aug 26, 2025

Description of Changes

In st_column_changed, iter_st_column_for_table returns rows in physical storage order. In simple cases (without unrelated deletes) this will be the same as insertion order, and therefore also the same as sorted order, but in cases with multiple column-changing automigrations the physical storage order of the rows diverges from the correct sorted order. Because this isn't a hot path, we can just call .sort() and not worry about it.

API and ABI breaking changes

N/a

Expected complexity level and risk

1

Testing

None yet. Needs manual testing with BitCraft update.

@Centril
Copy link
Contributor

Centril commented Aug 27, 2025

@gefjon Can you drop the base-branch and re-target this at master? I think this can go before the error-reporting PR.

@gefjon gefjon force-pushed the phoebe/st_column_changed-sort branch from a132f44 to d8ace00 Compare August 27, 2025 14:44
@gefjon gefjon changed the base branch from phoebe/change-type-better-errors to master August 27, 2025 14:44
gefjon and others added 3 commits August 27, 2025 10:51
During bootstrapping, indexes don't exist,
so `iter_by_col_eq` returns rows in physical storage order.
In simple cases (without unrelated deletes) this will be the same as insertion order,
and therefore also the same as sorted order,
but in cases with multiple column-changing automigrations
the physical storage order of the rows diverges from the correct sorted order.
Because this isn't a hot path, we can just call `.sort()` and not worry about it.
Co-authored-by: Shubham Mishra <shubham@clockworklabs.io>
Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
@gefjon gefjon force-pushed the phoebe/st_column_changed-sort branch from 612a0c8 to f7bc21a Compare August 27, 2025 14:52
@gefjon gefjon added this pull request to the merge queue Aug 27, 2025
Merged via the queue into master with commit eb105ad Aug 27, 2025
23 of 24 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Aug 29, 2025
…ns (#3202)

# Description of Changes

Title. When validating column type changes in `Table::change_columns_to`
and comparing layouts in `RowTypeLayout::is_compatible_with`, return
structured error objects which describe the mismatch.

I made this change while debugging the issue that led to #3203 , where
`change_columns_to` returned an error during replay of an automigration
which had succeeded the first time. The original error contained enough
information to debug, but it was presented in a noisy and unhelpful way,
so I wrote this patch to get better diagnostics.

Per @Centril 's comments, these errors are for internal assertions, not
user-facing error reporting, so we value fail-fast rather than error
hygiene and choose not to use the `ErrorStream` combinator.

Also note that I sprinkled `Box`es around some large-ish error types to
quiet
https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
.

# API and ABI breaking changes

N/a

# Expected complexity level and risk

1.

# Testing

Manual testing with BitCraft. As this is purely altering the error
reporting for non-user-facing assertions, I don't believe any further
testing is necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants