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-7359-5fe5fde95b5d97fbbaf09b3efd605bcdb80dd67f
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 54a78939ed71c4bc515a215e0e5eee149dc68c28
Author: Meng Wang <[email protected]>
AuthorDate: Fri Aug 7 04:13:49 2026 -0700

    feat(storage): add storage.warehouse.enabled feature flag (default off) 
(#7359)
    
    ### What changes were proposed in this PR?
    
    First switch of the per-user warehouse feature (umbrella #6870): a new
    `storage.warehouse.enabled` config key (default **off**, overridable via
    `STORAGE_WAREHOUSE_ENABLED`) and the derived gate
    `StorageConfig.warehouseEnabled`, which is on only when the switch is on
    **and** the deployment uses the REST (Lakekeeper) catalog — per-user
    warehouses are Lakekeeper entities, so any other catalog type keeps the
    feature off regardless of the switch.
    
    On its own this changes nothing: nothing reads the gate yet. The
    follow-up PRs check `warehouseEnabled` to decide whether to expose the
    warehouse API/UI and route executions; the explicit read-path failure
    semantics described in #6930 land with those PRs, since they need the
    warehouse-aware read path from #6944.
    
    ### Any related issues, documentation, discussions?
    
    Closes #6930. Part of #6870 (design discussions #5293 and #6040).
    
    ### How was this PR tested?
    
    `StorageConfigSpec` gains two cases: the default stays off (guarded on
    the env override being unset) and the env-var override name. Verified
    locally with `sbt "Config/testOnly *StorageConfigSpec"` plus
    scalafmt/scalafix checks; the default-off case was deliberately broken
    once to confirm it fails red.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (claude-fable-5)
---
 common/config/src/main/resources/storage.conf               |  7 +++++++
 .../org/apache/texera/common/config/StorageConfig.scala     |  9 +++++++++
 .../org/apache/texera/common/config/StorageConfigSpec.scala | 13 +++++++++++++
 3 files changed, 29 insertions(+)

diff --git a/common/config/src/main/resources/storage.conf 
b/common/config/src/main/resources/storage.conf
index a9709f9070..b290480843 100644
--- a/common/config/src/main/resources/storage.conf
+++ b/common/config/src/main/resources/storage.conf
@@ -152,6 +152,13 @@ storage {
         interval-minutes = ${?STORAGE_CLEANUP_INTERVAL_MINUTES}
     }
 
+    # Per-user warehouse feature (#6870). One switch that hides the whole 
feature until it
+    # is fully built: merging the warehouse PRs changes nothing while this 
stays off.
+    warehouse {
+        enabled = false
+        enabled = ${?STORAGE_WAREHOUSE_ENABLED}
+    }
+
     # Configuration for Postgres, used for user system data & metadata storage
     jdbc {
         url = 
"jdbc:postgresql://localhost:5432/texera_db?currentSchema=texera_db,public"
diff --git 
a/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala
 
b/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala
index 65eef57d11..2f9a33c291 100644
--- 
a/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala
+++ 
b/common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala
@@ -90,6 +90,12 @@ object StorageConfig {
   val cleanupRetentionHours: Int = 
conf.getInt("storage.cleanup.retention-hours")
   val cleanupIntervalMinutes: Int = 
conf.getInt("storage.cleanup.interval-minutes")
 
+  // Per-user warehouses (#6870). On only when the switch is on AND the 
catalog is REST
+  // (Lakekeeper): warehouses are Lakekeeper entities, so any other catalog 
type keeps
+  // the feature off regardless of the switch.
+  val warehouseEnabled: Boolean =
+    conf.getBoolean("storage.warehouse.enabled") && icebergCatalogType == 
"rest"
+
   // File storage configurations
   val fileStorageDirectoryPath: Path =
     Path
@@ -138,6 +144,9 @@ object StorageConfig {
   val ENV_CLEANUP_RETENTION_HOURS = "STORAGE_CLEANUP_RETENTION_HOURS"
   val ENV_CLEANUP_INTERVAL_MINUTES = "STORAGE_CLEANUP_INTERVAL_MINUTES"
 
+  // Per-user warehouses
+  val ENV_WAREHOUSE_ENABLED = "STORAGE_WAREHOUSE_ENABLED"
+
   // S3
   val ENV_S3_ENDPOINT = "STORAGE_S3_ENDPOINT"
   val ENV_S3_REGION = "STORAGE_S3_REGION"
diff --git 
a/common/config/src/test/scala/org/apache/texera/common/config/StorageConfigSpec.scala
 
b/common/config/src/test/scala/org/apache/texera/common/config/StorageConfigSpec.scala
index a590ebf876..cfc2461ea6 100644
--- 
a/common/config/src/test/scala/org/apache/texera/common/config/StorageConfigSpec.scala
+++ 
b/common/config/src/test/scala/org/apache/texera/common/config/StorageConfigSpec.scala
@@ -49,4 +49,17 @@ class StorageConfigSpec extends AnyFlatSpec with Matchers {
     StorageConfig.ENV_CLEANUP_RETENTION_HOURS shouldBe 
"STORAGE_CLEANUP_RETENTION_HOURS"
     StorageConfig.ENV_CLEANUP_INTERVAL_MINUTES shouldBe 
"STORAGE_CLEANUP_INTERVAL_MINUTES"
   }
+
+  "StorageConfig warehouse settings" should "default the feature to disabled 
so merging changes nothing" in {
+    // storage.warehouse.enabled is the kill switch for the whole per-user 
warehouse
+    // feature (#6870); this guards the safe default from silently flipping to 
true.
+    // Only assert when the env override is unset (e.g. in CI), since it would 
win otherwise.
+    if (sys.env.get(StorageConfig.ENV_WAREHOUSE_ENABLED).isEmpty) {
+      StorageConfig.warehouseEnabled shouldBe false
+    }
+  }
+
+  it should "expose the warehouse environment-variable override name" in {
+    StorageConfig.ENV_WAREHOUSE_ENABLED shouldBe "STORAGE_WAREHOUSE_ENABLED"
+  }
 }

Reply via email to