Skip to content

Commit

Permalink
random node
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaochen-zhou committed Dec 17, 2024
1 parent 17aac54 commit 8be7032
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -287,14 +289,16 @@ public static List<PartitionDefinition> findPartitions(
stringEntity.setContentEncoding("UTF-8");
stringEntity.setContentType("application/json");

String[] feNodes = dorisSourceConfig.getFrontends().split(",");
int feNodesNum = feNodes.length;
List<String> feNodes = Arrays.asList(dorisSourceConfig.getFrontends().split(","));
Collections.shuffle(feNodes);
int feNodesNum = feNodes.size();
String resStr = null;

for (int i = 0; i < feNodesNum; i++) {
try {
HttpPost httpPost =
new HttpPost(getUriStr(feNodes[i], dorisSourceTable, logger) + QUERY_PLAN);
new HttpPost(
getUriStr(feNodes.get(i), dorisSourceTable, logger) + QUERY_PLAN);
httpPost.setEntity(stringEntity);
resStr = send(dorisSourceConfig, httpPost, logger);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ public DorisSinkWriter(

private void initializeLoad() {

String[] feNodes = dorisSinkConfig.getFrontends().split(",");
int feNodesNum = feNodes.length;
List<String> feNodes = Arrays.asList(dorisSinkConfig.getFrontends().split(","));
Collections.shuffle(feNodes);
int feNodesNum = feNodes.size();

for (int i = 0; i < feNodesNum; i++) {
try {
this.dorisStreamLoad =
new DorisStreamLoad(
feNodes[i],
feNodes.get(i),
catalogTable.getTablePath(),
dorisSinkConfig,
labelGenerator,
Expand All @@ -121,7 +122,7 @@ private void initializeLoad() {
}
log.error(
"stream load error for feNode: {} with exception: {}",
feNodes[i],
feNodes.get(i),
e.getMessage());
}
}
Expand Down

0 comments on commit 8be7032

Please sign in to comment.