-
Notifications
You must be signed in to change notification settings - Fork 7
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
Flatten index to remove expensive joins during invalidation #2003
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fe7bf41
Flatten index to remove expensive joins during invalidation
habdelra 59ff11e
when no invalidations after batch is done then skip writing to prod t…
habdelra bbbaa57
remove error doc when index entry has recovered from error
habdelra 0c5765d
cleanup debug
habdelra 67e46bc
clean up realm meta query
habdelra 0e96d7a
Merge remote-tracking branch 'origin/main' into cs-6946-flatten-produ…
habdelra 9afc6b3
better realm_meta test
habdelra 2fb34f1
Use more optimized pg expression in invalidation
habdelra 8878d55
include dropIndex in migration down script
habdelra f7e6651
simplify expressionToSql logic
habdelra 9a5f11c
better error message
habdelra d60ecc2
better handling for undefined db params
habdelra 87ef92c
Merge remote-tracking branch 'origin/main' into cs-6946-flatten-produ…
habdelra c939417
Merge remote-tracking branch 'origin/main' into cs-6946-flatten-produ…
habdelra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,14 +48,6 @@ module('Unit | index-writer', function (hooks) { | |
}); | ||
}); | ||
|
||
test('only invalidates latest version of content', async function (assert) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this becomes moot since we are now breaking out the working version and the production version into separate tables |
||
await runSharedTest(indexWriterTests, assert, { | ||
indexWriter, | ||
indexQueryEngine, | ||
adapter, | ||
}); | ||
}); | ||
|
||
test('can update an index entry', async function (assert) { | ||
await runSharedTest(indexWriterTests, assert, { | ||
indexWriter, | ||
|
73 changes: 73 additions & 0 deletions
73
packages/postgres/migrations/1735832183444_add-boxel-index-working.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
exports.up = (pgm) => { | ||
pgm.createTable('boxel_index_working', { | ||
url: { type: 'varchar', notNull: true }, | ||
file_alias: { type: 'varchar', notNull: true }, | ||
type: { type: 'varchar', notNull: true }, | ||
realm_version: { type: 'integer', notNull: true }, | ||
realm_url: { type: 'varchar', notNull: true }, | ||
pristine_doc: 'jsonb', | ||
search_doc: 'jsonb', | ||
error_doc: 'jsonb', | ||
deps: 'jsonb', | ||
types: 'jsonb', | ||
icon_html: 'varchar', | ||
isolated_html: 'varchar', | ||
indexed_at: 'bigint', | ||
is_deleted: 'boolean', | ||
source: 'varchar', | ||
transpiled_code: 'varchar', | ||
last_modified: 'bigint', | ||
embedded_html: 'jsonb', | ||
atom_html: 'varchar', | ||
fitted_html: 'jsonb', | ||
display_names: 'jsonb', | ||
resource_created_at: 'bigint', | ||
}); | ||
pgm.sql('ALTER TABLE boxel_index_working SET UNLOGGED'); | ||
pgm.addConstraint('boxel_index_working', 'boxel_index_working_pkey', { | ||
primaryKey: ['url', 'realm_url'], | ||
}); | ||
pgm.createIndex('boxel_index_working', ['realm_version']); | ||
pgm.createIndex('boxel_index_working', ['realm_url']); | ||
pgm.createIndex('boxel_index_working', ['file_alias']); | ||
pgm.createIndex('boxel_index_working', ['resource_created_at']); | ||
pgm.createIndex('boxel_index_working', ['last_modified']); | ||
pgm.createIndex('boxel_index_working', 'type'); | ||
pgm.createIndex('boxel_index_working', ['url', 'realm_version']); | ||
pgm.createIndex('boxel_index_working', 'deps', { method: 'gin' }); | ||
pgm.createIndex('boxel_index_working', 'types', { method: 'gin' }); | ||
pgm.createIndex('boxel_index_working', 'fitted_html', { method: 'gin' }); | ||
pgm.createIndex('boxel_index_working', 'embedded_html', { method: 'gin' }); | ||
pgm.createIndex('boxel_index_working', 'search_doc', { method: 'gin' }); | ||
|
||
pgm.sql('delete from boxel_index'); | ||
pgm.sql('delete from realm_versions;'); | ||
pgm.sql('delete from job_reservations'); | ||
pgm.sql('delete from jobs'); | ||
|
||
pgm.dropConstraint('boxel_index', 'boxel_index_pkey'); | ||
pgm.addConstraint('boxel_index', 'boxel_index_pkey', { | ||
primaryKey: ['url', 'realm_url'], | ||
}); | ||
}; | ||
|
||
exports.down = (pgm) => { | ||
pgm.dropIndex('boxel_index_working', ['realm_version']); | ||
pgm.dropIndex('boxel_index_working', ['realm_url']); | ||
pgm.dropIndex('boxel_index_working', ['file_alias']); | ||
pgm.dropIndex('boxel_index_working', ['resource_created_at']); | ||
pgm.dropIndex('boxel_index_working', ['last_modified']); | ||
pgm.dropIndex('boxel_index_working', 'type'); | ||
pgm.dropIndex('boxel_index_working', ['url', 'realm_version']); | ||
pgm.dropIndex('boxel_index_working', 'deps'); | ||
pgm.dropIndex('boxel_index_working', 'types'); | ||
pgm.dropIndex('boxel_index_working', 'fitted_html'); | ||
pgm.dropIndex('boxel_index_working', 'embedded_html'); | ||
pgm.dropIndex('boxel_index_working', 'search_doc'); | ||
pgm.dropTable('boxel_index_working', { cascade: true }); | ||
|
||
pgm.dropConstraint('boxel_index', 'boxel_index_pkey'); | ||
pgm.addConstraint('boxel_index', 'boxel_index_pkey', { | ||
primaryKey: ['url', 'realm_url', 'realm_version'], | ||
}); | ||
}; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when ed ad I reviewed this he felt that this was actually a weird feature in that this means that as you paginate the search results you are not necessarily seeing the latest query results since we are trying to maintain the results from when you originally made the request as you paginate thru the results as opposed to showing the latest values.