Skip to content

Commit

Permalink
[1/?] Drop the exports_by_requestor index (#29684)
Browse files Browse the repository at this point in the history
The index incorrectly tiebreaks on `_id` rather than `_creationTime`
Wipe it so we can recreate it correctly.

GitOrigin-RevId: 7e85c471e9326a9d81e2805d5abd02923a06b19e
  • Loading branch information
nipunn1313 authored and Convex, Inc. committed Sep 9, 2024
1 parent 4396a0a commit e169341
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions crates/model/src/exports/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,37 +44,25 @@ pub static EXPORTS_TABLE: LazyLock<TableName> =
pub static EXPORTS_BY_STATE_AND_TS_INDEX: LazyLock<IndexName> =
LazyLock::new(|| system_index(&EXPORTS_TABLE, "by_state_and_ts"));

pub static EXPORTS_BY_REQUESTOR: LazyLock<IndexName> =
LazyLock::new(|| system_index(&EXPORTS_TABLE, "by_requestor"));

pub static EXPORTS_STATE_FIELD: LazyLock<FieldPath> =
LazyLock::new(|| "state".parse().expect("Invalid built-in field"));

pub static EXPORTS_TS_FIELD: LazyLock<FieldPath> =
LazyLock::new(|| "start_ts".parse().expect("Invalid built-in field"));

static EXPORTS_REQUESTOR_FIELD: LazyLock<FieldPath> =
LazyLock::new(|| "requestor".parse().expect("Invalid built-in field"));

pub struct ExportsTable;
impl SystemTable for ExportsTable {
fn table_name(&self) -> &'static TableName {
&EXPORTS_TABLE
}

fn indexes(&self) -> Vec<SystemIndex> {
vec![
SystemIndex {
name: EXPORTS_BY_STATE_AND_TS_INDEX.clone(),
fields: vec![EXPORTS_STATE_FIELD.clone(), EXPORTS_TS_FIELD.clone()]
.try_into()
.unwrap(),
},
SystemIndex {
name: EXPORTS_BY_REQUESTOR.clone(),
fields: vec![EXPORTS_REQUESTOR_FIELD.clone()].try_into().unwrap(),
},
]
vec![SystemIndex {
name: EXPORTS_BY_STATE_AND_TS_INDEX.clone(),
fields: vec![EXPORTS_STATE_FIELD.clone(), EXPORTS_TS_FIELD.clone()]
.try_into()
.unwrap(),
}]
}

fn validate_document(&self, document: ResolvedDocument) -> anyhow::Result<()> {
Expand Down

0 comments on commit e169341

Please sign in to comment.