You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "adarshsanjeev (via GitHub)" <gi...@apache.org> on 2024/05/08 08:13:59 UTC

[PR] Remove tempStorageDirectory and rely on task dir instead (druid)

adarshsanjeev opened a new pull request, #16416:
URL: https://github.com/apache/druid/pull/16416

   Removes the temporary directory used by durable storage and export, from a user configured value. This PR instead reuses the temporary storage configured for the task. 
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [ ] been self-reviewed.
      - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1595040196


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnector.java:
##########
@@ -73,7 +77,7 @@ public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(Stri
   public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(String path, long from, long size)
   {
     ChunkingStorageConnectorParameters.Builder<AzureInputRange> parameters = new ChunkingStorageConnectorParameters.Builder<>();
-    parameters.tempDirSupplier(config::getTempDir);
+    parameters.tempDirSupplier(() -> tempFile);

Review Comment:
   Refactored this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev closed pull request #16416: Remove tempStorageDirectory and rely on task dir instead
URL: https://github.com/apache/druid/pull/16416


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "LakshSingla (via GitHub)" <gi...@apache.org>.
LakshSingla commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1630887384


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQDurableStorageModule.java:
##########
@@ -84,10 +83,6 @@ public void configure(Binder binder)
           MultiStageQuery.class
       );
 
-      binder.bind(Key.get(StorageConnector.class, MultiStageQuery.class))
-            .toProvider(Key.get(StorageConnectorProvider.class, MultiStageQuery.class))
-            .in(LazySingleton.class);
-

Review Comment:
   Why is this change required? Do we still preserve the singleton nature of the storage connector? Also, we should still preserve the binding annotation. 



##########
processing/src/main/java/org/apache/druid/storage/StorageConnectorProvider.java:
##########
@@ -20,9 +20,11 @@
 package org.apache.druid.storage;
 
 import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.google.inject.Provider;
+
+import java.io.File;
 
 @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
-public interface StorageConnectorProvider extends Provider<StorageConnector>
+public interface StorageConnectorProvider

Review Comment:
   I am curious why this change is needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "rohangarg (via GitHub)" <gi...@apache.org>.
rohangarg commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1593757310


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnectorProvider.java:
##########
@@ -40,22 +44,24 @@ public class AzureStorageConnectorProvider extends AzureOutputConfig implements
   @Global
   @JacksonInject
   AzureStorage azureStorage;
+  @JacksonInject
+  Injector injector;
 
   @JsonCreator
   public AzureStorageConnectorProvider(
       @JsonProperty(value = "container", required = true) String container,
       @JsonProperty(value = "prefix", required = true) String prefix,
-      @JsonProperty(value = "tempDir", required = true) File tempDir,
       @JsonProperty(value = "chunkSize") @Nullable HumanReadableBytes chunkSize,
       @JsonProperty(value = "maxRetry") @Nullable Integer maxRetry
   )
   {
-    super(container, prefix, tempDir, chunkSize, maxRetry);
+    super(container, prefix, chunkSize, maxRetry);
   }
 
   @Override
   public StorageConnector get()
   {
-    return new AzureStorageConnector(this, azureStorage);
+    final File tempDir = injector.getInstance(Key.get(File.class, Names.named(DataSourceTaskIdHolder.TMP_DIR_BINDING)));

Review Comment:
   Lastly, could be worth having the temp dir instance setup for other processes as well, and also for indexers



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1740553847


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQDurableStorageModule.java:
##########
@@ -84,10 +83,6 @@ public void configure(Binder binder)
           MultiStageQuery.class
       );
 
-      binder.bind(Key.get(StorageConnector.class, MultiStageQuery.class))
-            .toProvider(Key.get(StorageConnectorProvider.class, MultiStageQuery.class))
-            .in(LazySingleton.class);
-

Review Comment:
   Yes, it is currently bound to a single instance



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1593654463


##########
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/output/RetryableS3OutputStream.java:
##########
@@ -106,24 +107,27 @@
   public RetryableS3OutputStream(
       S3OutputConfig config,
       ServerSideEncryptingAmazonS3 s3,
-      String s3Key
+      String s3Key,
+      File tempDir
   ) throws IOException
   {
 
-    this(config, s3, s3Key, true);
+    this(config, s3, s3Key, true, tempDir);
   }
 
   @VisibleForTesting
   protected RetryableS3OutputStream(
       S3OutputConfig config,
       ServerSideEncryptingAmazonS3 s3,
       String s3Key,
-      boolean chunkValidation
+      boolean chunkValidation,

Review Comment:
   ## Useless parameter
   
   The parameter 'chunkValidation' is never used.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/7355)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1598262404


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnectorProvider.java:
##########
@@ -40,22 +44,24 @@ public class AzureStorageConnectorProvider extends AzureOutputConfig implements
   @Global
   @JacksonInject
   AzureStorage azureStorage;
+  @JacksonInject
+  Injector injector;
 
   @JsonCreator
   public AzureStorageConnectorProvider(
       @JsonProperty(value = "container", required = true) String container,
       @JsonProperty(value = "prefix", required = true) String prefix,
-      @JsonProperty(value = "tempDir", required = true) File tempDir,
       @JsonProperty(value = "chunkSize") @Nullable HumanReadableBytes chunkSize,
       @JsonProperty(value = "maxRetry") @Nullable Integer maxRetry
   )
   {
-    super(container, prefix, tempDir, chunkSize, maxRetry);
+    super(container, prefix, chunkSize, maxRetry);
   }
 
   @Override
   public StorageConnector get()
   {
-    return new AzureStorageConnector(this, azureStorage);
+    final File tempDir = injector.getInstance(Key.get(File.class, Names.named(DataSourceTaskIdHolder.TMP_DIR_BINDING)));

Review Comment:
   The above code fails for peons with the error
    ```Guice configuration errors: 1) No implementation for java.io.File annotated with @com.google.inject.name.Named(value="druidTempDirectory") was bound. while locating java.io.File annotated with @com.google.inject.name.Named(value="druidTempDirectory") 1 error```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1595039843


##########
extensions-core/google-extensions/pom.xml:
##########
@@ -153,7 +153,7 @@
             <groupId>org.apache.druid</groupId>
             <artifactId>druid-server</artifactId>
             <version>${project.parent.version}</version>
-            <scope>test</scope>
+            <scope>compile</scope>

Review Comment:
   Changed



##########
docs/multi-stage-query/reference.md:
##########
@@ -186,12 +185,11 @@ Supported arguments for the function:
 
 The following runtime parameters must be configured to export into a GCS destination:
 
-| Runtime Parameter                                | Required | Description                                                                                                                                                                                                                       | Default |
-|--------------------------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
-| `druid.export.storage.google.tempLocalDir`       | Yes      | Directory used on the local storage of the worker to store temporary files required while uploading the data.                                                                                                                     | n/a     |
+| Runtime Parameter                                | Required | Description                                                                                                                                                                                                                   | Default |
+|--------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
 | `druid.export.storage.google.allowedExportPaths` | Yes      | An array of GS prefixes that are allowed as export destinations. Export queries fail if the export destination does not match any of the configured prefixes. Example: `[\"gs://bucket1/export/\", \"gs://bucket2/export/\"]` | n/a     |
-| `druid.export.storage.google.maxRetry`           | No       | Defines the max number times to attempt GS API calls to avoid failures due to transient errors.                                                                                                                                   | 10      |
-| `druid.export.storage.google.chunkSize`          | No       | Defines the size of each chunk to temporarily store in `tempDir`. A large chunk size reduces the API calls to GS; however, it requires more disk space to store the temporary chunks.                                              | 4MiB    |
+| `druid.export.storage.google.maxRetry`           | No       | Defines the max number times to attempt GS API calls to avoid failures due to transient errors.                                                                                                                               | 10      |
+| `druid.export.storage.google.chunkSize`          | No       | Defines the size of each chunk to temporarily store in a local directory while transferring to durable storage. A large chunk size reduces the API calls to GS; however, it requires more disk space to store the temporary chunks.              | 4MiB    |

Review Comment:
   Edited the docs



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "findingrish (via GitHub)" <gi...@apache.org>.
findingrish commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1616259471


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -1537,26 +1537,7 @@ private void handleQueryResults(
     } else if (MSQControllerTask.isExport(querySpec)) {
       // Write manifest file.
       ExportMSQDestination destination = (ExportMSQDestination) querySpec.getDestination();
-      ExportMetadataManager exportMetadataManager = new ExportMetadataManager(destination.getExportStorageProvider());
-
-      final StageId finalStageId = queryKernel.getStageId(queryDef.getFinalStageDefinition().getStageNumber());
-      //noinspection unchecked
-
-
-      Object resultObjectForStage = queryKernel.getResultObjectForStage(finalStageId);
-      if (!(resultObjectForStage instanceof List)) {
-        // This might occur if all workers are running on an older version. We are not able to write a manifest file in this case.
-        log.warn("Was unable to create manifest file due to ");
-        return;
-      }
-      @SuppressWarnings("unchecked")
-      List<String> exportedFiles = (List<String>) queryKernel.getResultObjectForStage(finalStageId);
-      log.info("Query [%s] exported %d files.", queryDef.getQueryId(), exportedFiles.size());
-      exportMetadataManager.writeMetadata(exportedFiles);
-    } else if (MSQControllerTask.isExport(querySpec)) {

Review Comment:
   Curious, why were there two else condition with the same condition originally `MSQControllerTask.isExport(querySpec)`?



##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureOutputConfig.java:
##########
@@ -64,14 +57,12 @@ public class AzureOutputConfig
   public AzureOutputConfig(
       @JsonProperty(value = "container", required = true) String container,
       @JsonProperty(value = "prefix", required = true) String prefix,
-      @JsonProperty(value = "tempDir", required = true) File tempDir,

Review Comment:
   Is this exchanged between the Controller and Workers? Can this change cause any failure during upgrade? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1595043245


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnectorProvider.java:
##########
@@ -40,22 +44,24 @@ public class AzureStorageConnectorProvider extends AzureOutputConfig implements
   @Global
   @JacksonInject
   AzureStorage azureStorage;
+  @JacksonInject
+  Injector injector;
 
   @JsonCreator
   public AzureStorageConnectorProvider(
       @JsonProperty(value = "container", required = true) String container,
       @JsonProperty(value = "prefix", required = true) String prefix,
-      @JsonProperty(value = "tempDir", required = true) File tempDir,
       @JsonProperty(value = "chunkSize") @Nullable HumanReadableBytes chunkSize,
       @JsonProperty(value = "maxRetry") @Nullable Integer maxRetry
   )
   {
-    super(container, prefix, tempDir, chunkSize, maxRetry);
+    super(container, prefix, chunkSize, maxRetry);
   }
 
   @Override
   public StorageConnector get()
   {
-    return new AzureStorageConnector(this, azureStorage);
+    final File tempDir = injector.getInstance(Key.get(File.class, Names.named(DataSourceTaskIdHolder.TMP_DIR_BINDING)));

Review Comment:
   I tried the above initially, but injecting the tempDir as a variable fails (maybe since it is a jackson inject, and that binding has not been added?).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "rohangarg (via GitHub)" <gi...@apache.org>.
rohangarg commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1596625530


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnectorProvider.java:
##########
@@ -40,22 +44,24 @@ public class AzureStorageConnectorProvider extends AzureOutputConfig implements
   @Global
   @JacksonInject
   AzureStorage azureStorage;
+  @JacksonInject
+  Injector injector;
 
   @JsonCreator
   public AzureStorageConnectorProvider(
       @JsonProperty(value = "container", required = true) String container,
       @JsonProperty(value = "prefix", required = true) String prefix,
-      @JsonProperty(value = "tempDir", required = true) File tempDir,
       @JsonProperty(value = "chunkSize") @Nullable HumanReadableBytes chunkSize,
       @JsonProperty(value = "maxRetry") @Nullable Integer maxRetry
   )
   {
-    super(container, prefix, tempDir, chunkSize, maxRetry);
+    super(container, prefix, chunkSize, maxRetry);
   }
 
   @Override
   public StorageConnector get()
   {
-    return new AzureStorageConnector(this, azureStorage);
+    final File tempDir = injector.getInstance(Key.get(File.class, Names.named(DataSourceTaskIdHolder.TMP_DIR_BINDING)));

Review Comment:
   does it fail for processes which are not peons? if that's the case you can try also marking this `Nullable` 
   also, if you have the error available, please feel free to paste it here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "rohangarg (via GitHub)" <gi...@apache.org>.
rohangarg commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1593751306


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnectorProvider.java:
##########
@@ -40,22 +44,24 @@ public class AzureStorageConnectorProvider extends AzureOutputConfig implements
   @Global
   @JacksonInject
   AzureStorage azureStorage;
+  @JacksonInject
+  Injector injector;
 
   @JsonCreator
   public AzureStorageConnectorProvider(
       @JsonProperty(value = "container", required = true) String container,
       @JsonProperty(value = "prefix", required = true) String prefix,
-      @JsonProperty(value = "tempDir", required = true) File tempDir,
       @JsonProperty(value = "chunkSize") @Nullable HumanReadableBytes chunkSize,
       @JsonProperty(value = "maxRetry") @Nullable Integer maxRetry
   )
   {
-    super(container, prefix, tempDir, chunkSize, maxRetry);
+    super(container, prefix, chunkSize, maxRetry);
   }
 
   @Override
   public StorageConnector get()
   {
-    return new AzureStorageConnector(this, azureStorage);
+    final File tempDir = injector.getInstance(Key.get(File.class, Names.named(DataSourceTaskIdHolder.TMP_DIR_BINDING)));

Review Comment:
   Thanks so much for this change @adarshsanjeev :+1: 
   Although, it might be worth checking if you can directly `JacksonInject` the File object - one way to try it could be to do : 
   ```
   @JacksonInject
   @Named(DataSourceTaskIdHolder.TMP_DIR_BINDING)
   File tempDir;
   ```
   
   Also, could consider adding the `JacksonInject` in the constructor itself to keep all the relevant things there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1619883082


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java:
##########
@@ -1537,26 +1537,7 @@ private void handleQueryResults(
     } else if (MSQControllerTask.isExport(querySpec)) {
       // Write manifest file.
       ExportMSQDestination destination = (ExportMSQDestination) querySpec.getDestination();
-      ExportMetadataManager exportMetadataManager = new ExportMetadataManager(destination.getExportStorageProvider());
-
-      final StageId finalStageId = queryKernel.getStageId(queryDef.getFinalStageDefinition().getStageNumber());
-      //noinspection unchecked
-
-
-      Object resultObjectForStage = queryKernel.getResultObjectForStage(finalStageId);
-      if (!(resultObjectForStage instanceof List)) {
-        // This might occur if all workers are running on an older version. We are not able to write a manifest file in this case.
-        log.warn("Was unable to create manifest file due to ");
-        return;
-      }
-      @SuppressWarnings("unchecked")
-      List<String> exportedFiles = (List<String>) queryKernel.getResultObjectForStage(finalStageId);
-      log.info("Query [%s] exported %d files.", queryDef.getQueryId(), exportedFiles.size());
-      exportMetadataManager.writeMetadata(exportedFiles);
-    } else if (MSQControllerTask.isExport(querySpec)) {

Review Comment:
   This is due to a merge from master. Git might have created a new copy of the if condition during the merge. It was added here: https://github.com/apache/druid/pull/16168/files#diff-b9c30db60c6f71d4ccabd6e9ebc8dc1fbeee4db9fca63d5fbaa0ef5833e8e4acL1796.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1619994150


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureOutputConfig.java:
##########
@@ -64,14 +57,12 @@ public class AzureOutputConfig
   public AzureOutputConfig(
       @JsonProperty(value = "container", required = true) String container,
       @JsonProperty(value = "prefix", required = true) String prefix,
-      @JsonProperty(value = "tempDir", required = true) File tempDir,

Review Comment:
   This is created from the runtime properties, and should not be passed between workers. TmpDirectories _should_ not have been passed anywhere, since they are "per peon" properties, and passing the value doesn't make sense.
   
   The only changed class that should have been passed between peons is the exportStorageProvider classes, and these do not contain the tmpDirectory values.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "adarshsanjeev (via GitHub)" <gi...@apache.org>.
adarshsanjeev commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1728596730


##########
processing/src/main/java/org/apache/druid/storage/StorageConnectorProvider.java:
##########
@@ -20,9 +20,11 @@
 package org.apache.druid.storage;
 
 import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.google.inject.Provider;
+
+import java.io.File;
 
 @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
-public interface StorageConnectorProvider extends Provider<StorageConnector>
+public interface StorageConnectorProvider

Review Comment:
   Creating the storageConnector requires passing the tmpDir. This is something that is available when the storage connector is being created, so we can't have a no arguments get() function.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "LakshSingla (via GitHub)" <gi...@apache.org>.
LakshSingla commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1593962502


##########
extensions-core/azure-extensions/pom.xml:
##########
@@ -151,7 +151,7 @@
             <groupId>org.apache.druid</groupId>
             <artifactId>druid-server</artifactId>
             <version>${project.parent.version}</version>
-            <scope>test</scope>
+            <scope>compile</scope>

Review Comment:
   Should move it up with rest of the Druid's dependencies. 
   
   `compile` seems incorrect, I think it should be `provided` ? 



##########
docs/multi-stage-query/reference.md:
##########
@@ -186,12 +185,11 @@ Supported arguments for the function:
 
 The following runtime parameters must be configured to export into a GCS destination:
 
-| Runtime Parameter                                | Required | Description                                                                                                                                                                                                                       | Default |
-|--------------------------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
-| `druid.export.storage.google.tempLocalDir`       | Yes      | Directory used on the local storage of the worker to store temporary files required while uploading the data.                                                                                                                     | n/a     |
+| Runtime Parameter                                | Required | Description                                                                                                                                                                                                                   | Default |
+|--------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
 | `druid.export.storage.google.allowedExportPaths` | Yes      | An array of GS prefixes that are allowed as export destinations. Export queries fail if the export destination does not match any of the configured prefixes. Example: `[\"gs://bucket1/export/\", \"gs://bucket2/export/\"]` | n/a     |
-| `druid.export.storage.google.maxRetry`           | No       | Defines the max number times to attempt GS API calls to avoid failures due to transient errors.                                                                                                                                   | 10      |
-| `druid.export.storage.google.chunkSize`          | No       | Defines the size of each chunk to temporarily store in `tempDir`. A large chunk size reduces the API calls to GS; however, it requires more disk space to store the temporary chunks.                                              | 4MiB    |
+| `druid.export.storage.google.maxRetry`           | No       | Defines the max number times to attempt GS API calls to avoid failures due to transient errors.                                                                                                                               | 10      |
+| `druid.export.storage.google.chunkSize`          | No       | Defines the size of each chunk to temporarily store in a local directory while transferring to durable storage. A large chunk size reduces the API calls to GS; however, it requires more disk space to store the temporary chunks.              | 4MiB    |

Review Comment:
   nit - cleaner
   ```suggestion
   | `druid.export.storage.google.chunkSize`          | No       | Defines the size of each chunk to temporarily store in task's temporary directory while transferring to durable storage. A large chunk size reduces the API calls to GS; however, it requires more disk space to store the temporary chunks.              | 4MiB    |
   ```
   We should make this change for other connectors as well. 



##########
extensions-core/google-extensions/pom.xml:
##########
@@ -153,7 +153,7 @@
             <groupId>org.apache.druid</groupId>
             <artifactId>druid-server</artifactId>
             <version>${project.parent.version}</version>
-            <scope>test</scope>
+            <scope>compile</scope>

Review Comment:
   Same comment as above - compile doesn't seem right to me. 



##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnector.java:
##########
@@ -73,7 +77,7 @@ public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(Stri
   public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(String path, long from, long size)
   {
     ChunkingStorageConnectorParameters.Builder<AzureInputRange> parameters = new ChunkingStorageConnectorParameters.Builder<>();
-    parameters.tempDirSupplier(config::getTempDir);
+    parameters.tempDirSupplier(() -> tempFile);

Review Comment:
   There doesn't seem to be much benefit to keeping it a supplier. We should refactor Supplier<File> to File



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Remove tempStorageDirectory and rely on task dir instead (druid)

Posted by "LakshSingla (via GitHub)" <gi...@apache.org>.
LakshSingla commented on code in PR #16416:
URL: https://github.com/apache/druid/pull/16416#discussion_r1593964059


##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnector.java:
##########
@@ -73,7 +77,7 @@ public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(Stri
   public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(String path, long from, long size)
   {
     ChunkingStorageConnectorParameters.Builder<AzureInputRange> parameters = new ChunkingStorageConnectorParameters.Builder<>();
-    parameters.tempDirSupplier(config::getTempDir);
+    parameters.tempDirSupplier(() -> tempFile);

Review Comment:
   There isn't much benefit in keeping it a supplier. We should refactor Supplier<File> to File



##########
extensions-core/azure-extensions/src/main/java/org/apache/druid/storage/azure/output/AzureStorageConnector.java:
##########
@@ -73,7 +77,7 @@ public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(Stri
   public ChunkingStorageConnectorParameters<AzureInputRange> buildInputParams(String path, long from, long size)
   {
     ChunkingStorageConnectorParameters.Builder<AzureInputRange> parameters = new ChunkingStorageConnectorParameters.Builder<>();
-    parameters.tempDirSupplier(config::getTempDir);
+    parameters.tempDirSupplier(() -> tempFile);

Review Comment:
   There isn't much benefit in keeping it a supplier. We should refactor `Supplier<File>` to `File`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org