mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 19:18:01 -05:00
fix(emr): keep a cluster's Trino node.id on its coordinator alone (#9829)
A node.id in a cluster's trino-node classification reached its Trino workers too (#9797), so every node had the coordinator's id, where Trino needs it "unique for every node". It stays the coordinator's, and each worker is named after its node's host, as a node given no id is.
This commit is contained in:
1 parent
b7e3126e7a
commit
f0b2c2db2a
3 files changed
+21
-2
No files matched your search
@@ -112,6 +112,8 @@ final class EmrTrino {
|
||||
* other with, which Trino needs with authentication on and every node shares.
|
||||
*/
|
||||
static final String SHARED_SECRET = "internal-communication.shared-secret";
|
||||
/** The property of Trino's {@code node.properties} that names a node, which must be every node's own. */
|
||||
static final String NODE_ID = "node.id";
|
||||
/** The prefix of the variables it writes its catalogs from, one each, the rest of whose name names it. */
|
||||
static final String CATALOG_PREFIX = "FLOCI_TRINO_CATALOG_";
|
||||
/**
|
||||
@@ -251,12 +253,15 @@ final class EmrTrino {
|
||||
/**
|
||||
* A worker's {@code node.properties} additions: the address the other nodes reach it at, its node's
|
||||
* {@code host}, which Trino would otherwise pick from the node's addresses, link-local ones and those of other
|
||||
* networks among them; then the cluster's {@code trino-node}, each in its place.
|
||||
* networks among them; then the cluster's {@code trino-node}, each in its place, but a {@code node.id}, which Trino
|
||||
* needs "unique for every node": that one is the coordinator's, and the entrypoint names a worker after its
|
||||
* node's host, as it does a node given no id.
|
||||
*/
|
||||
static Map<String, String> workerNode(Map<String, String> classification, String host) {
|
||||
Map<String, String> node = new LinkedHashMap<>();
|
||||
node.put("node.internal-address", host);
|
||||
node.putAll(classification);
|
||||
node.remove(NODE_ID);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,18 @@ class EmrTrinoTest {
|
||||
"ip-10-0-0-2.ec2.internal")).split("\n")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aNodeIdTheClusterGivesIsTheCoordinatorsAloneAsTrinoNeedsEveryNodesOwn() {
|
||||
Map<String, String> classification = new LinkedHashMap<>();
|
||||
classification.put("node.id", "coordinator-1");
|
||||
classification.put("node.environment", "production");
|
||||
|
||||
// Each worker is then named after its node's host by the entrypoint, as a node given no id is.
|
||||
assertEquals(List.of("node.internal-address=ip-10-0-0-2.ec2.internal", "node.environment=production"),
|
||||
List.of(EmrTrino.properties(EmrTrino.workerNode(classification, "ip-10-0-0-2.ec2.internal"))
|
||||
.split("\n")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aWorkersCatalogsReachTheMetastoreOnThePrimaryNode() {
|
||||
assertEquals("thrift://ip-10-0-0-1.ec2.internal:9083",
|
||||
|
||||
Reference in new issue
Block a user