You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "IsmailTosunTnyl (via GitHub)" <gi...@apache.org> on 2026/05/03 15:38:41 UTC
[PR] [fix](cloud) Generate unique cloudUniqueId per backend node in addBackends [doris]
IsmailTosunTnyl opened a new pull request, #62993:
URL: https://github.com/apache/doris/pull/62993
…kends
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Problem Summary: When multiple backends are added simultaneously via
`ALTER SYSTEM ADD BACKEND "host1:port1", "host2:port2"`, all nodes were
assigned the same `cloudUniqueId` because the ID was generated once
before the loop. Move the generation inside the loop so each node gets
its own unique ID.
#### Before
<img width="2139" height="1159" alt="before" src="https://github.com/user-attachments/assets/763cabeb-bc5d-4b6d-8a22-6a8d60fe6feb" />
#### After
<img width="2139" height="1159" alt="Paste" src="https://github.com/user-attachments/assets/9a5b5338-4c97-49e4-a8bd-96f6f508b757" />
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] Unit Test
- [x] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](cloud) Generate unique cloudUniqueId per backend node in addBackends [doris]
Posted by "github-actions[bot] (via GitHub) via commits" <co...@doris.apache.org>.
github-actions[bot] closed pull request #62993: [fix](cloud) Generate unique cloudUniqueId per backend node in addBackends
URL: https://github.com/apache/doris/pull/62993
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](cloud) Generate unique cloudUniqueId per backend node in addBackends [doris]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #62993:
URL: https://github.com/apache/doris/pull/62993#discussion_r3178347524
##########
fe/fe-core/src/test/java/org/apache/doris/cloud/system/CloudSystemInfoServiceTest.java:
##########
@@ -973,6 +983,52 @@ public void testGetMinPipelineExecutorSizeWithConnectContext() {
}
}
+ @Test
+ public void testAddBackendsGenerateUniqueCloudUniqueIdPerBackend() throws Exception {
+ infoService = new CloudSystemInfoService();
+
+ CloudEnv cloudEnv = Mockito.mock(CloudEnv.class);
+ MetaServiceProxy metaServiceProxy = Mockito.mock(MetaServiceProxy.class);
+ AtomicReference<Cloud.AlterClusterRequest> addNodeRequestRef = new AtomicReference<>();
+
+ Mockito.when(cloudEnv.getCloudInstanceId()).thenReturn("instance-test");
+
+ try (MockedStatic<Env> mockedEnv = Mockito.mockStatic(Env.class);
+ MockedStatic<MetaServiceProxy> mockedMetaServiceProxy = Mockito.mockStatic(MetaServiceProxy.class)) {
+ mockedEnv.when(Env::getCurrentEnv).thenReturn(cloudEnv);
+ mockedMetaServiceProxy.when(MetaServiceProxy::getInstance).thenReturn(metaServiceProxy);
+
+ Mockito.when(metaServiceProxy.alterCluster(Mockito.any())).thenAnswer(invocation -> {
+ Cloud.AlterClusterRequest request = invocation.getArgument(0);
+ if (request.getOp() == Cloud.AlterClusterRequest.Operation.ADD_NODE) {
+ addNodeRequestRef.set(request);
+ }
+ return Cloud.AlterClusterResponse.newBuilder()
+ .setStatus(Cloud.MetaServiceResponseStatus.newBuilder()
+ .setCode(Cloud.MetaServiceCode.OK)
+ .setMsg("OK"))
+ .build();
+ });
+
+ Map<String, String> tagMap = Tag.DEFAULT_BACKEND_TAG.toMap();
+ tagMap.put(Tag.COMPUTE_GROUP_NAME, "test_compute_group");
+
+ List<HostInfo> hostInfos = new ArrayList<>();
+ hostInfos.add(new HostInfo("192.168.1.189", 9050));
+ hostInfos.add(new HostInfo("192.168.1.189", 9052));
+
+ infoService.addBackends(hostInfos, tagMap);
+ }
+
+ Cloud.AlterClusterRequest addNodeRequest = addNodeRequestRef.get();
+ Assert.assertNotNull(addNodeRequest);
+ Assert.assertEquals(2, addNodeRequest.getCluster().getNodesCount());
+
+ Set<String> cloudUniqueIds = new HashSet<>();
+ addNodeRequest.getCluster().getNodesList().forEach(node -> cloudUniqueIds.add(node.getCloudUniqueId()));
+ Assert.assertEquals(2, cloudUniqueIds.size());
+ }
Review Comment:
This test validates cloudUniqueId uniqueness but depends on RandomIdentifierGenerator/SecureRandom in production code, making it nondeterministic (a rare collision would fail the test even if the logic is correct). Consider mocking RandomIdentifierGenerator.generateRandomIdentifier() to return a deterministic sequence (including the extra call used for computeGroupId) so the assertion is stable and only exercises the intended behavior change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](cloud) Generate unique cloudUniqueId per backend node in addBackends [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62993:
URL: https://github.com/apache/doris/pull/62993#issuecomment-4366534244
Thank you for your contribution to Apache Doris.
Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR).
Please clearly describe your PR:
1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
3. What features were added. Why was this function added?
4. Which code was refactored and why was this part of the code refactored?
5. Which functions were optimized and what is the difference before and after the optimization?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](cloud) Generate unique cloudUniqueId per backend node in addBackends [doris]
Posted by "github-actions[bot] (via GitHub) via commits" <co...@doris.apache.org>.
github-actions[bot] commented on PR #62993:
URL: https://github.com/apache/doris/pull/62993#issuecomment-6536293098
We're closing this PR because it hasn't been updated in a while.
This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and feel free a maintainer to remove the Stale tag!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org