vector-store: implement filtering by non-primary-key columns#501
vector-store: implement filtering by non-primary-key columns#501ewienik wants to merge 6 commits into
Conversation
|
Changelog for 3c3defe
range diff |
69ff28e to
3c3defe
Compare
|
Changelog for a96084a
range diff |
3c3defe to
a96084a
Compare
|
Changelog for 8939dee
range diff |
a96084a to
8939dee
Compare
m-szymon
left a comment
There was a problem hiding this comment.
I need to digest this PR a little more, so for now just two comments.
| .filter_map(|timestamp_value| { | ||
| timestamp_value | ||
| .and_then(|(timestamp, value)| match (timestamp, value) { | ||
| (Some(timestamp), value) => Ok(Some((timestamp, value))), | ||
| (None, None) => Ok(None), | ||
| (None, Some(_)) => { | ||
| bail!("parse_values: missing timestamp for value"); | ||
| } | ||
| }) | ||
| .transpose() | ||
| }) |
There was a problem hiding this comment.
I am confused what this is supposed to filter.
If we filter anything, indexes of values no longer match column indexes.
Does (None, None) case have test?
There was a problem hiding this comment.
I think there is an error -> there should be (None, _) => bail! - we need to have timestamp. I'll fix this.
| tokio::spawn(async move { | ||
| let _permit = permit; | ||
| if let Err(err) = consumer_data.process_upsert(primary_key, timestamp).await { | ||
| error!("Error processing upsert: {err}"); | ||
| } |
There was a problem hiding this comment.
What if SELECT fails for any reason? In initial scan failures are recoverable, but here we lose that update, right?
There was a problem hiding this comment.
Both select for fullscan and cdc query are idempotent - so it limits potential fails. Fullscan is partially recoverable. Here we don't repeat query - the question is how to retry it correctly - to limit such retries. Another question is what to do with failed insertions to the index - that can happen at the last stage of processing input stream, where we don't have data. I'm going to address fullscan issues in https://scylladb.atlassian.net/browse/VECTOR-726 as we need some way of looping over retries - I was thinking that we can fix both fullscan and cdc retry in that issue.
This commit extend fullscan select to support retrieving filtering columns:
SELECT {primary_key_list}, (column-1) writetime(column-1), .. FROM {keyspace}.{table}
This commit refactors db_index::range_scan_stream by adding parse_values and
parse_primary_key functions. Parsing filtering columns is done in chunks of two
values from db row.
…lues This commit refactors db_cdc to use only information about primary_key from CDC table. If the operation is DELETE it sends primary_key to the monitor_items to delete. If the operation is UPSERT it concurrently queries db for current target and filtering columns values. There is a limit for concurrency setup as 3 * num_workers. This commit adds retrieval of filtering column values - it adds supporting functions to the db_index_backend.
This commit enables filtering using HTTP API, so it allows filtering by CQL queries.
…ry-key columns This commit adds single ann_filter_filtering_columns_int_eq integration test. It tests if filtering by filtering columns is working. It doesn't test other types of restrictions as they are tested with filtering using primary key columns. This commit refactors creating db store for integration tests to support filtering columns.
This commit adds two tests - one for global indexes, second for local indexes - that check if filtering by additional filtering columns provided in the index definition is working. This commit refactors also tests in create_index group to support test new functionality.
It seems that this test is unreliable - sometimes ck values can be mixed in cdc or fullscan. This commit refactors the test to check possible values for ck.
|
Changelog for 89af466
range diff |
8939dee to
89af466
Compare
This PR refactors db_index fullscan to retrieve filtering columns. It also refactors db_cdc to use CDC table only for operation type and primary_key - then ask directly database for target values and filtering column values. Tests on 500k showed that this process is faster or not-slower than the previous one. It helps to synchronize retrieval of filtering columns with future multi-column targets.
This PR adds single integration test and two e2e tests in validator.
This PR refactors validator's serde::test_decimal_key.
Fixes: VECTOR-708