apache/druid · error · IllegalStateException

Cannot delete all segment files from Google Deep Storage sin

Error message

Cannot delete all segment files from Google Deep Storage since druid.google.bucket and druid.google.prefix are not both set.

What it means

GoogleDataSegmentKiller.killAll deletes every segment file under the configured bucket/prefix in Google Deep Storage. It refuses to run (ISE) unless both druid.google.bucket and druid.google.prefix are set in the GoogleAccountConfig, because running without both could delete from the wrong location or fail ambiguously.

Source

Thrown at extensions-core/google-extensions/src/main/java/org/apache/druid/storage/google/GoogleDataSegmentKiller.java:97

    try {
      GoogleUtils.retryGoogleCloudStorageOperation(() -> {
        storage.delete(bucket, path);
        return null;
      });
    }
    catch (StorageException e) {
      throw e;
    }
    catch (Exception e) {
      throw new RE(e, "Failed to delete google cloud storage object from bucket [%s] and path [%s].", bucket, path);
    }
  }

  @Override
  public void killAll() throws IOException
  {
    if (accountConfig.getBucket() == null || accountConfig.getPrefix() == null) {
      throw new ISE(
          "Cannot delete all segment files from Google Deep Storage since druid.google.bucket and druid.google.prefix are not both set.");
    }
    LOG.info(
        "Deleting all segment files from gs location [bucket: '%s' prefix: '%s']",
        accountConfig.getBucket(),
        accountConfig.getPrefix()
    );
    try {
      GoogleUtils.deleteObjectsInPath(
          storage,
          inputDataConfig,
          accountConfig.getBucket(),
          accountConfig.getPrefix(),
          Predicates.alwaysTrue()
      );
    }
    catch (Exception e) {
      LOG.error("Error occurred while deleting task log files from gs. Error: %s", e.getMessage());

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Set both druid.google.bucket and druid.google.prefix in the runtime properties of the node performing killAll
  2. Verify the config is loaded on the correct service (overlord/coordinator doing cleanup)
  3. If bucket/prefix legitimately cannot be set, use per-segment kill instead of killAll

Example fix

// before
# runtime.properties
# druid.google.bucket not set
// after
druid.google.bucket=my-segment-bucket
druid.google.prefix=segments
Defensive patterns

Strategy: validation

Validate before calling

// Before calling killAll
if (System.getProperty("druid.google.bucket") == null || System.getProperty("druid.google.prefix") == null) { throw new IllegalStateException("druid.google.bucket and druid.google.prefix required"); }

Try / catch

try { killer.killAll(); } catch (IllegalStateException e) { LOGGER.error(e, "Fix druid.google.bucket/prefix config"); }

Prevention

When it happens

Trigger: Calling killAll() (e.g. from the task logs cleanup/kill-all endpoint) when the Google account config has a null bucket or null prefix — i.e. auth via other means (service name / credentials) but no explicit bucket+prefix configured.

Common situations: Druid deployments where GCS storage is configured for pushing but druid.google.bucket and druid.google.prefix are not both present in the kill-all node's config; using workload-identity/service-account-based config without bucket/prefix.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/a237bc2f37509982. Report an issue: GitHub.