feat: run shadow v3 without legacy waiting

This commit is contained in:
zgw
2026-09-03 16:24:39 +08:00
parent 9617038e4c
commit 87700246d8
11 changed files with 1189 additions and 148 deletions

View File

@@ -112,4 +112,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and state.synchronized_at = #{snapshotSynchronizedAt}
and convert(varchar(64), state.source_signature, 2) = #{sourceSignature}
</insert>
<update id="upsertRuntimeMetric">
merge alg.shadow_runtime_metric with (holdlock) as target
using (select #{warehouseId} as warehouse_id,
#{metricName} as metric_name,
#{bucketUpperMicros} as bucket_upper_micros) as source
on target.warehouse_id = source.warehouse_id
and target.metric_name = source.metric_name
and target.bucket_upper_micros = source.bucket_upper_micros
when matched then update set
metric_count = target.metric_count + #{metricCount},
metric_total_micros = target.metric_total_micros + #{metricTotalMicros},
metric_max_micros = case when target.metric_max_micros &gt; #{metricMaxMicros}
then target.metric_max_micros else #{metricMaxMicros} end,
flushed_at = #{flushedAt}
when not matched then insert (
warehouse_id, metric_name, bucket_upper_micros,
metric_count, metric_total_micros, metric_max_micros, flushed_at)
values (
source.warehouse_id, source.metric_name, source.bucket_upper_micros,
#{metricCount}, #{metricTotalMicros}, #{metricMaxMicros}, #{flushedAt});
</update>
</mapper>