Skip to content

Commit

Permalink
Short circuit earlier for schema enforcement on system tables (#29060)
Browse files Browse the repository at this point in the history
Parsing the schema can be expensive, and we don't have schema enforcement for system tables, so move the short circuiting up before we parse the schema.

GitOrigin-RevId: 516e45c8ff0540d2d2588d7bdcc794e012cb2e07
  • Loading branch information
sshader authored and Convex, Inc. committed Aug 21, 2024
1 parent 7a746ee commit 5e59234
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/database/src/bootstrap_model/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ impl<'a, RT: Runtime> SchemaModel<'a, RT> {
#[minitrace::trace]
pub async fn enforce(&mut self, document: &ResolvedDocument) -> anyhow::Result<()> {
let schema_table_mapping = self.tx.table_mapping().namespace(self.namespace);
if schema_table_mapping.is_system_tablet(document.id().tablet_id) {
// System tables are not subject to schema validation.
return Ok(());
}
self.enforce_with_table_mapping(document, &schema_table_mapping)
.await
}
Expand Down

0 comments on commit 5e59234

Please sign in to comment.