You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/09/14 07:48:29 UTC
[incubator-servicecomb-saga] branch SCB-887 created (now 3cbb64d)
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a change to branch SCB-887
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git.
at 3cbb64d SCB-877 Clean up the code of unit test of alpha-server
This branch includes the following new commits:
new 6fdc6fe SCB-877 Fixed the integration test error
new ce864ac SCB-877 Fixed the typo of participatedEvent.
new 3cbb64d SCB-877 Clean up the code of unit test of alpha-server
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-servicecomb-saga] 03/03: SCB-877 Clean up the code of
unit test of alpha-server
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch SCB-887
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
commit 3cbb64d7d8c0a89991ac1b496307800fa4636281
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Fri Sep 14 15:47:22 2018 +0800
SCB-877 Clean up the code of unit test of alpha-server
---
...ServerTest.java => AlphaTccServerTestBase.java} | 11 +++++-
.../alpha/tcc/server/MemoryAlphaTccServerTest.java | 43 +---------------------
.../alpha/tcc/server/RdbAlphaTccServerTest.java | 41 +--------------------
3 files changed, 12 insertions(+), 83 deletions(-)
diff --git a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/AlphaTccServerTest.java b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/AlphaTccServerTestBase.java
similarity index 99%
rename from alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/AlphaTccServerTest.java
rename to alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/AlphaTccServerTestBase.java
index 43c3259..c9233e1 100644
--- a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/AlphaTccServerTest.java
+++ b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/AlphaTccServerTestBase.java
@@ -50,10 +50,9 @@ import org.apache.servicecomb.saga.pack.contract.grpc.TccEventServiceGrpc.TccEve
import org.apache.servicecomb.saga.pack.contract.grpc.TccEventServiceGrpc.TccEventServiceStub;
import org.junit.After;
import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.junit.Test;
-public abstract class AlphaTccServerTest {
+public abstract class AlphaTccServerTestBase {
protected static ManagedChannel clientChannel;
@@ -93,6 +92,7 @@ public abstract class AlphaTccServerTest {
blockingStub.onDisconnected(serviceConfig);
}
+ @Test
public void assertOnConnect() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
awaitUntilConnected();
@@ -101,6 +101,7 @@ public abstract class AlphaTccServerTest {
);
}
+ @Test
public void assertOnDisConnect() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
awaitUntilConnected();
@@ -115,6 +116,7 @@ public abstract class AlphaTccServerTest {
await().atMost(2, SECONDS).until(() -> null != (OmegaCallbacksRegistry.getRegistry().get(serviceName)));
}
+ @Test
public void assertOnTransactionStart() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
awaitUntilConnected();
@@ -142,6 +144,7 @@ public abstract class AlphaTccServerTest {
assertThat(event.getStatus(), is(TransactionStatus.Succeed.name()));
}
+ @Test
public void assertOnParticipated() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
awaitUntilConnected();
@@ -178,6 +181,7 @@ public abstract class AlphaTccServerTest {
assertThat(result.getAborted(), is(false));
}
+ @Test
public void assertOnTccTransactionFailedEnded() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
awaitUntilConnected();
@@ -194,6 +198,7 @@ public abstract class AlphaTccServerTest {
assertThat(commandStreamObserver.isCompleted(), is(false));
}
+ @Test
public void assertOnCallbackNotExist() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
awaitUntilConnected();
@@ -205,6 +210,7 @@ public abstract class AlphaTccServerTest {
assertThat(result.getAborted(), is(true));
}
+ @Test
public void assertOnCallbacksExecuteError() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
awaitUntilConnected();
@@ -218,6 +224,7 @@ public abstract class AlphaTccServerTest {
assertThat(OmegaCallbacksRegistry.getRegistry().get(serviceName).size(), is(0));
}
+ @Test
public void assertOnSwitchOtherCallbackInstance() {
asyncStub.onConnected(serviceConfig, commandStreamObserver);
GrpcServiceConfig config = GrpcServiceConfig.newBuilder()
diff --git a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/MemoryAlphaTccServerTest.java b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/MemoryAlphaTccServerTest.java
index 59d3c19..6dd9fcf 100644
--- a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/MemoryAlphaTccServerTest.java
+++ b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/MemoryAlphaTccServerTest.java
@@ -35,7 +35,7 @@ import org.springframework.test.context.junit4.SpringRunner;
"alpha.server.port=8090",
"alpha.server.storage=local"
})
-public class MemoryAlphaTccServerTest extends AlphaTccServerTest {
+public class MemoryAlphaTccServerTest extends AlphaTccServerTestBase {
@BeforeClass
public static void setupClientChannel() {
@@ -50,44 +50,5 @@ public class MemoryAlphaTccServerTest extends AlphaTccServerTest {
public TccTxEventFacade getTccTxEventFacade() {
return tccTxEventFacade;
}
-
- @Test
- public void assertOnDisConnect() {
- super.assertOnDisConnect();
- }
-
- @Test
- public void assertOnTransactionStart() {
- super.assertOnTransactionStart();
- }
-
- @Test
- public void assertOnParticipated() {
- super.assertOnParticipated();
- }
-
- @Test
- public void assertOnTccTransactionSucceedEnded() {
- super.assertOnTccTransactionSucceedEnded();
- }
-
- @Test
- public void assertOnTccTransactionFailedEnded() {
- super.assertOnTccTransactionFailedEnded();
- }
-
- @Test
- public void assertOnCallbackNotExist() {
- super.assertOnCallbackNotExist();
- }
-
- @Test
- public void assertOnCallbacksExecuteError() {
- super.assertOnCallbacksExecuteError();
- }
-
- @Test
- public void assertOnSwitchOtherCallbackInstance() {
- super.assertOnSwitchOtherCallbackInstance();
- }
+
}
diff --git a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/RdbAlphaTccServerTest.java b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/RdbAlphaTccServerTest.java
index e2db6eb..a81a415 100644
--- a/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/RdbAlphaTccServerTest.java
+++ b/alpha/alpha-server/src/test/java/org/apache/servicecomb/saga/alpha/tcc/server/RdbAlphaTccServerTest.java
@@ -35,7 +35,7 @@ import org.springframework.test.context.junit4.SpringRunner;
"alpha.server.port=8091",
"alpha.server.storage=rdb"
})
-public class RdbAlphaTccServerTest extends AlphaTccServerTest {
+public class RdbAlphaTccServerTest extends AlphaTccServerTestBase {
@BeforeClass
public static void setupClientChannel() {
@@ -51,43 +51,4 @@ public class RdbAlphaTccServerTest extends AlphaTccServerTest {
return tccTxEventFacade;
}
- @Test
- public void assertOnDisConnect() {
- super.assertOnDisConnect();
- }
-
- @Test
- public void assertOnTransactionStart() {
- super.assertOnTransactionStart();
- }
-
- @Test
- public void assertOnParticipated() {
- super.assertOnParticipated();
- }
-
- @Test
- public void assertOnTccTransactionSucceedEnded() {
- super.assertOnTccTransactionSucceedEnded();
- }
-
- @Test
- public void assertOnTccTransactionFailedEnded() {
- super.assertOnTccTransactionFailedEnded();
- }
-
- @Test
- public void assertOnCallbackNotExist() {
- super.assertOnCallbackNotExist();
- }
-
- @Test
- public void assertOnCallbacksExecuteError() {
- super.assertOnCallbacksExecuteError();
- }
-
- @Test
- public void assertOnSwitchOtherCallbackInstance() {
- super.assertOnSwitchOtherCallbackInstance();
- }
}
[incubator-servicecomb-saga] 02/03: SCB-877 Fixed the typo of
participatedEvent.
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch SCB-887
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
commit ce864accd544a509cabfae323898ada60e0e3a2b
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Fri Sep 14 15:34:13 2018 +0800
SCB-877 Fixed the typo of participatedEvent.
---
.../saga/alpha/server/tcc/RdbTccTxEventFacadeImpl.java | 10 +++++-----
.../saga/alpha/server/tcc/callback/RdbCallbackEngine.java | 6 +++---
...ticipateEventService.java => ParticipatedEventService.java} | 2 +-
...EventServiceImpl.java => ParticipatedEventServiceImpl.java} | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/RdbTccTxEventFacadeImpl.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/RdbTccTxEventFacadeImpl.java
index 7978fe0..5df17da 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/RdbTccTxEventFacadeImpl.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/RdbTccTxEventFacadeImpl.java
@@ -24,7 +24,7 @@ import org.apache.servicecomb.saga.alpha.server.tcc.callback.TccCallbackEngine;
import org.apache.servicecomb.saga.alpha.server.tcc.jpa.GlobalTxEvent;
import org.apache.servicecomb.saga.alpha.server.tcc.jpa.ParticipatedEvent;
import org.apache.servicecomb.saga.alpha.server.tcc.service.GlobalTxEventService;
-import org.apache.servicecomb.saga.alpha.server.tcc.service.ParticipateEventService;
+import org.apache.servicecomb.saga.alpha.server.tcc.service.ParticipatedEventService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,7 +35,7 @@ import org.springframework.stereotype.Component;
public class RdbTccTxEventFacadeImpl implements TccTxEventFacade {
@Autowired
- private ParticipateEventService participateEventService;
+ private ParticipatedEventService participatedEventService;
@Autowired
private GlobalTxEventService globalTxEventService;
@@ -53,7 +53,7 @@ public class RdbTccTxEventFacadeImpl implements TccTxEventFacade {
@Override
public boolean onParticipateEvent(ParticipatedEvent event) {
- return participateEventService.addEvent(event);
+ return participatedEventService.addEvent(event);
}
@Override
@@ -66,7 +66,7 @@ public class RdbTccTxEventFacadeImpl implements TccTxEventFacade {
@Override
public void onCoordinatedEvent(String globalTxId, String localTxId) {
- participateEventService.migration(globalTxId, localTxId);
+ participatedEventService.migration(globalTxId, localTxId);
}
@Override
@@ -76,7 +76,7 @@ public class RdbTccTxEventFacadeImpl implements TccTxEventFacade {
@Override
public List<ParticipatedEvent> getParticipateEventByGlobalTxId(String globalTxId) {
- return participateEventService.getEventByGlobalTxId(globalTxId).orElse(Lists.newArrayList());
+ return participatedEventService.getEventByGlobalTxId(globalTxId).orElse(Lists.newArrayList());
}
@Override
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/RdbCallbackEngine.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/RdbCallbackEngine.java
index bf3ee03..c84340e 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/RdbCallbackEngine.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/RdbCallbackEngine.java
@@ -20,7 +20,7 @@ package org.apache.servicecomb.saga.alpha.server.tcc.callback;
import com.google.common.collect.Lists;
import java.util.List;
import org.apache.servicecomb.saga.alpha.server.tcc.jpa.ParticipatedEvent;
-import org.apache.servicecomb.saga.alpha.server.tcc.service.ParticipateEventService;
+import org.apache.servicecomb.saga.alpha.server.tcc.service.ParticipatedEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -28,10 +28,10 @@ import org.springframework.stereotype.Component;
public class RdbCallbackEngine extends TccCallbackEngine {
@Autowired
- private ParticipateEventService participateEventService;
+ private ParticipatedEventService participatedEventService;
@Override
protected List<ParticipatedEvent> findParticipate(String globalTxId) {
- return participateEventService.getEventByGlobalTxId(globalTxId).orElse(Lists.newArrayList());
+ return participatedEventService.getEventByGlobalTxId(globalTxId).orElse(Lists.newArrayList());
}
}
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipateEventService.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipatedEventService.java
similarity index 96%
rename from alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipateEventService.java
rename to alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipatedEventService.java
index 6d58710..a932ebf 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipateEventService.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipatedEventService.java
@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Optional;
import org.apache.servicecomb.saga.alpha.server.tcc.jpa.ParticipatedEvent;
-public interface ParticipateEventService {
+public interface ParticipatedEventService {
boolean addEvent(ParticipatedEvent participateEvent);
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipateEventServiceImpl.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipatedEventServiceImpl.java
similarity index 97%
rename from alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipateEventServiceImpl.java
rename to alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipatedEventServiceImpl.java
index ee71214..addec13 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipateEventServiceImpl.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/service/ParticipatedEventServiceImpl.java
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@Component
-public class ParticipateEventServiceImpl implements ParticipateEventService {
+public class ParticipatedEventServiceImpl implements ParticipatedEventService {
@Autowired
private ParticipatedEventRepository hotRepository;
[incubator-servicecomb-saga] 01/03: SCB-877 Fixed the integration
test error
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch SCB-887
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
commit 6fdc6fe9de2fda1e618cec265fc3eae5221626a9
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Fri Sep 14 15:31:11 2018 +0800
SCB-877 Fixed the integration test error
---
.../saga/alpha/server/tcc/jpa/GlobalTxEvent.java | 4 ++--
.../saga/alpha/server/tcc/jpa/ParticipatedEvent.java | 8 ++------
.../alpha/server/tcc/jpa/ParticipatedEventHistory.java | 2 +-
alpha/alpha-server/src/main/resources/schema-mysql.sql | 16 ++++++++--------
.../src/main/resources/schema-postgresql.sql | 14 ++++++++------
alpha/alpha-server/src/test/resources/schema.sql | 8 ++++----
6 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/GlobalTxEvent.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/GlobalTxEvent.java
index bb3ff8b..cc6e155 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/GlobalTxEvent.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/GlobalTxEvent.java
@@ -31,7 +31,7 @@ public class GlobalTxEvent {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
+ private Long surrogateId;
private String globalTxId;
private String localTxId;
private String parentTxId;
@@ -59,7 +59,7 @@ public class GlobalTxEvent {
}
public Long getId() {
- return id;
+ return surrogateId;
}
public String getGlobalTxId() {
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEvent.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEvent.java
index f0cf53b..b9fc49f 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEvent.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEvent.java
@@ -31,7 +31,7 @@ public class ParticipatedEvent {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
+ private Long surrogateId;
private String globalTxId;
private String localTxId;
private String parentTxId;
@@ -61,11 +61,7 @@ public class ParticipatedEvent {
}
public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
+ return surrogateId;
}
public String getGlobalTxId() {
diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEventHistory.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEventHistory.java
index 5a82a88..f7f560c 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEventHistory.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/jpa/ParticipatedEventHistory.java
@@ -30,7 +30,7 @@ public class ParticipatedEventHistory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
+ private Long surrogateId;
private String globalTxId;
private String localTxId;
private String parentTxId;
diff --git a/alpha/alpha-server/src/main/resources/schema-mysql.sql b/alpha/alpha-server/src/main/resources/schema-mysql.sql
index 862c043..809cf8a 100644
--- a/alpha/alpha-server/src/main/resources/schema-mysql.sql
+++ b/alpha/alpha-server/src/main/resources/schema-mysql.sql
@@ -68,7 +68,7 @@ CREATE TABLE IF NOT EXISTS TxTimeout (
) DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS tcc_global_tx_event (
- id bigint NOT NULL AUTO_INCREMENT,
+ surrogateId bigint NOT NULL AUTO_INCREMENT,
globalTxId varchar(36) NOT NULL,
localTxId varchar(36) NOT NULL,
parentTxId varchar(36) DEFAULT NULL,
@@ -77,12 +77,12 @@ CREATE TABLE IF NOT EXISTS tcc_global_tx_event (
txType varchar(12),
creationTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
lastModified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id),
+ PRIMARY KEY (surrogateId),
UNIQUE INDEX tcc_global_tx_event_index (globalTxId, localTxId, parentTxId, txType)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS tcc_global_tx_event_history (
- id bigint NOT NULL AUTO_INCREMENT,
+ surrogateId bigint NOT NULL AUTO_INCREMENT,
globalTxId varchar(36) NOT NULL,
localTxId varchar(36) NOT NULL,
parentTxId varchar(36) DEFAULT NULL,
@@ -92,12 +92,12 @@ CREATE TABLE IF NOT EXISTS tcc_global_tx_event_history (
status varchar(12),
creationTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
lastModified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id),
+ PRIMARY KEY (surrogateId),
UNIQUE INDEX tcc_global_tx_event_history_index (globalTxId, localTxId, parentTxId, txType)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS tcc_participate_event (
- id bigint NOT NULL AUTO_INCREMENT,
+ surrogateId bigint NOT NULL AUTO_INCREMENT,
serviceName varchar(36) NOT NULL,
instanceId varchar(36) NOT NULL,
globalTxId varchar(36) NOT NULL,
@@ -108,12 +108,12 @@ CREATE TABLE IF NOT EXISTS tcc_participate_event (
status varchar(50) NOT NULL,
creationTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
lastModified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id),
+ PRIMARY KEY (surrogateId),
UNIQUE INDEX tcc_participate_event_index (globalTxId, localTxId, parentTxId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS tcc_participate_event_history (
- id bigint NOT NULL AUTO_INCREMENT,
+ surrogateId bigint NOT NULL AUTO_INCREMENT,
serviceName varchar(36) NOT NULL,
instanceId varchar(36) NOT NULL,
globalTxId varchar(36) NOT NULL,
@@ -124,6 +124,6 @@ CREATE TABLE IF NOT EXISTS tcc_participate_event_history (
status varchar(50) NOT NULL,
creationTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
lastModified datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (id),
+ PRIMARY KEY (surrogateId),
UNIQUE INDEX tcc_finished_event_index (globalTxId, localTxId, parentTxId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/alpha/alpha-server/src/main/resources/schema-postgresql.sql b/alpha/alpha-server/src/main/resources/schema-postgresql.sql
index 5f81e47..705d14b 100644
--- a/alpha/alpha-server/src/main/resources/schema-postgresql.sql
+++ b/alpha/alpha-server/src/main/resources/schema-postgresql.sql
@@ -70,7 +70,7 @@ CREATE TABLE IF NOT EXISTS TxTimeout (
CREATE INDEX IF NOT EXISTS saga_timeouts_index ON TxTimeout (surrogateId, expiryTime, globalTxId, localTxId, status);
CREATE TABLE IF NOT EXISTS tcc_global_tx_event (
- id BIGSERIAL PRIMARY KEY,
+ surrogateId BIGSERIAL PRIMARY KEY,
globalTxId varchar(36) NOT NULL,
localTxId varchar(36) NOT NULL,
parentTxId varchar(36) DEFAULT NULL,
@@ -79,11 +79,12 @@ CREATE TABLE IF NOT EXISTS tcc_global_tx_event (
txType varchar(12),
creationTime timestamp(6) NOT NULL DEFAULT CURRENT_DATE,
lastModified timestamp(6) NOT NULL DEFAULT CURRENT_DATE
-)
+);
+
CREATE UNIQUE INDEX IF NOT EXISTS tcc_global_tx_event_index ON tcc_global_tx_event (globalTxId, localTxId, parentTxId, txType);
CREATE TABLE IF NOT EXISTS tcc_global_tx_event_history (
- id BIGSERIAL PRIMARY KEY,
+ surrogateId BIGSERIAL PRIMARY KEY,
globalTxId varchar(36) NOT NULL,
localTxId varchar(36) NOT NULL,
parentTxId varchar(36) DEFAULT NULL,
@@ -93,11 +94,12 @@ CREATE TABLE IF NOT EXISTS tcc_global_tx_event_history (
status varchar(12),
creationTime timestamp(6) NOT NULL DEFAULT CURRENT_DATE,
lastModified timestamp(6) NOT NULL DEFAULT CURRENT_DATE
-)
+);
+
CREATE UNIQUE INDEX IF NOT EXISTS tcc_global_tx_event_history_index ON tcc_global_tx_event_history (globalTxId, localTxId, parentTxId, txType);
CREATE TABLE IF NOT EXISTS tcc_participate_event (
- id BIGSERIAL PRIMARY KEY,
+ surrogateId BIGSERIAL PRIMARY KEY,
serviceName varchar(36) NOT NULL,
instanceId varchar(36) NOT NULL,
globalTxId varchar(36) NOT NULL,
@@ -113,7 +115,7 @@ CREATE TABLE IF NOT EXISTS tcc_participate_event (
CREATE UNIQUE INDEX IF NOT EXISTS tcc_participate_event_index ON tcc_participate_event (globalTxId, localTxId, parentTxId);
CREATE TABLE IF NOT EXISTS tcc_participate_event_history (
- id BIGSERIAL PRIMARY KEY,
+ surrogateId BIGSERIAL PRIMARY KEY,
serviceName varchar(36) NOT NULL,
instanceId varchar(36) NOT NULL,
globalTxId varchar(36) NOT NULL,
diff --git a/alpha/alpha-server/src/test/resources/schema.sql b/alpha/alpha-server/src/test/resources/schema.sql
index b184b65..d3f239d 100644
--- a/alpha/alpha-server/src/test/resources/schema.sql
+++ b/alpha/alpha-server/src/test/resources/schema.sql
@@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS TxTimeout (
);
CREATE TABLE IF NOT EXISTS tcc_global_tx_event (
- id bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
+ surrogateId bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
globalTxId varchar(36) NOT NULL,
localTxId varchar(36) NOT NULL,
parentTxId varchar(36) DEFAULT NULL,
@@ -74,7 +74,7 @@ CREATE TABLE IF NOT EXISTS tcc_global_tx_event (
);
CREATE TABLE IF NOT EXISTS tcc_global_tx_event_history (
- id bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
+ surrogateId bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
globalTxId varchar(36) NOT NULL,
localTxId varchar(36) NOT NULL,
parentTxId varchar(36) DEFAULT NULL,
@@ -86,7 +86,7 @@ CREATE TABLE IF NOT EXISTS tcc_global_tx_event_history (
);
CREATE TABLE IF NOT EXISTS tcc_participate_event (
- id bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
+ surrogateId bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
serviceName varchar(36) NOT NULL,
instanceId varchar(36) NOT NULL,
globalTxId varchar(36) NOT NULL,
@@ -100,7 +100,7 @@ CREATE TABLE IF NOT EXISTS tcc_participate_event (
);
CREATE TABLE IF NOT EXISTS tcc_participate_event_history (
- id bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
+ surrogateId bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
serviceName varchar(36) NOT NULL,
instanceId varchar(36) NOT NULL,
globalTxId varchar(36) NOT NULL,