mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-10-13 21:51:40 +00:00
update seata 1.7.1 => 2.3.0
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<revision>2.3.0-BETA</revision>
|
||||
<spring-cloud-alibaba.version>2023.0.1.2</spring-cloud-alibaba.version>
|
||||
<sentinel.version>1.8.8</sentinel.version>
|
||||
<seata.version>1.7.1</seata.version>
|
||||
<seata.version>2.3.0</seata.version>
|
||||
<nacos.client.version>2.5.1</nacos.client.version>
|
||||
<dubbo.version>3.3.4</dubbo.version>
|
||||
<dubbo-extensions.version>3.3.1</dubbo-extensions.version>
|
||||
@@ -143,10 +143,15 @@
|
||||
<version>${sentinel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.seata</groupId>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-spring-boot-starter</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Apache Dubbo 配置 -->
|
||||
<dependency>
|
||||
|
@@ -25,13 +25,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo.extensions</groupId>
|
||||
<artifactId>dubbo-filter-seata</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>3.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Seata -->
|
||||
@@ -47,7 +41,16 @@
|
||||
<groupId>org.apache.dubbo.extensions</groupId>
|
||||
<artifactId>dubbo-filter-seata</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-spring-boot-starter</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2013-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.alibaba.cloud.seata.rest;
|
||||
|
||||
import org.apache.seata.core.context.RootContext;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.http.client.support.HttpRequestWrapper;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author xiaojing
|
||||
*/
|
||||
public class SeataRestTemplateInterceptor implements ClientHttpRequestInterceptor {
|
||||
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes,
|
||||
ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
|
||||
HttpRequestWrapper requestWrapper = new HttpRequestWrapper(httpRequest);
|
||||
|
||||
String xid = RootContext.getXID();
|
||||
|
||||
if (StringUtils.hasLength(xid)) {
|
||||
requestWrapper.getHeaders().add(RootContext.KEY_XID, xid);
|
||||
}
|
||||
return clientHttpRequestExecution.execute(requestWrapper, bytes);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2013-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.alibaba.cloud.seata.web;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.seata.common.util.StringUtils;
|
||||
import org.apache.seata.core.context.RootContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
/**
|
||||
* @author xiaojing
|
||||
*
|
||||
* Seata HandlerInterceptor, Convert Seata information into
|
||||
* @see io.seata.core.context.RootContext from http request's header in
|
||||
* {@link org.springframework.web.servlet.HandlerInterceptor#preHandle(HttpServletRequest, HttpServletResponse, Object)},
|
||||
* And clean up Seata information after servlet method invocation in
|
||||
* {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)}
|
||||
*/
|
||||
public class SeataHandlerInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(SeataHandlerInterceptor.class);
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler) {
|
||||
String xid = RootContext.getXID();
|
||||
String rpcXid = request.getHeader(RootContext.KEY_XID);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("xid in RootContext {} xid in RpcContext {}", xid, rpcXid);
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(xid) && rpcXid != null) {
|
||||
RootContext.bind(rpcXid);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("bind {} to RootContext", rpcXid);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler, Exception e) {
|
||||
if (StringUtils.isNotBlank(RootContext.getXID())) {
|
||||
String rpcXid = request.getHeader(RootContext.KEY_XID);
|
||||
|
||||
if (StringUtils.isEmpty(rpcXid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String unbindXid = RootContext.unbind();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unbind {} from RootContext", unbindXid);
|
||||
}
|
||||
if (!rpcXid.equalsIgnoreCase(unbindXid)) {
|
||||
log.warn("xid in change during RPC from {} to {}", rpcXid, unbindXid);
|
||||
if (unbindXid != null) {
|
||||
RootContext.bind(unbindXid);
|
||||
log.warn("bind {} back to RootContext", unbindXid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -27,19 +27,72 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<seata.version>1.7.1</seata.version>
|
||||
<spring-boot.version>2.7.18</spring-boot.version>
|
||||
<seata.version>2.3.0</seata.version>
|
||||
<spring-boot-for-server.version>2.7.18</spring-boot-for-server.version>
|
||||
<spring-framework-for-server.version>5.3.39</spring-framework-for-server.version>
|
||||
<snakeyaml-for-server.version>2.0</snakeyaml-for-server.version>
|
||||
<tomcat-embed.version>9.0.98</tomcat-embed.version>
|
||||
<logstash-logback-encoder.version>7.2</logstash-logback-encoder.version>
|
||||
<jedis.version>3.8.0</jedis.version>
|
||||
<jackson-mapper.version>1.9.13</jackson-mapper.version>
|
||||
<kafka-clients.version>3.6.1</kafka-clients.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- SpringBoot 依赖配置 -->
|
||||
<!-- spring-framework-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>${spring-framework-for-server.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- spring-boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<version>${spring-boot-for-server.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-el</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>${snakeyaml-for-server.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>${tomcat-embed.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-dependencies</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -47,44 +100,142 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- SpringBoot Web容器 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>${tomcat-embed.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-el</artifactId>
|
||||
<version>${tomcat-embed.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
<version>${tomcat-embed.version}</version>
|
||||
</dependency>
|
||||
<!-- springboot web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>*</artifactId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-el</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.seata</groupId>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-server</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/src/main/resources/lib/seata-server-${seata.version}.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-spring-autoconfigure-server</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-core</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-config-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<groupId>log4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-discovery-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-serializer-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-compressor-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 覆盖 tomcat version 避免CVE-2024-24549-->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
<version>9.0.98</version>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-metrics-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-console</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- for database -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>9.0.98</version>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-el</artifactId>
|
||||
<version>9.0.98</version>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.beust</groupId>
|
||||
<artifactId>jcommander</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- only for event bus -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- jedis -->
|
||||
@@ -94,12 +245,64 @@
|
||||
<version>${jedis.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- logback -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
</dependency>
|
||||
<!-- logback appenders -->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>${logstash-logback-encoder.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.danielwegener</groupId>
|
||||
<artifactId>logback-kafka-appender</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
<version>${kafka-clients.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>jraft-core</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>bolt</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>bolt</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.janino</groupId>
|
||||
<artifactId>janino</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>${jackson-mapper.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Seata.io Group.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.seata.server;
|
||||
|
||||
import io.seata.common.aot.NativeUtils;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author spilledyear@outlook.com
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {"io.seata"})
|
||||
public class SeataServerApplication {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
try {
|
||||
// run the spring-boot application
|
||||
SpringApplication.run(SeataServerApplication.class, args);
|
||||
} catch (Throwable t) {
|
||||
// This exception is used to end `spring-boot-maven-plugin:process-aot`, so ignore it.
|
||||
if ("org.springframework.boot.SpringApplication$AbandonedRunException".equals(t.getClass().getName())) {
|
||||
throw t;
|
||||
}
|
||||
|
||||
// In the `native-image`, if an exception occurs prematurely during the startup process, the exception log will not be recorded,
|
||||
// so here we sleep for 20 seconds to observe the exception information.
|
||||
if (NativeUtils.inNativeImage()) {
|
||||
t.printStackTrace();
|
||||
Thread.sleep(20000);
|
||||
}
|
||||
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.seata.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {"org.apache.seata"})
|
||||
public class SeataServerApplication {
|
||||
public static void main(String[] args) throws IOException {
|
||||
// run the spring-boot application
|
||||
SpringApplication.run(ServerApplication.class, args);
|
||||
}
|
||||
}
|
@@ -53,7 +53,8 @@ seata:
|
||||
#access-key: ""
|
||||
#secret-key: ""
|
||||
security:
|
||||
secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
|
||||
secretKey: rE7bYayhpvduYwCxuhckybEPDXyna6xwm5m7MZjtjrdXjVxAbXAMccXHyaJvB346
|
||||
tokenValidityInMilliseconds: 1800000
|
||||
csrf-ignore-urls: /metadata/v1/**
|
||||
ignore:
|
||||
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login
|
||||
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error,/vgroup/v1/**
|
||||
|
Binary file not shown.
@@ -17,7 +17,7 @@
|
||||
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- Context listeners -->
|
||||
<contextListener class="io.seata.server.logging.listener.SystemPropertyLoggerContextListener"/>
|
||||
<contextListener class="org.apache.seata.server.logging.listener.SystemPropertyLoggerContextListener"/>
|
||||
<!-- common properties -->
|
||||
<springProperty name="PORT" source="server.port" defaultValue="7091"/>
|
||||
<springProperty name="APPLICATION_NAME" source="spring.application.name" defaultValue="seata-server"/>
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -1431,8 +1431,15 @@ CREATE TABLE undo_log
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT ux_undo_log UNIQUE (xid, branch_id)
|
||||
);
|
||||
|
||||
CREATE INDEX ix_log_created ON undo_log(log_created);
|
||||
COMMENT ON TABLE undo_log IS 'AT transaction mode undo table';
|
||||
COMMENT ON COLUMN undo_log.branch_id is 'branch transaction id';
|
||||
COMMENT ON COLUMN undo_log.xid is 'global transaction id';
|
||||
COMMENT ON COLUMN undo_log.context is 'undo_log context,such as serialization';
|
||||
COMMENT ON COLUMN undo_log.rollback_info is 'rollback info';
|
||||
COMMENT ON COLUMN undo_log.log_status is '0:normal status,1:defense status';
|
||||
COMMENT ON COLUMN undo_log.log_created is 'create datetime';
|
||||
COMMENT ON COLUMN undo_log.log_modified is 'modify datetime';
|
||||
|
||||
-- Generate ID using sequence and trigger
|
||||
CREATE SEQUENCE UNDO_LOG_SEQ START WITH 1 INCREMENT BY 1;
|
||||
|
96
script/sql/oracle/oracle_ry_config.sql
Normal file
96
script/sql/oracle/oracle_ry_config.sql
Normal file
@@ -0,0 +1,96 @@
|
||||
--
|
||||
-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
-- contributor license agreements. See the NOTICE file distributed with
|
||||
-- this work for additional information regarding copyright ownership.
|
||||
-- The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
-- (the "License"); you may not use this file except in compliance with
|
||||
-- the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
--
|
||||
|
||||
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
|
||||
-- the table to store GlobalSession data
|
||||
CREATE TABLE global_table
|
||||
(
|
||||
xid VARCHAR2(128) NOT NULL,
|
||||
transaction_id NUMBER(19),
|
||||
status NUMBER(3) NOT NULL,
|
||||
application_id VARCHAR2(32),
|
||||
transaction_service_group VARCHAR2(32),
|
||||
transaction_name VARCHAR2(128),
|
||||
timeout NUMBER(10),
|
||||
begin_time NUMBER(19),
|
||||
application_data VARCHAR2(2000),
|
||||
gmt_create TIMESTAMP(0),
|
||||
gmt_modified TIMESTAMP(0),
|
||||
PRIMARY KEY (xid)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_status_gmt_modified ON global_table (status, gmt_modified);
|
||||
CREATE INDEX idx_transaction_id ON global_table (transaction_id);
|
||||
|
||||
-- the table to store BranchSession data
|
||||
CREATE TABLE branch_table
|
||||
(
|
||||
branch_id NUMBER(19) NOT NULL,
|
||||
xid VARCHAR2(128) NOT NULL,
|
||||
transaction_id NUMBER(19),
|
||||
resource_group_id VARCHAR2(32),
|
||||
resource_id VARCHAR2(256),
|
||||
branch_type VARCHAR2(8),
|
||||
status NUMBER(3),
|
||||
client_id VARCHAR2(64),
|
||||
application_data VARCHAR2(2000),
|
||||
gmt_create TIMESTAMP(6),
|
||||
gmt_modified TIMESTAMP(6),
|
||||
PRIMARY KEY (branch_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_xid ON branch_table (xid);
|
||||
|
||||
-- the table to store lock data
|
||||
CREATE TABLE lock_table
|
||||
(
|
||||
row_key VARCHAR2(128) NOT NULL,
|
||||
xid VARCHAR2(128),
|
||||
transaction_id NUMBER(19),
|
||||
branch_id NUMBER(19) NOT NULL,
|
||||
resource_id VARCHAR2(256),
|
||||
table_name VARCHAR2(32),
|
||||
pk VARCHAR2(36),
|
||||
status NUMBER(3) DEFAULT 0 NOT NULL,
|
||||
gmt_create TIMESTAMP(0),
|
||||
gmt_modified TIMESTAMP(0),
|
||||
PRIMARY KEY (row_key)
|
||||
);
|
||||
|
||||
comment on column lock_table.status is '0:locked ,1:rollbacking';
|
||||
CREATE INDEX idx_branch_id ON lock_table (branch_id);
|
||||
CREATE INDEX idx_lock_table_xid ON lock_table (xid);
|
||||
CREATE INDEX idx_status ON lock_table (status);
|
||||
|
||||
CREATE TABLE distributed_lock (
|
||||
lock_key VARCHAR2(20) NOT NULL,
|
||||
lock_value VARCHAR2(20) NOT NULL,
|
||||
expire DECIMAL(18) NOT NULL,
|
||||
PRIMARY KEY (lock_key)
|
||||
);
|
||||
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0);
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0);
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);
|
||||
|
||||
CREATE TABLE vgroup_table
|
||||
(
|
||||
vGroup VARCHAR2(255) PRIMARY KEY,
|
||||
namespace VARCHAR2(255),
|
||||
cluster VARCHAR2(255)
|
||||
);
|
@@ -1408,7 +1408,7 @@ create cast (varchar as timestamptz) with function cast_varchar_to_timestamp as
|
||||
|
||||
|
||||
-- for AT mode you must to init this sql for you business database. the seata server not need it.
|
||||
CREATE TABLE IF NOT EXISTS undo_log
|
||||
CREATE TABLE IF NOT EXISTS public.undo_log
|
||||
(
|
||||
id SERIAL NOT NULL,
|
||||
branch_id BIGINT NOT NULL,
|
||||
@@ -1420,8 +1420,16 @@ CREATE TABLE IF NOT EXISTS undo_log
|
||||
log_modified TIMESTAMP(0) NOT NULL,
|
||||
CONSTRAINT pk_undo_log PRIMARY KEY (id),
|
||||
CONSTRAINT ux_undo_log UNIQUE (xid, branch_id)
|
||||
);
|
||||
);
|
||||
CREATE INDEX ix_log_created ON undo_log(log_created);
|
||||
|
||||
COMMENT on table undo_log is 'AT transaction mode undo table';
|
||||
COMMENT ON TABLE public.undo_log IS 'AT transaction mode undo table';
|
||||
COMMENT ON COLUMN public.undo_log.branch_id IS 'branch transaction id';
|
||||
COMMENT ON COLUMN public.undo_log.xid IS 'global transaction id';
|
||||
COMMENT ON COLUMN public.undo_log.context IS 'undo_log context,such as serialization';
|
||||
COMMENT ON COLUMN public.undo_log.rollback_info IS 'rollback info';
|
||||
COMMENT ON COLUMN public.undo_log.log_status IS '0:normal status,1:defense status';
|
||||
COMMENT ON COLUMN public.undo_log.log_created IS 'create datetime';
|
||||
COMMENT ON COLUMN public.undo_log.log_modified IS 'modify datetime';
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS undo_log_id_seq INCREMENT BY 1 MINVALUE 1 ;
|
||||
|
97
script/sql/postgres/postgresql_ry_config.sql
Normal file
97
script/sql/postgres/postgresql_ry_config.sql
Normal file
@@ -0,0 +1,97 @@
|
||||
--
|
||||
-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
-- contributor license agreements. See the NOTICE file distributed with
|
||||
-- this work for additional information regarding copyright ownership.
|
||||
-- The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
-- (the "License"); you may not use this file except in compliance with
|
||||
-- the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
--
|
||||
|
||||
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
|
||||
-- the table to store GlobalSession data
|
||||
CREATE TABLE IF NOT EXISTS public.global_table
|
||||
(
|
||||
xid VARCHAR(128) NOT NULL,
|
||||
transaction_id BIGINT,
|
||||
status SMALLINT NOT NULL,
|
||||
application_id VARCHAR(32),
|
||||
transaction_service_group VARCHAR(32),
|
||||
transaction_name VARCHAR(128),
|
||||
timeout INT,
|
||||
begin_time BIGINT,
|
||||
application_data VARCHAR(2000),
|
||||
gmt_create TIMESTAMP(0),
|
||||
gmt_modified TIMESTAMP(0),
|
||||
CONSTRAINT pk_global_table PRIMARY KEY (xid)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_global_table_status_gmt_modified ON public.global_table (status, gmt_modified);
|
||||
CREATE INDEX idx_global_table_transaction_id ON public.global_table (transaction_id);
|
||||
|
||||
-- the table to store BranchSession data
|
||||
CREATE TABLE IF NOT EXISTS public.branch_table
|
||||
(
|
||||
branch_id BIGINT NOT NULL,
|
||||
xid VARCHAR(128) NOT NULL,
|
||||
transaction_id BIGINT,
|
||||
resource_group_id VARCHAR(32),
|
||||
resource_id VARCHAR(256),
|
||||
branch_type VARCHAR(8),
|
||||
status SMALLINT,
|
||||
client_id VARCHAR(64),
|
||||
application_data VARCHAR(2000),
|
||||
gmt_create TIMESTAMP(6),
|
||||
gmt_modified TIMESTAMP(6),
|
||||
CONSTRAINT pk_branch_table PRIMARY KEY (branch_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_branch_table_xid ON public.branch_table (xid);
|
||||
|
||||
-- the table to store lock data
|
||||
CREATE TABLE IF NOT EXISTS public.lock_table
|
||||
(
|
||||
row_key VARCHAR(128) NOT NULL,
|
||||
xid VARCHAR(128),
|
||||
transaction_id BIGINT,
|
||||
branch_id BIGINT NOT NULL,
|
||||
resource_id VARCHAR(256),
|
||||
table_name VARCHAR(32),
|
||||
pk VARCHAR(36),
|
||||
status SMALLINT NOT NULL DEFAULT 0,
|
||||
gmt_create TIMESTAMP(0),
|
||||
gmt_modified TIMESTAMP(0),
|
||||
CONSTRAINT pk_lock_table PRIMARY KEY (row_key)
|
||||
);
|
||||
|
||||
comment on column public.lock_table.status is '0:locked ,1:rollbacking';
|
||||
CREATE INDEX idx_lock_table_branch_id ON public.lock_table (branch_id);
|
||||
CREATE INDEX idx_lock_table_xid ON public.lock_table (xid);
|
||||
CREATE INDEX idx_lock_table_status ON public.lock_table (status);
|
||||
|
||||
CREATE TABLE distributed_lock (
|
||||
lock_key VARCHAR(20) NOT NULL,
|
||||
lock_value VARCHAR(20) NOT NULL,
|
||||
expire BIGINT NOT NULL,
|
||||
CONSTRAINT pk_distributed_lock_table PRIMARY KEY (lock_key)
|
||||
);
|
||||
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0);
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0);
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
|
||||
INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS vgroup_table
|
||||
(
|
||||
vGroup VARCHAR(255),
|
||||
namespace VARCHAR(255),
|
||||
cluster VARCHAR(255),
|
||||
PRIMARY KEY (vGroup)
|
||||
);
|
@@ -1,11 +1,3 @@
|
||||
DROP DATABASE IF EXISTS `ry-config`;
|
||||
|
||||
CREATE DATABASE `ry-config` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
USE `ry-config`;
|
||||
|
||||
/******************************************/
|
||||
/* 表名称 = config_info */
|
||||
|
@@ -1,11 +1,3 @@
|
||||
DROP DATABASE IF EXISTS `ry-seata`;
|
||||
|
||||
CREATE DATABASE `ry-seata` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
USE `ry-seata`;
|
||||
|
||||
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
|
||||
-- the table to store GlobalSession data
|
||||
@@ -63,7 +55,7 @@ CREATE TABLE IF NOT EXISTS `lock_table`
|
||||
PRIMARY KEY (`row_key`),
|
||||
KEY `idx_status` (`status`),
|
||||
KEY `idx_branch_id` (`branch_id`),
|
||||
KEY `idx_xid_and_branch_id` (`xid` , `branch_id`)
|
||||
KEY `idx_xid` (`xid`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
@@ -80,3 +72,13 @@ INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('AsyncComm
|
||||
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0);
|
||||
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
|
||||
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `vgroup_table`
|
||||
(
|
||||
`vGroup` VARCHAR(255),
|
||||
`namespace` VARCHAR(255),
|
||||
`cluster` VARCHAR(255),
|
||||
UNIQUE KEY `idx_vgroup_namespace_cluster` (`vGroup`,`namespace`,`cluster`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
||||
|
Reference in New Issue
Block a user