Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature:init Namingserver server #6538

Merged
merged 33 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
50c77dc
add signature
ggbocoder Jan 2, 2024
b36f5b2
Merge remote-tracking branch 'upstream/2.x' into 2.x
ggbocoder Jan 20, 2024
e15537d
Merge remote-tracking branch 'upstream/2.x' into 2.x
ggbocoder Jan 25, 2024
85398ec
Merge remote-tracking branch 'upstream/2.x' into 2.x
ggbocoder Jan 31, 2024
e049125
Merge remote-tracking branch 'upstream/2.x' into 2.x
ggbocoder Mar 7, 2024
2939f59
Merge remote-tracking branch 'upstream/2.x' into 2.x
ggbocoder May 12, 2024
c2bf8c3
init namingserver-server
ggbocoder May 12, 2024
4d50d79
fix ci
ggbocoder May 13, 2024
b9b899b
fix ci
ggbocoder May 13, 2024
2abe43e
fix ci
ggbocoder May 13, 2024
0e72bf7
register
ggbocoder Jul 4, 2024
b9e58e8
Merge remote-tracking branch 'upstream/2.x' into namingserver-server
ggbocoder Jul 9, 2024
801744b
merge
ggbocoder Jul 9, 2024
a95c480
Merge remote-tracking branch 'upstream/2.x' into namingserver-server
ggbocoder Jul 15, 2024
c494e91
add tests
ggbocoder Jul 15, 2024
527e820
add licenses
ggbocoder Jul 16, 2024
f9c7604
add licenses
ggbocoder Jul 16, 2024
e28ab6e
Merge branch '2.x' into namingserver-server
funky-eyes Jul 17, 2024
f4654b4
optimize
ggbocoder Jul 17, 2024
5a51c56
Merge remote-tracking branch 'origin/namingserver-server' into naming…
ggbocoder Jul 17, 2024
fac38e0
optimize
ggbocoder Jul 18, 2024
6d5cbfd
register when startup
ggbocoder Jul 18, 2024
4e9bb36
code format
ggbocoder Jul 18, 2024
a1eab1c
fix some problems
ggbocoder Jul 23, 2024
348d9b5
opt
ggbocoder Jul 24, 2024
f4e527b
pass ci
ggbocoder Jul 24, 2024
1065d86
fix some problems
ggbocoder Jul 26, 2024
0f2508f
fix some problems
ggbocoder Jul 28, 2024
523b9aa
Merge remote-tracking branch 'upstream/2.x' into namingserver-server
ggbocoder Jul 28, 2024
3996536
fix
ggbocoder Jul 28, 2024
f23a3e4
fix UT
ggbocoder Jul 30, 2024
ff44185
fix UT
ggbocoder Jul 30, 2024
e784690
Merge branch '2.x' into namingserver-server
funky-eyes Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Add changes here for all PR submitted to the 2.x branch.
### feature:
- [[#6226](https://github.com/apache/incubator-seata/pull/6226)] multi-version seata protocol support
- [[#6537](https://github.com/apache/incubator-seata/pull/6537)] support Namingserver

- [[#6538](https://github.com/apache/incubator-seata/pull/6538)] Integration of naming server on the Seata server side
### bugfix:
- [[#6592](https://github.com/apache/incubator-seata/pull/6592)] fix @Async annotation not working in ClusterWatcherManager
- [[#6624](https://github.com/apache/incubator-seata/pull/6624)] fix Alibaba Dubbo convert error
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### feature:
- [[#6226](https://github.com/apache/incubator-seata/pull/6226)] 支持seata私有协议多版本兼容
- [[#6537](https://github.com/apache/incubator-seata/pull/6537)] 支持 Namingserver
- [[#6538](https://github.com/apache/incubator-seata/pull/6538)] seata server端集成naming server

### bugfix:
- [[#6592](https://github.com/apache/incubator-seata/pull/6592)] fix @Async注解ClusterWatcherManager中不生效的问题
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,11 @@ public interface ConfigurationKeys {
*/
String SERVER_ENABLE_CHECK_AUTH = SERVER_PREFIX + "enableCheckAuth";

/**
* The constant NAMING_SERVER
*/
String NAMING_SERVER = "namingserver";

/**
* The constant APPLICATION_ID.
*/
Expand Down Expand Up @@ -1011,4 +1016,14 @@ public interface ConfigurationKeys {
* The constant ROCKET_MQ_MSG_TIMEOUT
*/
String ROCKET_MQ_MSG_TIMEOUT = SERVER_PREFIX + "rocketmqMsgTimeout";

/**
* The constant REGISTRY_NAMINGSERVER_CLUSTER
*/
String REGISTRY_NAMINGSERVER_CLUSTER = FILE_ROOT_REGISTRY + NAMING_SERVER + "cluster";

/**
* The constant MAPPING_TABLE_NAME
*/
String MAPPING_TABLE_NAME = STORE_DB_PREFIX + "mapping-table";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.seata.namingserver.constants;
package org.apache.seata.common;

public interface NamingServerConstants {
/**
Expand Down Expand Up @@ -46,4 +46,24 @@ public interface NamingServerConstants {
* The constant IP_PORT_SPLIT_CHAR
*/
String IP_PORT_SPLIT_CHAR = ":";

/**
* The constant DEFAULT_VGROUP_MAPPING
*/
String DEFAULT_VGROUP_MAPPING = "vgroup_table";

/**
* The constant NAMESPACE_KEY
*/
String NAMESPACE_KEY = "seata.registry.namingserver.namespace";
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved

/**
* The constant CLUSTER_NAME_KEY
*/
String CLUSTER_NAME_KEY = "seata.registry.namingserver.cluster";
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved

/**
* The constant META_PREFIX
*/
String META_PREFIX = "seata.registry.metadata.";
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ public enum ErrorCode {
/**
* 0001 ~ 0099 Configuration related errors
*/
ERR_CONFIG(ErrorType.Config, 0001);
ERR_CONFIG(ErrorType.Config, 0001),
/**
* The error code of the transaction exception.
*/


/**
* The error code of the sql exception
*/
ERROR_SQL(ErrorType.Datasource, 0101);

private int code;
private ErrorType type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Cluster {
private String clusterType;
private List<Unit> unitData = new ArrayList<>();


public Cluster() {
}

Expand Down
61 changes: 61 additions & 0 deletions core/src/main/java/org/apache/seata/core/store/MappingDO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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.core.store;
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved

public class MappingDO {
private String namespace;

private String cluster;

private String unit;

private String vGroup;


public String getNamespace() {
return namespace;
}

public void setNamespace(String namespace) {
this.namespace = namespace;
}

public String getCluster() {
return cluster;
}

public void setCluster(String cluster) {
this.cluster = cluster;
}

public String getUnit() {
return unit;
}

public void setUnit(String unit) {
this.unit = unit;
}

public String getVGroup() {
return vGroup;
}

public void setVGroup(String vGroup) {
this.vGroup = vGroup;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.seata.common.metadata.namingserver.Unit;
import org.apache.seata.common.result.Result;
import org.apache.seata.common.util.HttpClientUtil;
import org.apache.seata.namingserver.constants.NamingServerConstants;
import org.apache.seata.common.NamingServerConstants;
import org.apache.seata.namingserver.listener.ClusterChangeEvent;
import org.apache.seata.namingserver.entity.pojo.ClusterData;
import org.apache.seata.namingserver.entity.vo.monitor.ClusterVO;
Expand Down Expand Up @@ -55,7 +55,7 @@
import javax.annotation.PostConstruct;


import static org.apache.seata.namingserver.constants.NamingServerConstants.CONSTANT_GROUP;
import static org.apache.seata.common.NamingServerConstants.CONSTANT_GROUP;

@Component
public class NamingManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.util.UUID;


import static org.apache.seata.namingserver.constants.NamingServerConstants.CONSTANT_GROUP;
import static org.apache.seata.common.NamingServerConstants.CONSTANT_GROUP;
import static org.junit.jupiter.api.Assertions.*;


Expand Down
9 changes: 9 additions & 0 deletions script/server/db/dm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,12 @@ INSERT INTO "SEATA"."DISTRIBUTED_LOCK" ("LOCK_KEY", "LOCK_VALUE", "EXPIRE") VALU
INSERT INTO "SEATA"."DISTRIBUTED_LOCK" ("LOCK_KEY", "LOCK_VALUE", "EXPIRE") VALUES ('RetryCommitting', ' ', 0);
INSERT INTO "SEATA"."DISTRIBUTED_LOCK" ("LOCK_KEY", "LOCK_VALUE", "EXPIRE") VALUES ('RetryRollbacking', ' ', 0);
INSERT INTO "SEATA"."DISTRIBUTED_LOCK" ("LOCK_KEY", "LOCK_VALUE", "EXPIRE") VALUES ('TxTimeoutCheck', ' ', 0);


CREATE TABLE "SEATA"."VGROUP_TABLE"
(
`VGROUP` VARCHAR2(255),
`NAMESPACE` VARCHAR2(255),
`CLUSTER` VARCHAR2(255),
PRIMARY KEY (`VGROUP`)
);
12 changes: 11 additions & 1 deletion script/server/db/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,14 @@ CREATE TABLE IF NOT EXISTS `distributed_lock`
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);
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`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
7 changes: 7 additions & 0 deletions script/server/db/oracle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,10 @@ INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommit
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)
);
8 changes: 8 additions & 0 deletions script/server/db/postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,11 @@ INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommit
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)
);
9 changes: 9 additions & 0 deletions script/server/db/sqlserver.sql
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,12 @@ INSERT INTO [distributed_lock] (lock_key, lock_value, expire) VALUES ('RetryComm
INSERT INTO [distributed_lock] (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
INSERT INTO [distributed_lock] (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);
INSERT INTO [distributed_lock] (lock_key, lock_value, expire) VALUES ('UndologDelete', ' ', 0);

CREATE TABLE [vgroup_table]
(
[vGroup] nvarchar(255) NOT NULL,
[namespace] nvarchar(255) NOT NULL,
[cluster] nvarchar(255) NOT NULL,
PRIMARY KEY CLUSTERED ([vGroup])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
5 changes: 5 additions & 0 deletions server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
Expand Down
Loading
Loading