From 36a9f40a60b6a2e9ab89660219e8700b481a82cc Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Tue, 7 Jan 2025 14:52:56 +0000 Subject: [PATCH] fix: Optimize `ledger_range` query (#1797) --- src/data/cassandra/Schema.hpp | 7 ++++--- tests/integration/data/cassandra/BaseTests.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/data/cassandra/Schema.hpp b/src/data/cassandra/Schema.hpp index 9816c53bd..4ec0356f9 100644 --- a/src/data/cassandra/Schema.hpp +++ b/src/data/cassandra/Schema.hpp @@ -74,7 +74,7 @@ class Schema { 'class': 'SimpleStrategy', 'replication_factor': '{}' }} - AND durable_writes = true + AND durable_writes = True )", settingsProvider_.get().getKeyspace(), settingsProvider_.get().getReplicationFactor() @@ -472,7 +472,7 @@ class Schema { R"( UPDATE {} SET sequence = ? - WHERE is_latest = false + WHERE is_latest = False )", qualifiedTableName(settingsProvider_.get(), "ledger_range") )); @@ -776,7 +776,7 @@ class Schema { R"( SELECT sequence FROM {} - WHERE is_latest = true + WHERE is_latest = True )", qualifiedTableName(settingsProvider_.get(), "ledger_range") )); @@ -787,6 +787,7 @@ class Schema { R"( SELECT sequence FROM {} + WHERE is_latest in (True, False) )", qualifiedTableName(settingsProvider_.get(), "ledger_range") )); diff --git a/tests/integration/data/cassandra/BaseTests.cpp b/tests/integration/data/cassandra/BaseTests.cpp index 7f9c86c6b..c1b4dcd2d 100644 --- a/tests/integration/data/cassandra/BaseTests.cpp +++ b/tests/integration/data/cassandra/BaseTests.cpp @@ -52,7 +52,7 @@ class BackendCassandraBaseTest : public NoLoggerFixture { R"( CREATE KEYSPACE IF NOT EXISTS {} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': '1'}} - AND durable_writes = true + AND durable_writes = True )", keyspace ); @@ -211,7 +211,7 @@ TEST_F(BackendCassandraBaseTest, KeyspaceManipulation) R"( CREATE KEYSPACE {} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': '1'}} - AND durable_writes = true + AND durable_writes = True )", keyspace );