Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fda3ca5
refactor interceptor
Feb 13, 2023
346f0a0
fix cr
Feb 15, 2023
4417621
refactor session.acceptor module:
Feb 15, 2023
486d8d4
refactor session.acceptor module:
Feb 15, 2023
6ba4c0a
skip SessionRegistry#process when interceptor execute fail
Feb 15, 2023
8d45204
fix code
Feb 16, 2023
016a911
Merge branch 'develop' into master
nocvalight Feb 18, 2023
7f44d11
Add BufferdDataWritingEngine and simplify DataNodeServiceImpl
Feb 18, 2023
9731b80
remove Req
Feb 19, 2023
2ffbb15
Merge branch 'master' into refactor_DataNodeService
Feb 20, 2023
4d3923d
fix code
Feb 20, 2023
b40c96b
Merge branch 'master' into refactor_DataNodeService
Feb 20, 2023
24e3f9f
Multi datacenter (#267)
nocvalight Feb 21, 2023
65c82f2
increase remoteSyncSlotLeaderExecutorQueueSize and remoteSyncSlotLead…
nocvalight Feb 22, 2023
96990b7
fix sync delta from remote datacenter (#292)
nocvalight Feb 24, 2023
ee5c2fd
session multi sub counter metric (#294)
nocvalight Feb 24, 2023
926367a
skip maven-surefire-plugin default-test execute (#295)
nocvalight Feb 27, 2023
de957a3
metric sync_delta and sync_all with datacenter label (#298)
nocvalight Feb 28, 2023
508ae48
get remote slottable from local meta leader fail when meta leader not…
nocvalight Mar 1, 2023
f361afa
fix cr
Mar 6, 2023
afae389
fix multi datum map size (#301)
nocvalight Mar 9, 2023
c9cbee4
fix create table sql in mysql (#305)
nocvalight Mar 10, 2023
7aee475
push delay time config (#309)
huanglongchao Mar 31, 2023
eb984a8
metric push delay bucket num 30 -> 10 (#320)
huanglongchao Apr 27, 2023
808b7dc
upload maven fix javadoc rules (#330)
huanglongchao Jul 5, 2023
4d3e142
remove redundant volatile (#329)
ashlee618 Jul 8, 2023
79ffc04
Remove sofa common util stringutil usage (#332)
khotyn Jul 8, 2023
3d8297a
Release/v6.40 (#337)
huanglongchao Dec 1, 2023
0d4ffd5
Release 650 (#351)
huanglongchao May 22, 2024
632e0d6
fix issue: Specified key was too long; max key length is 3072 bytes (…
huan11 Jul 10, 2024
8ef66e5
mrege develope
Feb 5, 2025
b669582
merge master
Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
44 changes: 25 additions & 19 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,30 @@ jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Unit Testt
run: mvn compile -B
&& mvn clean test -DisSkipIntegrationTest=true "-Dtest.logging.level=ERROR" --fail-at-end --batch-mode
- name: Publish Test Report
if: ${{ always() }}
uses: ScaCap/action-surefire-report@v1
with:
fail_on_test_failures: true
skip_publishing: true
- name: Codecov
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: false
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Unit Testt
run: mvn compile -B
&& mvn clean test -DisSkipIntegrationTest=true "-Dtest.logging.level=ERROR" --fail-at-end --batch-mode
- name: Upload heap dump
if: always()
uses: actions/upload-artifact@v2
with:
name: heap-dump
path: /tmp/*.hprof
- name: Publish Test Report
if: ${{ always() }}
uses: ScaCap/action-surefire-report@v1
with:
fail_on_test_failures: true
skip_publishing: true
- name: Codecov
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.9
6.5.1
2 changes: 1 addition & 1 deletion client/all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.alipay.sofa</groupId>
<artifactId>registry-client-all</artifactId>
<version>6.1.9</version>
<version>6.5.1</version>

<name>${project.groupId}:${project.artifactId}</name>
<url>http://github.com/alipay/sofa-registry</url>
Expand Down
2 changes: 1 addition & 1 deletion client/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>registry-client-parent</artifactId>
<version>6.1.9</version>
<version>6.5.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion client/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>registry-client-parent</artifactId>
<version>6.1.9</version>
<version>6.5.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public ServerNode random() {
private void syncServerList() {
String url =
String.format(
"http://%s:%d/api/servers/query",
"http://%s:%d/api/servers/queryWithWeight",
config.getRegistryEndpoint(), config.getRegistryEndpointPort());
Map<String, String> params = new HashMap<String, String>();
params.put("env", config.getEnv());
Expand All @@ -100,6 +100,14 @@ private void syncServerList() {
params.put("instanceId", config.getInstanceId());
try {
String result = HttpClientUtils.get(url, params, config);
if (null == result) {
// when registry not support query with weight , go back
url =
String.format(
"http://%s:%d/api/servers/query",
config.getRegistryEndpoint(), config.getRegistryEndpointPort());
result = HttpClientUtils.get(url, params, config);
}
if (null != result) {
String[] servers = result.split(";");
Set<ServerNode> tempNodes = new HashSet<ServerNode>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.alipay.sofa.registry.client.provider;

import com.alipay.sofa.registry.client.remoting.ServerNode;
import com.alipay.sofa.registry.client.util.StringUtils;
import java.util.Properties;

/**
Expand All @@ -35,6 +36,8 @@ public class DefaultServerNode implements ServerNode {

private Properties properties;

private static final String WEIGHT_KEY = "weight";

/**
* Instantiates a new Default server node.
*
Expand Down Expand Up @@ -80,6 +83,22 @@ public String getUrl() {
return url;
}

@Override
public int getWeight() {
if (null == getProperties()) {
return 0;
}
String weightStr = getProperties().getProperty(WEIGHT_KEY);
if (StringUtils.isBlank(weightStr)) {
return 0;
}
try {
return Integer.parseInt(weightStr);
} catch (NumberFormatException e) {
return 0;
}
}

/**
* Gets properties.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,29 @@ private boolean connect() {
List<ServerNode> serverNodes = new ArrayList<ServerNode>(serverManager.getServerList());
// shuffle server list to make server connections as discrete as possible
Collections.shuffle(serverNodes);
for (ServerNode serverNode : serverNodes) {
int choosed = 0;
for (int i = 0; i < serverNodes.size(); i++) {
try {
connection = connect(serverNode);
// Power of Two Choices
if (serverNodes.size() > 1) {
choosed =
serverNodes.get(i).getWeight()
> serverNodes.get((i + 1) % serverNodes.size()).getWeight()
? (i + 1) % serverNodes.size()
: i;
}
connection = connect(serverNodes.get(choosed));
if (null != connection && connection.isFine()) {
resetRegister();
LOGGER.info("[Connect] Successfully connected to server: {}", serverNode);
LOGGER.info("[Connect] Successfully connected to server: {}", serverNodes.get(choosed));
break;
} else {
recycle(connection);
}

Thread.sleep(random.nextInt(RECONNECTING_DELAY));
} catch (Exception e) {
LOGGER.error("[Connect] Failed trying connect to {}", serverNode, e);
LOGGER.error("[Connect] Failed trying connect to {}", serverNodes.get(choosed), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,11 @@ public interface ServerNode {
* @return the url
*/
String getUrl();

/**
* Gets Weight
*
* @return the weight
*/
int getWeight();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
package com.alipay.sofa.registry.client.provider;

import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyMapOf;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -67,4 +65,36 @@ public void initServerList() throws Exception {
// verify
PowerMockito.verifyStatic(times(4));
}

@Test
public void initServerListCompatible() throws Exception {
// given
PowerMockito.mockStatic(HttpClientUtils.class);
RegistryClientConfig config = mock(RegistryClientConfig.class);

// when
when(config.getSyncConfigRetryInterval()).thenReturn(100);
when(HttpClientUtils.get(
eq("http://null:0/api/servers/queryWithWeight"),
anyMapOf(String.class, String.class),
any(RegistryClientConfig.class)))
.thenReturn(null);
when(HttpClientUtils.get(
eq("http://null:0/api/servers/query"),
anyMapOf(String.class, String.class),
any(RegistryClientConfig.class)))
.thenReturn("127.0.0.1:9600;127.0.0.2:9600");

// then
ServerManager serverManager = new DefaultServerManager(config);

List<ServerNode> serverList = serverManager.getServerList();

assertNotNull(serverList);

Thread.sleep(450);

// verify
PowerMockito.verifyStatic(times(4));
}
}
2 changes: 1 addition & 1 deletion client/log/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>registry-client-parent</artifactId>
<version>6.1.9</version>
<version>6.5.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>registry-parent</artifactId>
<version>6.1.9</version>
<version>6.5.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ ignore:
comment:
behavior: default
layout: reach,diff,flags,files,footer
require_changes: false
require_changes: false
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>registry-parent</artifactId>
<version>6.1.9</version>
<version>6.5.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Loading