From 0ae7558d7dfccd7b0eb92aaa6182ae914e9e9583 Mon Sep 17 00:00:00 2001 From: Hank Stoever Date: Thu, 7 Nov 2024 17:05:10 -0800 Subject: [PATCH] feat: add blockhash index to metadata_table Clarity VM table --- CHANGELOG.md | 3 ++- clarity/src/vm/database/sqlite.rs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64a237ba01..7b130e182c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE ### Changed - Add index for StacksBlockId to nakamoto block headers table (improves node performance) - Remove the panic for reporting DB deadlocks (just error and continue waiting) +- Add index to `metadata_table` in Clarity DB on `blockhash` ## [3.0.0.0.1] @@ -17,7 +18,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE - Add index for StacksBlockId to nakamoto block headers table (improves node performance) - Remove the panic for reporting DB deadlocks (just error and continue waiting) - Various test fixes for CI (5353, 5368, 5372, 5371, 5380, 5378, 5387, 5396, 5390, 5394) -- Various log fixes: +- Various log fixes: - don't say proceeding to mine blocks if not a miner - misc. warns downgraded to debugs - 5391: Update default block proposal timeout to 10 minutes diff --git a/clarity/src/vm/database/sqlite.rs b/clarity/src/vm/database/sqlite.rs index 7d2af59eb5..0e0f0e3f6e 100644 --- a/clarity/src/vm/database/sqlite.rs +++ b/clarity/src/vm/database/sqlite.rs @@ -248,6 +248,12 @@ impl SqliteConnection { ) .map_err(|x| InterpreterError::SqliteError(IncomparableError { err: x }))?; + conn.execute( + "CREATE INDEX IF NOT EXISTS md_blockhashes ON metadata_table(blockhash)", + NO_PARAMS, + ) + .map_err(|x| InterpreterError::SqliteError(IncomparableError { err: x }))?; + Self::check_schema(conn)?; Ok(())