Files
hfb_sys/docs/VERIFICATION.txt
T

35 lines
2.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
性能优化验证记录
变更分支/字段:main;财务仪表盘重复聚合、财务明细分页 order_id 两阶段查询、rental_orders 待线下出款覆盖索引。
原始 dashboard.go SHA-256:ecc1df350998a45778f3cf607a25ed75d67deb23dd6b1d04ec6cef5e5131c752
四个验证产物:
/Users/yml/codes/hfb_sys/docs/MODIFIED_FILE
/Users/yml/codes/hfb_sys/docs/DIFF_FILE
/Users/yml/codes/hfb_sys/docs/VERIFICATION.txt
/Users/yml/codes/hfb_sys/docs/ROLLBACK.sh
BASELINE
命令:HFB_ADMIN_FINANCE_TEST_DSN='hfb:secret@tcp(127.0.0.1:13306)/hfb_finance_perf?charset=utf8mb4&parseTime=True&loc=Local' HFB_ADMIN_FINANCE_PROFILE_OUTPUT='/tmp/hfb-finance-dashboard-optimization/baseline.json' go test ./internal/modules/adminfinance -run '^TestProfileDashboardOnMySQL$' -count=1 -v
输入:50 万 rental_orders、50 万 order_checkouts、60 万 payment_orders、100 万 wallet_ledger,时间分布 70 天,查询 2026-08-29 至 2026-09-04。
字面输出/结果:dashboard duration=7.936473625s daily_items=7;PASS;退出状态 0。
MODIFIED
命令:HFB_ADMIN_FINANCE_TEST_DSN='hfb:secret@tcp(127.0.0.1:13306)/hfb_finance_perf?charset=utf8mb4&parseTime=True&loc=Local' HFB_ADMIN_FINANCE_PROFILE_OUTPUT='/tmp/hfb-finance-dashboard-optimization/modified.json' go test ./internal/modules/adminfinance -run '^TestProfileDashboardOnMySQL$' -count=1 -v
输入:与 BASELINE 相同数据库、相同 7 天区间。
字面输出/结果:dashboard duration=1.625048875s daily_items=7;PASS;退出状态 0;cmp -s baseline.json modified.json 的退出状态 0;SQL 数 31 -> 26。
ROLLBACK
命令:cp docs/MODIFIED_FILE /tmp/hfb-dashboard-rollback-copy.go && ./docs/ROLLBACK.sh /tmp/hfb-dashboard-rollback-copy.go && cmp /tmp/hfb-dashboard-rollback-copy.go /tmp/hfb-finance-dashboard-optimization/dashboard.go.original
输入:优化后的 MODIFIED_FILE 副本。
字面输出/结果:rollback_cmp_exit=0;退出状态 0;副本恢复为原始 dashboard.go;MODIFIED_FILE 保持优化后行为和内容。
TESTS
命令:go test ./...;go vet ./...
字面输出/结果:后端全量测试 PASS;go vet PASS;退出状态均为 0。
MIGRATION
命令:goose -dir migrations mysql 'hfb:secret@tcp(127.0.0.1:13306)/hfb_sys?parseTime=true' up;SHOW INDEX FROM rental_orders WHERE Key_name='idx_rental_orders_offline_pending_amount';goose -dir migrations mysql 'hfb:secret@tcp(127.0.0.1:13306)/hfb_sys?parseTime=true' down。
输入:本地 Docker MySQL 的 migration 62 数据库。
字面输出/结果:goose: successfully migrated database to version: 63;索引三列均出现;Down 输出 OK 000063_finance_pending_disbursement_index.sql;删除后恢复原状态;退出状态 0。