Skip to content

Commit 10eba89

Browse files
committed
fix raftsnapshot serializer
1 parent 13ef429 commit 10eba89

File tree

7 files changed

+532
-0
lines changed

7 files changed

+532
-0
lines changed
-3.61 KB
Binary file not shown.

server/src/main/java/org/apache/seata/server/cluster/raft/snapshot/RaftSnapshotSerializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class RaftSnapshotSerializer {
5050
PERMITS.add(io.seata.server.cluster.raft.snapshot.RaftSnapshot.class.getName());
5151
PERMITS.add(io.seata.server.cluster.raft.snapshot.RaftSnapshot.SnapshotType.class.getName());
5252
PERMITS.add(java.lang.Enum.class.getName());
53+
PERMITS.add(java.util.HashMap.class.getName());
5354
PERMITS.add("[B");
5455
}
5556

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
server:
19+
port: 7091
20+
21+
spring:
22+
application:
23+
name: seata-server
24+
25+
logging:
26+
config: classpath:logback-spring.xml
27+
file:
28+
path: ${log.home:${user.home}/logs/seata}
29+
extend:
30+
logstash-appender:
31+
destination: 127.0.0.1:4560
32+
kafka-appender:
33+
bootstrap-servers: 127.0.0.1:9092
34+
topic: logback_to_logstash
35+
36+
console:
37+
user:
38+
username: seata
39+
password: seata
40+
seata:
41+
config:
42+
# support: nacos, consul, apollo, zk, etcd3
43+
# type: file
44+
type: raft
45+
db:
46+
# support: rocksdb(current), leveldb, caffeine
47+
type: rocksdb
48+
dir: configStore
49+
registry:
50+
# support: nacos, eureka, redis, zk, consul, etcd3, sofa
51+
type: file
52+
store:
53+
# support: file 、 db 、 redis 、 raft
54+
# mode: file
55+
mode: raft
56+
file:
57+
dir: sessionStore
58+
# server:
59+
# service-port: 8091 #If not configured, the default is '${server.port} + 1000'
60+
security:
61+
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
62+
tokenValidityInMilliseconds: 1800000
63+
ignore:
64+
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error
65+
server:
66+
raft:
67+
group: default #此值代表该raft集群的group,client的事务分组对应的值要与之对应
68+
server-addr: 192.168.241.1:9091 # 3台节点的ip和端口,端口为该节点的netty端口+1000,默认netty端口为8091
69+
snapshot-interval: 600 # 600秒做一次数据的快照,以便raftlog的快速滚动,但是每次做快照如果内存中事务数据过多会导致每600秒产生一次业务rt的抖动,但是对于故障恢复比较友好,重启节点较快,可以调整为30分钟,1小时都行,具体按业务来,可以自行压测看看是否有抖动,在rt抖动和故障恢复中自行找个平衡点
70+
apply-batch: 32 # 最多批量32次动作做一次提交raftlog
71+
max-append-bufferSize: 262144 #日志存储缓冲区最大大小,默认256K
72+
max-replicator-inflight-msgs: 256 #在启用 pipeline 请求情况下,最大 in-flight 请求数,默认256
73+
disruptor-buffer-size: 16384 #内部 disruptor buffer 大小,如果是写入吞吐量较高场景,需要适当调高该值,默认 16384
74+
election-timeout-ms: 1000 #超过多久没有leader的心跳开始重选举
75+
reporter-enabled: false # raft自身的监控是否开启
76+
reporter-initial-delay: 60 # 监控的区间间隔
77+
serialization: jackson # 序列化方式,不要改动
78+
compressor: none # raftlog的压缩方式,如gzip,zstd等
79+
sync: true # raft日志的刷盘方式,默认是同步刷盘

