This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-9028-9302a4ca8f1fd587c8b4d28bb850bafa9c4202ca in repository https://gitbox.apache.org/repos/asf/texera.git
commit 0e6fbf4347645060e2a1c6638d926bafe1d707dc Author: Xinyuan Lin <[email protected]> AuthorDate: Sat Oct 24 05:21:48 2026 +0000 refactor(amber): remove the write-only AmberConfig (#9028) ### What changes were proposed in this PR? Removes the `AmberConfig` object, whose only member, `masterNodeAddr`, is written but never read. **+8/−57 lines.** There is no behaviour change. - **`AmberConfig.scala`:** deleted. - **`AmberRuntime.scala`:** the two `AmberConfig.masterNodeAddr = createMasterAddress(...)` writes in `startActorMaster` / `startActorWorker`, the private `createMasterAddress` helper that only fed them, and the `Address` import. The seed nodes, hostname and actor system the two methods build are unchanged. - **`ScheduleGenerator.scala`:** a ScalaDoc line cited `AmberConfig.maxConcurrentRegions`; the value lives in `ApplicationConfig`. - **`AmberRuntimeSpec`:** drops the save/restore of the global, the sentinel, and the one case that only observed `masterNodeAddr`. Every case covering the surviving `AmberRuntime` behaviour stays. ### History | | | | --- | --- | | **Introduced by** | #811 (2020-08-22), "Merge Amber master into texera master": `masterNodeAddr`, for `ClusterListener` to tell the master node apart. #1439 (2022-02-12) added `createMasterAddress`, and #2245 (2023-12-06) moved the field into `AmberConfig` | | **Usage removed by** | #3029 (2024-12-08), "Create a separate web server for workflow execution". It deleted the last reader, `member.address != AmberConfig.masterNodeAddr` in `ClusterListener`. #3466 (2025-06-13) then moved every other `AmberConfig` member to `common/config`, leaving only this field | It has been write-only for nearly two years. ### Any related issues, documentation, discussions? Closes #9025 ### How was this PR tested? No new tests. `AmberRuntimeSpec` keeps its coverage of the master and worker startup paths. Locally, from the repo root with Java 17: - `sbt "WorkflowExecutionService/Test/compile" "WorkflowExecutionService/scalafmtCheckAll" "WorkflowExecutionService/scalafixAll --check"`: success. - `sbt "WorkflowExecutionService/testOnly *AmberRuntimeSpec *ComputingUnitMasterSpec *ClusterListenerSpec *CostBasedScheduleGeneratorSpec"`: 4 suites, 68 tests, all pass. To re-check: ``` git grep -n -w -e AmberConfig -e masterNodeAddr -e createMasterAddress -- amber # no hits ``` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- .../scheduling/ScheduleGenerator.scala | 2 +- .../texera/amber/engine/common/AmberConfig.scala | 25 ----------------- .../texera/amber/engine/common/AmberRuntime.scala | 6 +--- .../amber/engine/common/AmberRuntimeSpec.scala | 32 ++++------------------ 4 files changed, 8 insertions(+), 57 deletions(-) diff --git a/amber/src/main/scala/org/apache/texera/amber/engine/architecture/scheduling/ScheduleGenerator.scala b/amber/src/main/scala/org/apache/texera/amber/engine/architecture/scheduling/ScheduleGenerator.scala index bde2cb6f01..68124f7687 100644 --- a/amber/src/main/scala/org/apache/texera/amber/engine/architecture/scheduling/ScheduleGenerator.scala +++ b/amber/src/main/scala/org/apache/texera/amber/engine/architecture/scheduling/ScheduleGenerator.scala @@ -46,7 +46,7 @@ abstract class ScheduleGenerator( /** * A schedule is a ranking on the regions of a region plan. - * Regions are dispatched in batches of up to AmberConfig.maxConcurrentRegions, respecting the DAG dependencies. + * Regions are dispatched in batches of up to ApplicationConfig.maxConcurrentRegions, respecting the DAG dependencies. * When maxConcurrentRegions == 1, this is equivalent to a total order (fully sequential execution). */ def generateScheduleFromRegionPlan(regionPlan: RegionPlan): Schedule = { diff --git a/amber/src/main/scala/org/apache/texera/amber/engine/common/AmberConfig.scala b/amber/src/main/scala/org/apache/texera/amber/engine/common/AmberConfig.scala deleted file mode 100644 index 2b05cc771a..0000000000 --- a/amber/src/main/scala/org/apache/texera/amber/engine/common/AmberConfig.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.texera.amber.engine.common - -import org.apache.pekko.actor.Address - -object AmberConfig { - var masterNodeAddr: Address = Address("pekko", "Amber", "localhost", 2552) -} diff --git a/amber/src/main/scala/org/apache/texera/amber/engine/common/AmberRuntime.scala b/amber/src/main/scala/org/apache/texera/amber/engine/common/AmberRuntime.scala index 1993e51073..ffdf3db5ab 100644 --- a/amber/src/main/scala/org/apache/texera/amber/engine/common/AmberRuntime.scala +++ b/amber/src/main/scala/org/apache/texera/amber/engine/common/AmberRuntime.scala @@ -19,7 +19,7 @@ package org.apache.texera.amber.engine.common -import org.apache.pekko.actor.{ActorSystem, Address, Cancellable, DeadLetter, Props} +import org.apache.pekko.actor.{ActorSystem, Cancellable, DeadLetter, Props} import org.apache.pekko.serialization.{Serialization, SerializationExtension} import com.typesafe.config.{Config, ConfigFactory} import org.apache.texera.amber.clustering.ClusterListener @@ -85,14 +85,11 @@ object AmberRuntime { """) .withFallback(pekkoConfig) .resolve() - AmberConfig.masterNodeAddr = createMasterAddress(localIpAddress) createAmberSystem(masterConfig) } def pekkoConfig: Config = PekkoConfig.pekkoConfig - private def createMasterAddress(addr: String): Address = Address("pekko", "Amber", addr, 2552) - def startActorWorker(mainNodeAddress: Option[String]): Unit = { val addr = mainNodeAddress.getOrElse("localhost") var localIpAddress = "localhost" @@ -107,7 +104,6 @@ object AmberRuntime { """) .withFallback(pekkoConfig) .resolve() - AmberConfig.masterNodeAddr = createMasterAddress(addr) createAmberSystem(workerConfig) } diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/common/AmberRuntimeSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/common/AmberRuntimeSpec.scala index 510764689d..43ec741f68 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/common/AmberRuntimeSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/common/AmberRuntimeSpec.scala @@ -20,7 +20,7 @@ package org.apache.texera.amber.engine.common import com.typesafe.config.Config -import org.apache.pekko.actor.{ActorRef, ActorSystem, Address, DeadLetter} +import org.apache.pekko.actor.{ActorRef, ActorSystem, DeadLetter} import org.apache.pekko.serialization.{Serialization, SerializationExtension} import org.apache.pekko.testkit.TestKit import org.apache.texera.amber.clustering.ClusterListener @@ -67,16 +67,14 @@ import scala.util.Try * `SessionState` registry — and amber runs its suites in ONE shared JVM, where * `ClusterListenerSpec` holds live per-test ScalaMock sessions in exactly that * registry. `ComputingUnitMasterSpec` refuses this path for the same reason. - * `createMasterAddress` is still covered, via `startActorWorker`. * * JVM-global state: this object IS the global other amber suites depend on, and sbt * runs them concurrently in one JVM without forking. Every global this spec touches - * (`_actorSystem`, `_serde`, `AmberConfig.masterNodeAddr`, - * `ClusterListener.numWorkerNodesInCluster`) is saved in `beforeAll` and put back in - * `afterAll` — the save/restore camp of `HDFSRecordStorageSpec` / - * `ComputingUnitMasterSpec`, not the null-out camp, because nulling makes - * `AmberRuntime.serde` take its bootstrap branch mid-run inside a sibling suite and - * spin up a system nobody shuts down. Tests that have to write those globals + * (`_actorSystem`, `_serde`, `ClusterListener.numWorkerNodesInCluster`) is saved in + * `beforeAll` and put back in `afterAll` — the save/restore camp of + * `HDFSRecordStorageSpec` / `ComputingUnitMasterSpec`, not the null-out camp, because + * nulling makes `AmberRuntime.serde` take its bootstrap branch mid-run inside a sibling + * suite and spin up a system nobody shuts down. Tests that have to write those globals * themselves restore them in a `finally` rather than deferring to `afterAll`, so the * write window is one test long. */ @@ -104,14 +102,12 @@ class AmberRuntimeSpec extends AnyFlatSpec with BeforeAndAfterAll { private var previousActorSystem: AnyRef = _ private var previousSerde: AnyRef = _ - private var previousMasterNodeAddr: Address = _ private var previousNodeCount: Int = 0 override protected def beforeAll(): Unit = { super.beforeAll() previousActorSystem = getAmberRuntimeField("_actorSystem") previousSerde = getAmberRuntimeField("_serde") - previousMasterNodeAddr = AmberConfig.masterNodeAddr previousNodeCount = ClusterListener.numWorkerNodesInCluster setAmberRuntimeField("_actorSystem", testSystem) setAmberRuntimeField("_serde", testSerde) @@ -120,7 +116,6 @@ class AmberRuntimeSpec extends AnyFlatSpec with BeforeAndAfterAll { override protected def afterAll(): Unit = { setAmberRuntimeField("_serde", previousSerde) setAmberRuntimeField("_actorSystem", previousActorSystem) - AmberConfig.masterNodeAddr = previousMasterNodeAddr // Belt and braces: the worker system's seed list points at localhost:2552, so on // a host that happens to be running a local coordinator it could in principle // join and have ClusterListener bump this count. @@ -275,7 +270,6 @@ class AmberRuntimeSpec extends AnyFlatSpec with BeforeAndAfterAll { private case class WorkerStartup( systemName: String, config: Config, - masterNodeAddr: Address, rawSerdeAfterCall: AnyRef, serdeSystemIsCreatedSystem: Boolean, clusterInfoPath: Option[String], @@ -284,10 +278,6 @@ class AmberRuntimeSpec extends AnyFlatSpec with BeforeAndAfterAll { ) private lazy val workerStartup: WorkerStartup = { - // A sentinel is mandatory: AmberConfig.masterNodeAddr's DEFAULT is already - // Address("pekko", "Amber", "localhost", 2552), so without this the - // masterNodeAddr case would assert a value that held before the call. - AmberConfig.masterNodeAddr = Address("pekko", "Sentinel", "nowhere", 1) setAmberRuntimeField("_actorSystem", null) setAmberRuntimeField("_serde", null) var created: ActorSystem = null @@ -299,7 +289,6 @@ class AmberRuntimeSpec extends AnyFlatSpec with BeforeAndAfterAll { WorkerStartup( systemName = created.name, config = created.settings.config, - masterNodeAddr = AmberConfig.masterNodeAddr, // Captured BEFORE anything calls AmberRuntime.serde: with _actorSystem now // set, the getter would lazily rebuild an equivalent serde over the same // system, so asserting through it would pass even with the write deleted. @@ -361,15 +350,6 @@ class AmberRuntimeSpec extends AnyFlatSpec with BeforeAndAfterAll { ) } - it should "publish the master node address" in { - // Characterization, not a live contract: `AmberConfig.masterNodeAddr` is written - // here and by startActorMaster and read nowhere in the repo. It is asserted - // because it is the only observable output of `createMasterAddress`, so the - // address this method derives from `mainNodeAddress` stays pinned in case a - // reader comes back. - assert(workerStartup.masterNodeAddr == Address("pekko", "Amber", "localhost", 2552)) - } - "AmberRuntime.createAmberSystem" should "name the system Amber and attach both children" in { // Paths, which is what callers depend on: DeployStrategies and the frontend's cluster badge // reach these actors by path, so a rename breaks them with no compile error.
