Skip to content

Commit

Permalink
optimize: remove fst serialization (#6002)
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes authored Nov 12, 2023
1 parent 1de3532 commit bbbbec7
Show file tree
Hide file tree
Showing 23 changed files with 17 additions and 483 deletions.
10 changes: 0 additions & 10 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,6 @@
<artifactId>seata-serializer-kryo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-serializer-fst</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-serializer-hessian</artifactId>
Expand Down Expand Up @@ -586,11 +581,6 @@
<artifactId>kryo</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,6 @@
<artifactId>seata-serializer-hessian</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-serializer-fst</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions changes/en-us/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ The version is updated as follows:
- [[#5938](https://github.com/seata/seata/pull/5938)] support jmx port in seata
- [[#5951](https://github.com/seata/seata/pull/5951)] remove un support config in jdk17
- [[#5959](https://github.com/seata/seata/pull/5959)] modify code style and remove unused import
- [[#6002](https://github.com/seata/seata/pull/6002)] remove fst serialization


### security:
- [[#5642](https://github.com/seata/seata/pull/5642)] add Hessian Serializer WhiteDenyList
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#5938](https://github.com/seata/seata/pull/5938)] 支持 jmx 监控配置
- [[#5951](https://github.com/seata/seata/pull/5951)] 删除在 jdk17 中不支持的配置项
- [[#5959](https://github.com/seata/seata/pull/5959)] 修正代码风格问题及去除无用的类引用
- [[#6002](https://github.com/seata/seata/pull/6002)] 移除fst序列化模块


### security:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum SerializerType {
KRYO((byte)0x4),

/**
* The fst.
* The fst but it's been removed.
* <p>
* Math.pow(2, 3)
*/
Expand All @@ -56,8 +56,9 @@ public enum SerializerType {
* Math.pow(2, 4)
*/
HESSIAN((byte)0x16),

/**
* The hessian.
* The jackson.
* <p>
* Math.pow(2, 5)
*/
Expand All @@ -82,6 +83,10 @@ public static SerializerType getByCode(int code) {
return b;
}
}
if (code == SerializerType.FST.getCode()) {
throw new IllegalArgumentException(
"Since fst is no longer maintained, this serialization extension has been removed from version 2.0 for security and stability reasons.");
}
throw new IllegalArgumentException("unknown codec:" + code);
}

Expand Down
6 changes: 0 additions & 6 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
<kryo.version>5.4.0</kryo.version>
<kryo-serializers.version>0.45</kryo-serializers.version>
<hessian.version>4.0.63</hessian.version>
<fst.version>2.57</fst.version>
<groovy.version>2.4.4</groovy.version>
<zstd.version>1.5.0-4</zstd.version>
<xstream.version>1.4.20</xstream.version>
Expand Down Expand Up @@ -561,11 +560,6 @@
<artifactId>hessian</artifactId>
<version>${hessian.version}</version>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>${fst.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions rm-datasource/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.common.util.CollectionUtils;
import io.seata.common.util.StringUtils;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
Expand Down Expand Up @@ -58,6 +59,10 @@ public static UndoLogParser getInstance() {
* @return the UndoLogParser
*/
public static UndoLogParser getInstance(String name) {
if (StringUtils.equalsIgnoreCase("fst", name)) {
throw new IllegalArgumentException(
"Since fst is no longer maintained, this serialization extension has been removed from version 2.0 for security and stability reasons.");
}
return CollectionUtils.computeIfAbsent(INSTANCES, name,
key -> EnhancedServiceLoader.load(UndoLogParser.class, name));
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
io.seata.rm.datasource.undo.parser.FastjsonUndoLogParser
io.seata.rm.datasource.undo.parser.JacksonUndoLogParser
io.seata.rm.datasource.undo.parser.ProtostuffUndoLogParser
io.seata.rm.datasource.undo.parser.KryoUndoLogParser
io.seata.rm.datasource.undo.parser.FstUndoLogParser
io.seata.rm.datasource.undo.parser.KryoUndoLogParser
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class UndoLogParserFactoryTest {

@Test
void getInstance() {
Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> UndoLogParserFactory.getInstance("fst"));
Assertions.assertTrue(UndoLogParserFactory.getInstance() instanceof JacksonUndoLogParser);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.common.loader.EnhancedServiceNotFoundException;
import io.seata.rm.datasource.undo.parser.FastjsonUndoLogParser;
import io.seata.rm.datasource.undo.parser.FstUndoLogParser;
import io.seata.rm.datasource.undo.parser.JacksonUndoLogParser;
import io.seata.rm.datasource.undo.parser.KryoUndoLogParser;
import io.seata.rm.datasource.undo.parser.ProtostuffUndoLogParser;
Expand All @@ -45,10 +44,6 @@ void testLoad(){
Assertions.assertNotNull(parser);
Assertions.assertTrue(parser instanceof ProtostuffUndoLogParser);

parser = EnhancedServiceLoader.load(UndoLogParser.class, "fst");
Assertions.assertNotNull(parser);
Assertions.assertTrue(parser instanceof FstUndoLogParser);

parser = EnhancedServiceLoader.load(UndoLogParser.class, "kryo");
Assertions.assertNotNull(parser);
Assertions.assertTrue(parser instanceof KryoUndoLogParser);
Expand Down
Loading

0 comments on commit bbbbec7

Please sign in to comment.