server/src/main/resources/config.conf

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
2+
transport {
3+
# tcp, unix-domain-socket
4+
type = "TCP"
5+
#NIO, NATIVE
6+
server = "NIO"
7+
#enable heartbeat
8+
heartbeat = true
9+
# the tm client batch send request enable
10+
enableTmClientBatchSendRequest = false
11+
# the rm client batch send request enable
12+
enableRmClientBatchSendRequest = true
13+
# the rm client rpc request timeout
14+
rpcRmRequestTimeout = 2000
15+
# the tm client rpc request timeout
16+
rpcTmRequestTimeout = 30000
17+
# the rm client rpc request timeout
18+
rpcRmRequestTimeout = 15000
19+
#thread factory for netty
20+
threadFactory {
21+
bossThreadPrefix = "NettyBoss"
22+
workerThreadPrefix = "NettyServerNIOWorker"
23+
serverExecutorThread-prefix = "NettyServerBizHandler"
24+
shareBossWorker = false
25+
clientSelectorThreadPrefix = "NettyClientSelector"
26+
clientSelectorThreadSize = 1
27+
clientWorkerThreadPrefix = "NettyClientWorkerThread"
28+
# netty boss thread size
29+
bossThreadSize = 1
30+
#auto default pin or 8
31+
workerThreadSize = "default"
32+
}
33+
shutdown {
34+
# when destroy server, wait seconds
35+
wait = 3
36+
}
37+
serialization = "seata"
38+
compressor = "none"
39+
}
40+
service {
41+
#transaction service group mapping
42+
vgroupMapping.my_test_tx_group = "default"
43+
#only support when registry.type=file, please don't set multiple addresses
44+
default.grouplist = "127.0.0.1:8091"
45+
#degrade, current not support
46+
enableDegrade = false
47+
#disable seata
48+
disableGlobalTransaction = false
49+
}
50+
51+
client {
52+
rm {
53+
asyncCommitBufferLimit = 10000
54+
lock {
55+
retryInterval = 10
56+
retryTimes = 30
57+
retryPolicyBranchRollbackOnConflict = true
58+
}
59+
reportRetryCount = 5
60+
tableMetaCheckEnable = false
61+
tableMetaCheckerInterval = 60000
62+
reportSuccessEnable = false
63+
sagaBranchRegisterEnable = false
64+
sagaJsonParser = "fastjson"
65+
sagaRetryPersistModeUpdate = false
66+
sagaCompensatePersistModeUpdate = false
67+
tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000
68+
sqlParserType = "druid"
69+
branchExecutionTimeoutXA = 60000
70+
connectionTwoPhaseHoldTimeoutXA = 10000
71+
}
72+
tm {
73+
commitRetryCount = 5
74+
rollbackRetryCount = 5
75+
defaultGlobalTransactionTimeout = 60000
76+
degradeCheck = false
77+
degradeCheckPeriod = 2000
78+
degradeCheckAllowTimes = 10
79+
interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000
80+
}
81+
undo {
82+
dataValidation = true
83+
onlyCareUpdateColumns = true
84+
logSerialization = "jackson"
85+
logTable = "undo_log"
86+
compress {
87+
enable = true
88+
# allow zip, gzip, deflater, lz4, bzip2, zstd default is zip
89+
type = zip
90+
# if rollback info size > threshold, then will be compress
91+
# allow k m g t
92+
threshold = 64k
93+
}
94+
}
95+
loadBalance {
96+
type = "XID"
97+
virtualNodes = 10
98+
}
99+
}
100+
log {
101+
exceptionRate = 100
102+
}
103+
tcc {
104+
fence {
105+
# tcc fence log table name
106+
logTableName = tcc_fence_log
107+
# tcc fence log clean period
108+
cleanPeriod = 1h
109+
}
110+
}

server/src/main/resources/file.conf

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
registry {
19+
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
20+
type = "file"
21+
22+
nacos {
23+
serverAddr = "localhost"
24+
namespace = ""
25+
cluster = "default"
26+
}
27+
eureka {
28+
serviceUrl = "http://localhost:8761/eureka"
29+
application = "default"
30+
weight = "1"
31+
}
32+
redis {
33+
serverAddr = "localhost:6379"
34+
db = "0"
35+
}
36+
zk {
37+
cluster = "default"
38+
serverAddr = "127.0.0.1:2181"
39+
sessionTimeout = 6000
40+
connectTimeout = 2000
41+
}
42+
consul {
43+
cluster = "default"
44+
serverAddr = "127.0.0.1:8500"
45+
}
46+
etcd3 {
47+
cluster = "default"
48+
serverAddr = "http://localhost:2379"
49+
}
50+
sofa {
51+
serverAddr = "127.0.0.1:9603"
52+
application = "default"
53+
region = "DEFAULT_ZONE"
54+
datacenter = "DefaultDataCenter"
55+
cluster = "default"
56+
group = "SEATA_GROUP"
57+
addressWaitTime = "3000"
58+
}
59+
file {
60+
name = "file.conf"
61+
}
62+
}
63+
64+
config {
65+
# file、nacos 、apollo、zk、consul、etcd3
66+
type = "file"
67+
68+
nacos {
69+
serverAddr = "localhost"
70+
namespace = ""
71+
}
72+
consul {
73+
serverAddr = "127.0.0.1:8500"
74+
}
75+
apollo {
76+
appId = "seata-server"
77+
apolloMeta = "http://192.168.1.204:8801"
78+
}
79+
zk {
80+
serverAddr = "127.0.0.1:2181"
81+
sessionTimeout = 6000
82+
connectTimeout = 2000
83+
}
84+
etcd3 {
85+
serverAddr = "http://localhost:2379"
86+
}
87+
file {
88+
name = "file.conf"
89+
}
90+
91+
db {
92+
type = "rocksdb"
93+
dir = "configStore"
94+
destroyOnShutdown = false
95+
}
96+
97+
}
98+
99+
store {
100+
mode = "file"
101+
}
102+
103+
service {
104+
vgroupMapping.default_tx_group = "default"
105+
default.grouplist = "127.0.0.1:8091"
106+
disableGlobalTransaction = false
107+
}
108+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
19+
server.port=7091
20+
seata.metrics.enabled=true
21+
seata.metrics.exporter-list=prometheus
22+
seata.metrics.exporter-prometheus-port=9898
23+
seata.metrics.registry-type=compact
24+
seata.server.service-port=8091

0 commit comments

Comments
 (0)