You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/08/23 16:43:38 UTC
[GitHub] [druid] cryptoe opened a new pull request, #12948: Fixing json creator for s3 storage connector provider
cryptoe opened a new pull request, #12948:
URL: https://github.com/apache/druid/pull/12948
<!-- Thanks for trying to help us make Apache Druid be the best it can be! Please fill out as much of the following information as is possible (where relevant, and remove it when irrelevant) to help make the intention and scope of this PR clear in order to ease review. -->
<!-- Please read the doc for contribution (https://github.com/apache/druid/blob/master/CONTRIBUTING.md) before making this PR. Also, once you open a PR, please _avoid using force pushes and rebasing_ since these make it difficult for reviewers to see what you've changed in response to their reviews. See [the 'If your pull request shows conflicts with master' section](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#if-your-pull-request-shows-conflicts-with-master) for more details. -->
### Description
While trying out the new MSQ task based ingestion, I found a bug in the storage connector where Guice was not finding the 'S3OutputConfig`.
```
DurableStorageConfiguration: Durable storage mode can only be enabled when druid.msq.intermediate.storage.enable is set to true and the connector is configured correctly. Check the documentation on how to enable durable storage mode. If you want to still query without durable storage mode, set durableShuffleStorage to false in the query context. Got error com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Could not find a suitable constructor in org.apache.druid.storage.s3.output.S3OutputConfig. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at org.apache.druid.storage.s3.output.S3OutputConfig.class(S3OutputConfig.java:53)
while locating org.apache.druid.storage.s3.output.S3OutputConfig
at org.apache.druid.guice.JsonConfigProvider.bind(JsonConfigProvider.java:151) (via modules: com.google.inject.util.Modules$OverrideModule
```
<!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
<!-- If you are a committer, follow the PR action item checklist for committers:
https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
<!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
<!-- Describe your patch: what did you change in code? How did you fix the problem? -->
<!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
#### Fixed the bug ...
<!--
In each section, please describe design decisions made, including:
- Choice of algorithms
- Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
- Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
- Method organization and design (how the logic is split between methods, parameters and return types)
- Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
-->
<!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
<!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
<!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
<hr>
##### Key changed/added classes in this PR
* `S3StorageConnectorProvider`
<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:
- [x] 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.
- [ ] 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.
- [x] 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
[GitHub] [druid] rohangarg commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
rohangarg commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1226792775
The example only allows one binding per namespace and prefix. If more than one binding is tried for the same namespace, the guice injector will throw a binding error.
BTW, the current example works on simple `Provider` interface where the instance creator doesn't accept the `property_prefix` to create objects with different properties at runtime. For such case where the provider is meant to be more like a factory, we'd could try to use `FactoryProvider` from guice or do a semantic implementation of factory using `Provider` ourselves.
--
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
[GitHub] [druid] cryptoe commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
cryptoe commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1225755954
@gianm managed to cook up a UT.
--
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
[GitHub] [druid] cryptoe commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
cryptoe commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1226720538
Thanks for the experimentation. I guess it still won't work. We wanna define the choice on a suffix of the property type and bind it to the choice provider only once.
```
xxxx.type="choiceA"
xxxx.choiceA_path
xxxx. choiceA_base
```
Similarly in another extension, we can have
````
yyyy.type="choiceB"
yyyy.choiceB_dir
yyyy.choiceB_count
````
```
zzzz.type="choiceA"
zzzz.choiceA_path
zzzz. choiceA_base
```
--
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
[GitHub] [druid] gianm commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
gianm commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1225805934
LGTM still after CI passes.
About PolyBind, as far as I know it can only work with a single property. Since we want multiple connected properties here, I think we need the JsonConfigurator.
--
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
[GitHub] [druid] rohangarg commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
rohangarg commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1225768999
A doubt I had was that is it possible to do the `StorageConnector` injection via `PolyBind` instead of `JsonConfigurator`? `PolyBind` provides support to add multiple implementations of an interface via a `MapBinder` and also provides to choose between them using a user property via `createChoice` method.
If that's possible, then the `StorageConnector` interface could be implemented as a simple guice injectable object in the extensions. The `StorageConnectorProvider` then would be replaced by `ConffigedProvider` which is an implementation detail of `PolyBind`.
--
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
[GitHub] [druid] cryptoe commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
cryptoe commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1224345951
I was planning to add one integration test once https://github.com/apache/druid/pull/12918 is merged.
--
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
[GitHub] [druid] cryptoe commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
cryptoe commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1225780309
IIRC I tried using the polybind first.
Where it fell short was I wanted "namespaced" config providers.
If you check out the test case, I registered a custom extension with a custom namespace.
Now you can have multiple such namespaces on the same JVM.
--
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
[GitHub] [druid] abhishekagarwal87 merged pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 merged PR #12948:
URL: https://github.com/apache/druid/pull/12948
--
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
[GitHub] [druid] rohangarg commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
rohangarg commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1225806457
Thanks for the explanation!
> Now you can have multiple such namespaces on the same JVM.
That means each "choice" has a custom prefix with the name of the extension.
Can we provide a named annotated choice to `PolyBind` using something like you've used in test (`Key.get(StorageConnectorProvider.class, Names.named(CUSTOM_NAMESPACE))`)? Then for each `(property, extension)` pair, the PolyBind will have different choices where the `property` is passed in the `createChoice` method as is and the `extension` is passed as a part of the `Key` object for `interfaceKey` parameter.
--
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
[GitHub] [druid] rohangarg commented on pull request #12948: Fixing json creator for s3 storage connector provider
Posted by GitBox <gi...@apache.org>.
rohangarg commented on PR #12948:
URL: https://github.com/apache/druid/pull/12948#issuecomment-1225934327
@gianm @cryptoe : I tried some experiment with `PolyBind` locally and wasn't able to make it work out of the box due to errors with multiple bindings via multiple choices to the same interface.
I added a new method to do named binding in `PolyBind` and was able to construct a test : https://gist.github.com/rohangarg/838489720d0ef5093fe60df7f7b922d7
Can you please take a look and see if it seems right and that fits the `StorageConnector` usecase? One thing I'm not sure right now is of the `Singleton` nature of objects created by the `ConfiggedProvider`.
BTW, the investigation need not block the current changes in this PR from my side.
--
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