fix: add missing created_at index on wisp_events#2877
Merged
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 |
628d4af to
5316337
Compare
The wisp_events table was created without an index on created_at, unlike the events table which has idx_events_created_at. This causes GetAllEventsSince's UNION ALL query to perform a full table scan on wisp_events for the WHERE created_at > ? predicate. Without this index, Dolt's optimizer may choose a code path that implicitly casts CHAR(36) UUID values to float64 for comparison, causing overflow on UUIDs resembling scientific notation (e.g. 001e914b... parses as 1e914 = 10^914 → +Inf → MySQL Error 1366). Migration 014 adds the index to existing databases. The base schema in migration 005 is also updated so new databases get it from the start. Fixes gastownhall#2760 🤖 Generated with [Nori](https://nori.ai) Co-authored-by: Nori <contact@tilework.tech> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f66-ab13-74d8-bcc7-e53e8e736eef Co-authored-by: Amp <amp@ampcode.com>
5316337 to
df331f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
idx_wisp_events_created_atindex on existingwisp_eventstableseventstable already hasidx_events_created_atbutwisp_eventswas missing it, causing full table scans onWHERE created_at > ?inGetAllEventsSinceThe core type mismatch bug (
WHERE id > ?withint64onCHAR(36)) was already resolved by the UUID primary keys migration (PR #2597), which changedGetAllEventsSinceto useWHERE created_at > ?withtime.Time. This PR adds the missing index to ensure the query uses an efficient execution path and avoids the optimizer code path that triggered the+Infcast error.Fixes #2760
Test plan
GetAllEventsSincereturns events from both tables after migrationidx_wisp_events_created_at