diff --git a/tests/waku_archive/test_waku_archive.nim b/tests/waku_archive/test_waku_archive.nim index fda1f54e6..9211b15e9 100644 --- a/tests/waku_archive/test_waku_archive.nim +++ b/tests/waku_archive/test_waku_archive.nim @@ -10,7 +10,7 @@ import waku_core, waku_core/message/digest, waku_archive/driver/sqlite_driver, - waku_archive + waku_archive, ], ../waku_archive/archive_utils, ../testlib/wakucore @@ -113,15 +113,18 @@ suite "Waku Archive - message handling": test "convert query to label": check: convertQueryToMetricLabel("SELECT version();") == "select_version" - convertQueryToMetricLabel("SELECT messageHash FROM messages WHERE pubsubTopic = ? AND timestamp >= ? AND timestamp <= ? ORDER BY timestamp DESC, messageHash DESC LIMIT ?") == "msg_hash_no_ctopic" - convertQueryToMetricLabel(""" SELECT child.relname AS partition_name + convertQueryToMetricLabel( + "SELECT messageHash FROM messages WHERE pubsubTopic = ? AND timestamp >= ? AND timestamp <= ? ORDER BY timestamp DESC, messageHash DESC LIMIT ?" + ) == "msg_hash_no_ctopic" + convertQueryToMetricLabel( + """ SELECT child.relname AS partition_name FROM pg_inherits JOIN pg_class parent ON pg_inherits.inhparent = parent.oid JOIN pg_class child ON pg_inherits.inhrelid = child.oid JOIN pg_namespace nmsp_parent ON nmsp_parent.oid = parent.relnamespace JOIN pg_namespace nmsp_child ON nmsp_child.oid = child.relnamespace - WHERE parent.relname='messages""") == "get_partitions_list" - + WHERE parent.relname='messages""" + ) == "get_partitions_list" procSuite "Waku Archive - find messages": ## Fixtures diff --git a/waku/common/databases/db_postgres/query_metrics.nim b/waku/common/databases/db_postgres/query_metrics.nim index 8553763b5..13789a62a 100644 --- a/waku/common/databases/db_postgres/query_metrics.nim +++ b/waku/common/databases/db_postgres/query_metrics.nim @@ -7,25 +7,27 @@ declarePublicCounter query_count, "number of times a query is being performed", labels = ["query"] ## Maps parts of the possible known queries with a fixed and shorter query label. -const QueriesToMetricMap* = toTable({ - "contentTopic IN": "content_topic", - "SELECT version()": "select_version", - "WITH min_timestamp": "messages_lookup", - "SELECT messageHash FROM messages WHERE pubsubTopic = ? AND timestamp >= ? AND timestamp <= ? ORDER BY timestamp DESC, messageHash DESC LIMIT ?": - "msg_hash_no_ctopic", - "AS partition_name": "get_partitions_list", - "SELECT COUNT(1) FROM messages": "count_msgs", - "SELECT messageHash FROM messages WHERE (timestamp, messageHash) < (?,?) AND pubsubTopic = ? AND timestamp >= ? AND timestamp <= ? ORDER BY timestamp DESC, messageHash DESC LIMIT ?": - "msg_hash_with_cursor", - "SELECT pg_database_size(current_database())": "get_database_size", - "DELETE FROM messages_lookup WHERE timestamp": "delete_from_msgs_lookup", - "DROP TABLE messages_": "drop_partition_table", - "ALTER TABLE messages DETACH PARTITION": "detach_partition", - "SELECT pg_size_pretty(pg_total_relation_size(C.oid))": "get_partition_size", - "pg_try_advisory_lock": "try_advisory_lock", - "SELECT messageHash FROM messages ORDER BY timestamp DESC, messageHash DESC LIMIT ?": - "get_all_msg_hash", - "SELECT pg_advisory_unlock": "advisory_unlock", - "ANALYZE messages": "analyze_messages", - "SELECT EXISTS": "check_version_table_exists", -}) +const QueriesToMetricMap* = toTable( + { + "contentTopic IN": "content_topic", + "SELECT version()": "select_version", + "WITH min_timestamp": "messages_lookup", + "SELECT messageHash FROM messages WHERE pubsubTopic = ? AND timestamp >= ? AND timestamp <= ? ORDER BY timestamp DESC, messageHash DESC LIMIT ?": + "msg_hash_no_ctopic", + "AS partition_name": "get_partitions_list", + "SELECT COUNT(1) FROM messages": "count_msgs", + "SELECT messageHash FROM messages WHERE (timestamp, messageHash) < (?,?) AND pubsubTopic = ? AND timestamp >= ? AND timestamp <= ? ORDER BY timestamp DESC, messageHash DESC LIMIT ?": + "msg_hash_with_cursor", + "SELECT pg_database_size(current_database())": "get_database_size", + "DELETE FROM messages_lookup WHERE timestamp": "delete_from_msgs_lookup", + "DROP TABLE messages_": "drop_partition_table", + "ALTER TABLE messages DETACH PARTITION": "detach_partition", + "SELECT pg_size_pretty(pg_total_relation_size(C.oid))": "get_partition_size", + "pg_try_advisory_lock": "try_advisory_lock", + "SELECT messageHash FROM messages ORDER BY timestamp DESC, messageHash DESC LIMIT ?": + "get_all_msg_hash", + "SELECT pg_advisory_unlock": "advisory_unlock", + "ANALYZE messages": "analyze_messages", + "SELECT EXISTS": "check_version_table_exists", + } +) diff --git a/waku/waku_rln_relay/rln_relay.nim b/waku/waku_rln_relay/rln_relay.nim index a1a6afc23..c3f3903f9 100644 --- a/waku/waku_rln_relay/rln_relay.nim +++ b/waku/waku_rln_relay/rln_relay.nim @@ -479,7 +479,7 @@ proc mount( rlnMaxEpochGap: max(uint64(MaxClockGapSeconds / float64(conf.rlnEpochSizeSec)), 1), onFatalErrorAction: conf.onFatalErrorAction, ) - + # Start epoch monitoring in the background wakuRlnRelay.epochMonitorFuture = monitorEpochs(wakuRlnRelay) return ok(wakuRlnRelay) diff --git a/waku/waku_store_sync.nim b/waku/waku_store_sync.nim index 06699d9fd..03c1b33af 100644 --- a/waku/waku_store_sync.nim +++ b/waku/waku_store_sync.nim @@ -1,8 +1,6 @@ {.push raises: [].} import - ./waku_store_sync/reconciliation, - ./waku_store_sync/transfer, - ./waku_store_sync/common + ./waku_store_sync/reconciliation, ./waku_store_sync/transfer, ./waku_store_sync/common export reconciliation, transfer, common