Skip to content

Commit 9b748f1

Browse files
authored
bugfix: prefix: [seata.server.raft.ssl] should not be null (#7117)
1 parent e603de5 commit 9b748f1

13 files changed

Lines changed: 416 additions & 15 deletions

File tree

changes/en-us/2.3.0.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ The version is updated as follows:
4949
in `application.raft.example.yml`
5050
- [[#7025](https://github.com/apache/incubator-seata/pull/7025)] fix vGroupMappingManager is NOT init
5151
- [[#7044](https://github.com/apache/incubator-seata/pull/7044)] fix tableMeta refresh after closed
52-
-
52+
- [[#7117](https://github.com/apache/incubator-seata/pull/7117)] fix prefix: seata.server.raft.ssl should not be null
53+
5354

5455
### optimize:
5556

changes/zh-cn/2.3.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Apache Seata(incubating) 是一款开源的分布式事务解决方案,提供
4242
- [[#7022](https://github.com/apache/incubator-seata/pull/7022)] 修复 `application.raft.example.yml``store.mode`属性
4343
- [[#7025](https://github.com/apache/incubator-seata/pull/7025)] 修复vGroupMappingManager未初始化的问题
4444
- [[#7044](https://github.com/apache/incubator-seata/pull/7044)] 修复TableMeta在数据源关闭后刷新错误问题
45+
- [[#7117](https://github.com/apache/incubator-seata/pull/7117)] 修复 seata.server.raft.ssl 前缀不存在的问题
46+
4547

4648
### optimize:
4749

common/src/main/java/org/apache/seata/common/ConfigurationKeys.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -966,14 +966,24 @@ public interface ConfigurationKeys {
966966

967967

968968
/**
969-
* The constant SERVER_RAFT_SSL_KEYSTORE_TYPE.
969+
* The constant SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE.
970970
*/
971-
String SERVER_RAFT_SSL_KEYSTORE_TYPE = SERVER_RAFT_SSL + "keystore.type";
971+
String SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE = SERVER_RAFT_SSL_CLIENT + "keystore.type";
972+
973+
/**
974+
* The constant SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE.
975+
*/
976+
String SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE = SERVER_RAFT_SSL_SERVER + "keystore.type";
977+
978+
/**
979+
* The constant SERVER_RAFT_SSL_KMF_ALGORITHM.
980+
*/
981+
String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmfAlgorithm";
972982

973983
/**
974984
* The constant SERVER_RAFT_SSL_KMF_ALGORITHM.
975985
*/
976-
String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmf.algorithm";
986+
String SERVER_RAFT_SSL_TMF_ALGORITHM = SERVER_RAFT_SSL + "tmfAlgorithm";
977987

978988
/**
979989
* The constant SERVER_RAFT_MAX_APPEND_BUFFER_SIZE.
@@ -1110,4 +1120,15 @@ public interface ConfigurationKeys {
11101120
* The constant META_PREFIX
11111121
*/
11121122
String META_PREFIX = SEATA_FILE_ROOT_CONFIG + FILE_CONFIG_SPLIT_CHAR + FILE_ROOT_REGISTRY + FILE_CONFIG_SPLIT_CHAR + "metadata.";
1123+
1124+
/**
1125+
* The constant SERVER_REGISTRY_METADATA_PREFIX
1126+
*/
1127+
String SERVER_REGISTRY_METADATA_PREFIX = SERVER_PREFIX + FILE_ROOT_REGISTRY + ".metadata";
1128+
1129+
/**
1130+
* The constant SERVER_REGISTRY_METADATA_EXTERNAL
1131+
*/
1132+
String SERVER_REGISTRY_METADATA_EXTERNAL = SERVER_REGISTRY_METADATA_PREFIX + ".external";
1133+
11131134
}

seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public interface StarterConstants {
7171
String SERVER_PREFIX = SEATA_PREFIX + ".server";
7272
String SERVER_UNDO_PREFIX = SERVER_PREFIX + ".undo";
7373
String SERVER_RAFT_PREFIX = SERVER_PREFIX + ".raft";
74+
String SERVER_RAFT_SSL_PREFIX = SERVER_RAFT_PREFIX + ".ssl";
75+
String SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".client.keystore";
76+
String SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".server.keystore";
7477
String SERVER_RECOVERY_PREFIX = SERVER_PREFIX + ".recovery";
7578

7679
String METRICS_PREFIX = SEATA_PREFIX + ".metrics";

seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
package org.apache.seata.spring.boot.autoconfigure;
1818

1919
import java.util.concurrent.atomic.AtomicBoolean;
20+
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLClientProperties;
21+
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLProperties;
22+
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLServerProperties;
2023
import org.apache.seata.spring.boot.autoconfigure.properties.server.store.StoreProperties;
2124
import org.apache.seata.spring.boot.autoconfigure.properties.server.MetricsProperties;
2225
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerProperties;
23-
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRaftProperties;
26+
import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftProperties;
2427
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRecoveryProperties;
2528
import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerUndoProperties;
2629
import org.apache.seata.spring.boot.autoconfigure.properties.server.session.SessionProperties;
@@ -38,6 +41,9 @@
3841
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.PROPERTY_BEAN_MAP;
3942
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_PREFIX;
4043
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_PREFIX;
44+
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX;
45+
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX;
46+
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX;
4147
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RECOVERY_PREFIX;
4248
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_UNDO_PREFIX;
4349
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SESSION_PREFIX;
@@ -79,6 +85,9 @@ public static void init() {
7985
PROPERTY_BEAN_MAP.put(STORE_REDIS_SINGLE_PREFIX, StoreRedisProperties.Single.class);
8086
PROPERTY_BEAN_MAP.put(STORE_REDIS_SENTINEL_PREFIX, StoreRedisProperties.Sentinel.class);
8187
PROPERTY_BEAN_MAP.put(SERVER_RAFT_PREFIX, ServerRaftProperties.class);
88+
PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX, ServerRaftSSLServerProperties.class);
89+
PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_PREFIX, ServerRaftSSLProperties.class);
90+
PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX, ServerRaftSSLClientProperties.class);
8291
PROPERTY_BEAN_MAP.put(SESSION_PREFIX, SessionProperties.class);
8392
PROPERTY_BEAN_MAP.put(STORE_PREFIX, StoreProperties.class);
8493
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
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+
package org.apache.seata.spring.boot.autoconfigure.properties.server.raft;
18+
19+
import org.springframework.boot.context.properties.ConfigurationProperties;
20+
import org.springframework.stereotype.Component;
21+
22+
23+
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_PREFIX;
24+
25+
26+
@Component
27+
@ConfigurationProperties(prefix = SERVER_RAFT_PREFIX)
28+
public class ServerRaftProperties {
29+
30+
private String serverAddr;
31+
32+
private String group;
33+
34+
private Boolean autoJoin = false;
35+
36+
private Integer snapshotInterval = 600;
37+
38+
private Integer applyBatch = 32;
39+
40+
private Integer maxAppendBufferSize = 256 * 1024;
41+
42+
private Integer maxReplicatorInflightMsgs = 256;
43+
44+
private Integer disruptorBufferSize = 16384;
45+
46+
private Integer electionTimeoutMs = 1000;
47+
48+
private boolean reporterEnabled = false;
49+
50+
private Integer reporterInitialDelay = 60;
51+
52+
private String serialization = "jackson";
53+
54+
private String compressor = "none";
55+
56+
private boolean sync = true;
57+
58+
public String getServerAddr() {
59+
return serverAddr;
60+
}
61+
62+
public ServerRaftProperties setServerAddr(String serverAddr) {
63+
this.serverAddr = serverAddr;
64+
return this;
65+
}
66+
67+
public Integer getSnapshotInterval() {
68+
return snapshotInterval;
69+
}
70+
71+
public ServerRaftProperties setSnapshotInterval(Integer snapshotInterval) {
72+
this.snapshotInterval = snapshotInterval;
73+
return this;
74+
}
75+
76+
public Integer getApplyBatch() {
77+
return applyBatch;
78+
}
79+
80+
public ServerRaftProperties setApplyBatch(Integer applyBatch) {
81+
this.applyBatch = applyBatch;
82+
return this;
83+
}
84+
85+
public Integer getMaxAppendBufferSize() {
86+
return maxAppendBufferSize;
87+
}
88+
89+
public ServerRaftProperties setMaxAppendBufferSize(Integer maxAppendBufferSize) {
90+
this.maxAppendBufferSize = maxAppendBufferSize;
91+
return this;
92+
}
93+
94+
public Integer getMaxReplicatorInflightMsgs() {
95+
return maxReplicatorInflightMsgs;
96+
}
97+
98+
public ServerRaftProperties setMaxReplicatorInflightMsgs(Integer maxReplicatorInflightMsgs) {
99+
this.maxReplicatorInflightMsgs = maxReplicatorInflightMsgs;
100+
return this;
101+
}
102+
103+
public Integer getDisruptorBufferSize() {
104+
return disruptorBufferSize;
105+
}
106+
107+
public ServerRaftProperties setDisruptorBufferSize(Integer disruptorBufferSize) {
108+
this.disruptorBufferSize = disruptorBufferSize;
109+
return this;
110+
}
111+
112+
public Integer getElectionTimeoutMs() {
113+
return electionTimeoutMs;
114+
}
115+
116+
public ServerRaftProperties setElectionTimeoutMs(Integer electionTimeoutMs) {
117+
this.electionTimeoutMs = electionTimeoutMs;
118+
return this;
119+
}
120+
121+
public boolean isReporterEnabled() {
122+
return reporterEnabled;
123+
}
124+
125+
public ServerRaftProperties setReporterEnabled(boolean reporterEnabled) {
126+
this.reporterEnabled = reporterEnabled;
127+
return this;
128+
}
129+
130+
public Integer getReporterInitialDelay() {
131+
return reporterInitialDelay;
132+
}
133+
134+
public ServerRaftProperties setReporterInitialDelay(Integer reporterInitialDelay) {
135+
this.reporterInitialDelay = reporterInitialDelay;
136+
return this;
137+
}
138+
139+
public Boolean getAutoJoin() {
140+
return autoJoin;
141+
}
142+
143+
public ServerRaftProperties setAutoJoin(Boolean autoJoin) {
144+
this.autoJoin = autoJoin;
145+
return this;
146+
}
147+
148+
public String getSerialization() {
149+
return serialization;
150+
}
151+
152+
public void setSerialization(String serialization) {
153+
this.serialization = serialization;
154+
}
155+
156+
public String getCompressor() {
157+
return compressor;
158+
}
159+
160+
public void setCompressor(String compressor) {
161+
this.compressor = compressor;
162+
}
163+
164+
public String getGroup() {
165+
return group;
166+
}
167+
168+
public void setGroup(String group) {
169+
this.group = group;
170+
}
171+
172+
public boolean isSync() {
173+
return sync;
174+
}
175+
176+
public void setSync(boolean sync) {
177+
this.sync = sync;
178+
}
179+
180+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
package org.apache.seata.spring.boot.autoconfigure.properties.server.raft;
18+
19+
import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX;
20+
21+
import org.springframework.boot.context.properties.ConfigurationProperties;
22+
import org.springframework.stereotype.Component;
23+
24+
@Component
25+
@ConfigurationProperties(prefix = SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX)
26+
public class ServerRaftSSLClientProperties {
27+
28+
private String path = "ssl/cbolt.pfx";
29+
30+
private String password;
31+
32+
private String type = "pkcs12";
33+
34+
public String getPath() {
35+
return path;
36+
}
37+
38+
public void setPath(String path) {
39+
this.path = path;
40+
}
41+
42+
public String getPassword() {
43+
return password;
44+
}
45+
46+
public void setPassword(String password) {
47+
this.password = password;
48+
}
49+
50+
public String getType() {
51+
return type;
52+
}
53+
54+
public void setType(String type) {
55+
this.type = type;
56+
}
57+
}

0 commit comments

Comments
 (0)