diff --git a/backend/services/deploy-mining.sh b/backend/services/deploy-mining.sh index 61a2054a..a499b330 100755 --- a/backend/services/deploy-mining.sh +++ b/backend/services/deploy-mining.sh @@ -991,6 +991,17 @@ full_reset() { fi done + # 清空 processed_cdc_events 表(因为 migration 时可能已经消费了一些消息) + # 这是事务性幂等消费的关键:重置 Kafka offset 后必须同时清空幂等记录 + log_info "Truncating processed_cdc_events tables to allow re-consumption..." + for db in "rwa_contribution" "rwa_auth"; do + if run_psql "$db" "TRUNCATE TABLE processed_cdc_events;" 2>/dev/null; then + log_success "Truncated processed_cdc_events in $db" + else + log_warn "Could not truncate processed_cdc_events in $db (table may not exist yet)" + fi + done + log_step "Step 9/18: Starting 2.0 services..." for service in "${MINING_SERVICES[@]}"; do service_start "$service"