You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(requestlog): persist queue and change metadata
Summary:
Request logs now carry queue and change metadata so downstream read models can build queue-scoped views without reloading the original request. Existing SQID parsing remains as a fallback for older or minimal log producers.
Test Plan:
✅ `make fmt && make build && make test && make check-mocks && make e2e-test`
Copy file name to clipboardExpand all lines: submitqueue/entity/request_log.go
+69-2Lines changed: 69 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ package entity
16
16
17
17
import (
18
18
"encoding/json"
19
+
"strings"
19
20
"time"
20
21
)
21
22
@@ -96,6 +97,10 @@ const (
96
97
typeRequestLogstruct {
97
98
// RequestID is the ID of the request this log entry belongs to. References entity.Request.ID.
98
99
RequestIDstring`json:"request_id"`
100
+
// Queue is the queue this request belongs to. New log producers should set it explicitly.
101
+
Queuestring`json:"queue"`
102
+
// ChangeURIs are the original change URIs submitted with the request. They are populated by gateway-originated accepted logs.
103
+
ChangeURIs []string`json:"change_uris"`
99
104
// TimestampMs is the time this log entry was created, in milliseconds since Unix epoch.
100
105
TimestampMsint64`json:"timestamp_ms"`
101
106
// Status is the request status at the time this log entry was created. It may contain requests states from the state machine and also display-friendly intermediate statuses.
@@ -117,11 +122,24 @@ type RequestLog struct {
117
122
// lastError is the last error message associated with the status at the time of this log entry, empty string if no error.
118
123
// metadata is a set of key-value pairs providing additional context for this log entry. Not constrained to any specific format or schema, used for display or debugging purposes.
"SELECT request_id, timestamp_ms, status, request_version, last_error, metadata FROM request_log WHERE request_id = ? ORDER BY timestamp_ms ASC, salt ASC",
96
+
"SELECT request_id, queue, change_uri, timestamp_ms, status, request_version, last_error, metadata FROM request_log WHERE request_id = ? ORDER BY timestamp_ms ASC, salt ASC",
Copy file name to clipboardExpand all lines: submitqueue/extension/storage/mysql/schema/README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,3 +22,6 @@ As the `batch` table grows, the secondary index will grow with it, increasing st
22
22
23
23
The `change` table records per-URI claims by in-flight requests. `request_id` is part of the primary key so that concurrent claims on the same URI by different requests coexist as distinct rows — a same-request retry collides on the PK and is a no-op (`INSERT IGNORE`), while a different-request claim is a new row that `GetByURI` surfaces for overlap detection. `queue` leads the key so queue-scoped lookups are primary-key-prefix scans and the table is shardable by queue.
24
24
25
+
## request_log table
26
+
27
+
`request_log` stores immutable request status records. Schema application uses `CREATE TABLE IF NOT EXISTS` files, so existing local databases created before the `queue` and `change_uri` columns were added must be recreated or manually altered before running newer binaries.
0 commit comments