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:
Priamo Germosen authored and GitHub committed 2026-11-30 06:57:24 -04:00
1 parent b7e3126e7a
commit f0b2c2db2a
3 files changed
+21 -2

No files matched your search

+3 -1
View File
@@ -871,7 +871,9 @@ holding the driver and its executors, or a command or a script. The cluster itse
The image's own catalogs go, as EMR's Trino has those the cluster configures. `trino-node`'s and `trino-log`'s
properties go into the image's own `node.properties` and `log.properties`, after its lines, a property given twice
taking the later, so an image of `trino.image`'s keeps its settings where the cluster gives none, and Floci names the
node, with hyphens for the host name's dots, only where neither gives it an id; and the variables `trino-env`'s nested
node, with hyphens for the host name's dots, only where neither gives it an id; a `node.id` of `trino-node`'s is the
coordinator's alone, as Trino needs it "unique for every node", each worker named after its node's host; and the
variables `trino-env`'s nested
`export` gives, as "If any classification ends in env, use the export sub-classification", are Trino's environment,
which a catalog reads as `${ENV:NAME}` where its connector takes Trino's configuration, as Iceberg's and the memory
connector's do, after Floci's own AWS settings, which they may change. `trino-exchange-manager`, which on EMR
@@ -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",