fix(shadow): repair UTC sampling and persist v3 diagnostics

This commit is contained in:
zgw
2026-09-07 10:12:41 +08:00
parent 5ce6393337
commit 79e0db29f9
15 changed files with 678 additions and 34 deletions

View File

@@ -89,8 +89,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
@instance_id = #{instanceId};
</update>
<select id="selectPublishedSnapshot"
resultType="com.ruoyi.algorithm.shadow.ShadowSnapshotDescriptor">
<resultMap id="publishedSnapshot" type="com.ruoyi.algorithm.shadow.ShadowSnapshotDescriptor">
<result property="snapshotGeneration" column="snapshotGeneration"/>
<result property="warehouseId" column="warehouseId"/>
<result property="snapshotStatus" column="snapshotStatus"/>
<result property="synchronizedAt" column="synchronizedAt"
typeHandler="com.ruoyi.algorithm.shadow.mapper.ShadowUtcInstantTypeHandler"/>
<result property="sourceSignature" column="sourceSignature"/>
</resultMap>
<select id="selectPublishedSnapshot" resultMap="publishedSnapshot">
select state.snapshot_generation as snapshotGeneration,
state.warehouse_id as warehouseId,
state.snapshot_status as snapshotStatus,
@@ -109,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where state.warehouse_id = #{warehouseId}
and state.snapshot_status = 'PUBLISHED'
and state.snapshot_generation = #{inputVersion}
and state.synchronized_at = #{snapshotSynchronizedAt}
and state.synchronized_at = #{snapshotSynchronizedAt, jdbcType=TIMESTAMP, typeHandler=com.ruoyi.algorithm.shadow.mapper.ShadowUtcInstantTypeHandler}
and convert(varchar(64), state.source_signature, 2) = #{sourceSignature}
</insert>
@@ -126,12 +134,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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}
flushed_at = #{flushedAt, jdbcType=TIMESTAMP, typeHandler=com.ruoyi.algorithm.shadow.mapper.ShadowUtcInstantTypeHandler}
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});
#{metricCount}, #{metricTotalMicros}, #{metricMaxMicros}, #{flushedAt, jdbcType=TIMESTAMP, typeHandler=com.ruoyi.algorithm.shadow.mapper.ShadowUtcInstantTypeHandler});
</update>
</mapper>