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

Fix index removal and additions + add smoketest #1444

Merged
merged 4 commits into from
Jun 19, 2024

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Jun 18, 2024

Description of Changes

Fixes #1438.

  1. Add constraints when adding an index.
  2. Make indexes & constraints more transactional (no change to sequences yet).
  3. Make replay behave wrt. schema changes.
  4. Adds a smoketest ensuring that index additions and removals work. This is checked by exploiting the fact that unindexed inner joins are rejected on initial subscriptions.

API and ABI breaking changes

None

Expected complexity level and risk

2

Testing

  • The call / WARN test still works
  • A smoketest is added per above.

1. Add constraints when adding an index.
2. Make indexes more transactional.
3. Make replay behave wrt. schema changes.
@Centril Centril changed the title Centril/fix index add remove Fix index removal and additions + add smoketest Jun 18, 2024
@Centril Centril requested review from gefjon and kim June 18, 2024 11:47
@Centril Centril force-pushed the centril/fix-index-add-remove branch from 1645e6f to 44df346 Compare June 18, 2024 12:31
@Centril Centril marked this pull request as draft June 18, 2024 13:36
Comment on lines +358 to +364
// NOTE: Also add all the rows in the already committed table to the index.
// FIXME: Is this correct? Index scan iterators (incl. the existing `Locking` versions)
// appear to assume that a table's index refers only to rows within that table,
// and does not handle the case where a `TxState` index refers to `CommittedState` rows.
if let Some(committed_table) = commit_table {
insert_index.build_from_rows(&index.columns, committed_table.scan_rows(commit_blob_store))?;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems wrong to me, but currently a pre-commit test fails without it.
The logic is pre-existing and should ostensibly be replaced by doing some on-merge logic, rendering merges fallible.

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAICT, the idea here is that the same TX that creates the index may use it, even though it hasn't been added to the committed state yet, so the transient version in the insert state needs to also contain the committed state's rows. There are other, better ways we could accomplish the same thing, or we could just disallow doing create_index in arbitrary TXes, but that's the impetus behind the current behavior.

@Centril Centril force-pushed the centril/fix-index-add-remove branch from 4f87b14 to 61e2fe0 Compare June 18, 2024 16:10
@Centril Centril marked this pull request as ready for review June 18, 2024 16:10
@Centril Centril force-pushed the centril/fix-index-add-remove branch from 61e2fe0 to f799f30 Compare June 19, 2024 07:58
Copy link
Contributor

@kim kim left a comment

Choose a reason for hiding this comment

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

Looks good

(Modulo the preservation of oddness, which I trust will be fixed soon).

@Centril Centril added this pull request to the merge queue Jun 19, 2024
Merged via the queue into master with commit a93bd49 Jun 19, 2024
7 checks passed
@Centril Centril deleted the centril/fix-index-add-remove branch June 19, 2024 11:53
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.

Add a smoketest for index addition / removal
3 participants