fix: apply latest nph formating (#3334)

This commit is contained in:
Simon-Pierre Vivier 2025-03-19 11:30:47 -04:00 committed by GitHub
parent e2329f97e5
commit 7dbc1fe061
4 changed files with 34 additions and 31 deletions

View File

@ -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

View File

@ -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",
}
)

View File

@ -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)

View File

@ -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