/
purge-service-sql.xml
64 lines (62 loc) · 2.82 KB
/
purge-service-sql.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"
default-lazy-init="true">
<util:map id="purgeServiceSql">
<entry key="selectOutgoingBatchRangeSql">
<value>
select min(batch_id), max(batch_id) from $[sym.sync.table.prefix]_outgoing_batch where
create_time < ? and status = 'OK'
</value>
</entry>
<entry key="deleteOutgoingBatchSql">
<value>
delete from $[sym.sync.table.prefix]_outgoing_batch where status = 'OK' and batch_id between :MIN
and :MAX and batch_id not in (select batch_id from $[sym.sync.table.prefix]_data_event where batch_id between :MIN
and :MAX)
</value>
</entry>
<entry key="deleteDataEventSql">
<value>
delete from $[sym.sync.table.prefix]_data_event where batch_id not in (select batch_id from
$[sym.sync.table.prefix]_outgoing_batch where batch_id between :MIN and :MAX and status != 'OK')
and batch_id between :MIN and :MAX
</value>
</entry>
<entry key="selectDataRangeSql">
<value>
select min(data_id), max(data_id) from $[sym.sync.table.prefix]_data
</value>
</entry>
<entry key="deleteDataSql">
<value>
delete from $[sym.sync.table.prefix]_data d where
d.data_id between :MIN and :MAX and d.data_id not in
(select e.data_id from $[sym.sync.table.prefix]_data_event e where e.data_id between :MIN and :MAX and e.batch_id in
(select o.batch_id from $[sym.sync.table.prefix]_outgoing_batch o where o.status != 'OK' and o.create_time < :TIME))
</value>
</entry>
<entry key="selectIncomingBatchRangeSql">
<value>
select node_id, min(batch_id), max(batch_id) from $[sym.sync.table.prefix]_incoming_batch where
create_time < ? and status = 'OK' group by node_id
</value>
</entry>
<entry key="deleteIncomingBatchSql">
<value>
delete from $[sym.sync.table.prefix]_incoming_batch where batch_id between ? and ? and node_id =
? and status = 'OK'
</value>
</entry>
<entry key="deleteFromStatisticSql">
<value>delete from $[sym.sync.table.prefix]_statistic where capture_end_time < ?</value>
</entry>
<entry key="deleteIncomingBatchByNodeSql">
<value>delete from $[sym.sync.table.prefix]_incoming_batch where node_id = ?</value>
</entry>
</util:map>
</beans>