From d25e67ebbd689a0df8570c5e7de9107bd515fa8c Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Fri, 26 Jun 2026 03:08:56 +0800 Subject: [PATCH] fix: widen workbench runtime read capacity (#2173) --- deploy/deploy.yaml | 2 +- internal/workbenchruntime/service.go | 3 +++ internal/workbenchruntime/service_test.go | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 internal/workbenchruntime/service_test.go diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml index e21c310f..010f652a 100644 --- a/deploy/deploy.yaml +++ b/deploy/deploy.yaml @@ -320,7 +320,7 @@ lanes: backoffBaseMs: 0 backoffMaxMs: 1 postgres: - poolMax: 4 + poolMax: 16 queryTimeoutMs: 3000 readyTimeoutMs: 2000 cache: diff --git a/internal/workbenchruntime/service.go b/internal/workbenchruntime/service.go index 0e919bc5..168fa86f 100644 --- a/internal/workbenchruntime/service.go +++ b/internal/workbenchruntime/service.go @@ -102,9 +102,12 @@ var workbenchRuntimeReadIndexes = []string{ "CREATE INDEX IF NOT EXISTS idx_workbench_sessions_updated ON workbench_sessions(updated_at DESC, session_id)", "CREATE INDEX IF NOT EXISTS idx_workbench_sessions_owner_updated ON workbench_sessions(owner_user_id, updated_at DESC, session_id)", "CREATE INDEX IF NOT EXISTS idx_workbench_sessions_status_updated ON workbench_sessions(status, updated_at DESC, session_id)", + "CREATE INDEX IF NOT EXISTS idx_workbench_sessions_last_trace_updated ON workbench_sessions(last_trace_id, updated_at DESC, session_id)", "CREATE INDEX IF NOT EXISTS idx_workbench_messages_session_updated ON workbench_messages(session_id, updated_at ASC, message_id)", "CREATE INDEX IF NOT EXISTS idx_workbench_messages_session_role_updated ON workbench_messages(session_id, role, updated_at ASC, message_id)", + "CREATE INDEX IF NOT EXISTS idx_workbench_messages_trace_updated ON workbench_messages(trace_id, updated_at DESC, message_id)", "CREATE INDEX IF NOT EXISTS idx_workbench_parts_session_updated ON workbench_parts(session_id, updated_at ASC, part_id)", + "CREATE INDEX IF NOT EXISTS idx_workbench_parts_trace_updated ON workbench_parts(trace_id, updated_at DESC, part_id)", "CREATE INDEX IF NOT EXISTS idx_workbench_turns_session_updated ON workbench_turns(session_id, updated_at DESC, turn_id)", "CREATE INDEX IF NOT EXISTS idx_workbench_turns_trace_updated ON workbench_turns(trace_id, updated_at DESC)", "CREATE INDEX IF NOT EXISTS idx_workbench_projection_checkpoints_session_updated ON workbench_projection_checkpoints(session_id, updated_at DESC, trace_id)", diff --git a/internal/workbenchruntime/service_test.go b/internal/workbenchruntime/service_test.go new file mode 100644 index 00000000..681972c4 --- /dev/null +++ b/internal/workbenchruntime/service_test.go @@ -0,0 +1,20 @@ +package workbenchruntime + +import "strings" +import "testing" + +func TestWorkbenchRuntimeReadIndexesCoverTraceFanout(t *testing.T) { + want := []string{ + "idx_workbench_sessions_last_trace_updated", + "idx_workbench_messages_trace_updated", + "idx_workbench_parts_trace_updated", + "idx_workbench_turns_trace_updated", + "idx_workbench_projection_checkpoints_trace_updated", + } + joined := strings.Join(workbenchRuntimeReadIndexes, "\n") + for _, name := range want { + if !strings.Contains(joined, name) { + t.Fatalf("workbench runtime trace fanout index %s is not ensured", name) + } + } +}