Core, REST, AWS: Implement RemoteSigningConfig - #17709
Conversation
This PR implements the changes introduced to the REST spec by apache#16822. In particular, it brings support for the newly-introduced `RemoteSigningConfig` object. This PR also removes signing-related elements that were deprecated for removal in 1.12.0: the legacy signer properties in `S3V4RestSignerClient`, as well as the S3-specific classes that are now orphaned: `S3SignRequest`, `S3SignResponse`, `S3SignRequestParser`, `S3SignResponseParser` and `S3ObjectMapper`.
ff9f453 to
60ed16e
Compare
|
@nastra @dramaticlly FYI |
|
@adutra This doesn't look like it needs to be stacked on the other PR. Can you please split them up? |
| * under the License. | ||
| */ | ||
| package org.apache.iceberg.aws.s3.signer; | ||
| package org.apache.iceberg.rest.signing; |
There was a problem hiding this comment.
I don't think we need to create a new package just for two classes. This makes more sense to just put under org.apache.iceberg.rest
| private final Set<Endpoint> supportedEndpoints; | ||
| private final Map<String, String> catalogProperties; | ||
| private final Object hadoopConf; | ||
| private final RemoteSigningConfig remoteSigningConfig; |
There was a problem hiding this comment.
Why are we adding this to the REST Table? This should only be necessary for the FileIO creation which comes through the table ops.
There was a problem hiding this comment.
Because RESTTableScan creates a dedicated FileIO when FetchPlanningResultResponse.credentials() is non empty.
There was a problem hiding this comment.
I assume the only reason we need that is the PlanID, though? We're not actually creating a new config, it's the same as at the time of load.
| private final ParserContext parserContext; | ||
| private final Map<String, String> catalogProperties; | ||
| private final Object hadoopConf; | ||
| private final RemoteSigningConfig remoteSigningConfig; |
There was a problem hiding this comment.
Same here, I don't think this is necessary. The table ops/fileio is already configured for this. If you're doing remote signing, we don't need to reconfigure at this point (also it would just be applying the same configuration that was loaded from the catalog).
There was a problem hiding this comment.
ok, I think I see now that this is all to plumb through the scan ID for remote scanning. Need to think about this. It looks like we're reserializing the config?
There was a problem hiding this comment.
Yes, I went with the option of serializing the config. That's way easier then passing down the RemoteSigningConfig object through the various FileIO layers until it reaches the signer. Also, that would require creating a serializable impl of RemoteSigningConfig (for Kryo mostly) and also introducing a new SupportsRemoteSigning marker interface to distinguish which FileIO impls support remote signing.
| public static String toJson(RemoteSigningConfig credential) { | ||
| return toJson(credential, false); | ||
| } |
There was a problem hiding this comment.
| public static String toJson(RemoteSigningConfig credential) { | |
| return toJson(credential, false); | |
| } | |
| public static String toJson(RemoteSigningConfig config) { | |
| return toJson(config, false); | |
| } |
Credential?
| private FileIO scanFileIO(List<Credential> storageCredentials) { | ||
| ImmutableMap.Builder<String, String> builder = | ||
| ImmutableMap.<String, String>builder().putAll(catalogProperties); | ||
| ImmutableMap.<String, String>builder() |
There was a problem hiding this comment.
This is a little awkward because we're configuring the remote signing even when it's not configured. Can't we just add the configuration from the provided operations (e.g. `putAll(operations.io().properties()))?
Then I don't think we need to push the config all the way down.
There was a problem hiding this comment.
I asked myself the same question. We could even get rid of the catalogProperties field.
But that would be a semantic change: operations.io().properties() contains 3 layers of properties: catalog properties + table properties (from the load-table-result config) + remote signing properties (set by the catalog).
However, the current code (inadvertently?) constructs the scan FileIO using just the catalog properties, and nothing else.
So, operations.io().properties() indeed contains the remote signing properties that we want, but it also contains the table properties.
IOW, your suggestion would make table properties available to the scan FileIO, while today they aren't.
There was a problem hiding this comment.
If we just want to include the remote signing properties, we can check if endpoint is set (required) and then just extract the signing properties.
You can then ignore the rest of the config, though I didn't think we included all the table properties in the IO config (need to look into that).
| * <p>They are not intended for user-facing configuration, and may be removed or changed in future | ||
| * releases without notice. | ||
| */ | ||
| public final class RemoteSigningProperties { |
There was a problem hiding this comment.
I don't think we need a whole new properties class for three properties. Seems like we should just put these in RESTCatalog properties (we'd be removing two? there anyway)
There was a problem hiding this comment.
But they are not meant to be user-facing (as in: they cannot appear in catalog or table configs). Are you OK with that?
There was a problem hiding this comment.
If we want to protect them, we shouldn't expose them as public. I assume the reason we don't is because of the package boundaries. However, documenting it is sufficient, creating a new class doesn't make them any less accessible and still relies on documentation to tell people not to use them.
Hmm in this case we'd need @dramaticlly to change their PR #17627. They'd need to revert the changes to Are you OK with that @dramaticlly ? In this case we could split as follows:
UPDATE: I already reverted the removal of orphaned classes in this PR. |
Thanks @adutra for the coordination of the PR. I think it make sense for my #17627 to only focus on removing of deprecated class and leave |
This PR implements the changes introduced to the REST spec by #16822. In particular, it brings support for the newly-introduced
RemoteSigningConfigobject.This PR also removes signing-related elements that were deprecated for removal in 1.12.0: the legacy signer properties in
S3V4RestSignerClient, as well as the S3-specific classes that are now orphaned:S3SignRequest,S3SignResponse,S3SignRequestParser,S3SignResponseParserandS3ObjectMapper.This PR may overlap with #17627. I suggest merging #17627 first, then I will update this one accordingly.