feat(acceptance): 建立同构验收与弹性容量体系
实现本地三节点 K3s 同构环境、脱敏生产快照、Gemini 图片和多参考图视频协议模拟、统一验收报告及故障注入。\n\n新增 Worker 容量控制器、资源与连接预算、任务恢复保护,并将生产验收拆分为 validation 执行和人工 CAS 放量。\n\n验证包括 Go 全量测试、PostgreSQL HTTP 集成测试、go vet、OpenAPI、ShellCheck、前端检查、迁移及发布脚本测试。
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
ALTER TABLE gateway_worker_instances
|
||||
DROP CONSTRAINT gateway_worker_instances_status_check,
|
||||
ADD COLUMN draining_at timestamptz,
|
||||
ADD CONSTRAINT gateway_worker_instances_status_check
|
||||
CHECK (status IN ('active', 'draining', 'stale'));
|
||||
|
||||
CREATE TABLE gateway_capacity_profiles (
|
||||
profile_key text PRIMARY KEY,
|
||||
release_sha text NOT NULL,
|
||||
config_hash text NOT NULL,
|
||||
acceptance_run_id uuid REFERENCES gateway_acceptance_runs(id) ON DELETE RESTRICT,
|
||||
kind text NOT NULL,
|
||||
model text NOT NULL DEFAULT '*',
|
||||
capacity_profile text NOT NULL,
|
||||
stable_throughput_per_second numeric(18, 6) NOT NULL,
|
||||
admitted_throughput_per_second numeric(18, 6) NOT NULL,
|
||||
max_running integer NOT NULL,
|
||||
max_queued integer NOT NULL,
|
||||
max_predicted_wait_seconds integer NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT false,
|
||||
metadata jsonb NOT NULL DEFAULT '{}'::jsonb,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT gateway_capacity_profiles_kind_check
|
||||
CHECK (kind IN ('image', 'video', 'mixed')),
|
||||
CONSTRAINT gateway_capacity_profiles_values_check
|
||||
CHECK (
|
||||
stable_throughput_per_second > 0
|
||||
AND admitted_throughput_per_second > 0
|
||||
AND admitted_throughput_per_second <= stable_throughput_per_second
|
||||
AND max_running > 0
|
||||
AND max_queued >= 0
|
||||
AND max_predicted_wait_seconds > 0
|
||||
)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uniq_gateway_capacity_profiles_enabled_kind_model
|
||||
ON gateway_capacity_profiles (kind, model)
|
||||
WHERE enabled = true;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- easyai:migration:no-transaction
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_gateway_tasks_runtime_owner
|
||||
ON gateway_tasks (locked_by, execution_lease_expires_at, id)
|
||||
WHERE status IN ('queued', 'running')
|
||||
AND execution_lease_expires_at IS NOT NULL;
|
||||
Reference in New Issue
Block a user