Claus Ibsen created CAMEL-27615:
-----------------------------------
Summary: camel-aws2-redshift: no paging, listStatements filters,
missing headers, metadata gaps
Key: CAMEL-27615
URL: https://issues.apache.org/jira/browse/CAMEL-27615
Project: Camel
Issue Type: Bug
Components: camel-aws2
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-aws2-redshift for
CAMEL-23832 (PR https://github.com/apache/camel/pull/30952).
These are separate problems of the component; the descriptions PR only
documents the current behavior.
h4. 1. List operations, describeTable and getStatementResult return only the
first page
Without {{pojoRequest}}, the request builders in {{RedshiftData2Producer}}
({{listDatabases()}}, {{listSchemas()}}, {{listStatements()}},
{{listTables()}}, {{describeTable()}}, {{getStatementResult()}}) never set
{{nextToken}}, and the producer does not read one from a header. The response
carries a {{NextToken}} when more results exist, but a route cannot ask for the
next page without building the SDK request itself. A user with more rows or
tables than one page holds sees only part of the result.
Proposed change: add a {{CamelAwsRedshiftDataNextToken}} header that the
producer passes to these requests, and document that the response holds the
token for the next call.
h4. 2. listStatements ignores the cluster, workgroup and database headers
{{RedshiftData2Producer.listStatements()}} reads only the
{{CamelAwsRedshiftDataRoleLevel}}, {{CamelAwsRedshiftDataStatus}},
{{CamelAwsRedshiftDataStatementName}} and
{{CamelAwsRedshiftDataStatementsMaxResults}} headers. {{ListStatementsRequest}}
also accepts {{ClusterIdentifier}}, {{WorkgroupName}} and {{Database}} as
filters, and the AWS docs require one of the first two for identity-enhanced
role sessions. A route that sets these headers gets the statements of all
clusters and workgroups.
Proposed change: pass {{CamelAwsRedshiftDataClusterIdentifier}},
{{CamelAwsRedshiftDataWorkGroupName}} and {{CamelAwsRedshiftDataDatabase}} to
{{ListStatementsRequest}} as the other operations do.
h4. 3. Several request fields have no header
In header mode, {{RedshiftData2Producer}} has no header for these fields of AWS
SDK 2.57.11:
* {{ResultFormat}}, {{SessionId}}, {{SessionKeepAliveSeconds}} and
{{WaitTimeSeconds}} of {{executeStatement}} and {{batchExecuteStatement}}
* {{Parameters}} and {{ExecutionMode}} of {{batchExecuteStatement}}
* {{WaitTimeSeconds}} of {{getStatementResult}}
A route needs {{pojoRequest=true}} and the full SDK request to use them, for
example to run a batch in {{AUTO_COMMIT}} mode or to wait for a short statement.
Proposed change: add headers for these fields, at least {{WaitTimeSeconds}},
{{ExecutionMode}} and the batch {{Parameters}}.
h4. 4. Wrong javaType of the CamelAwsRedshiftDataSqlParameterList header
{{RedshiftData2Constants.SQL_PARAMETER_LIST}} declares {{javaType =
"List<SqlParameterList>"}}. There is no {{SqlParameterList}} type:
{{RedshiftData2Producer.executeStatement()}} reads a {{List}} of
{{software.amazon.awssdk.services.redshiftdata.model.SqlParameter}}. The
catalog and the Endpoint DSL show the wrong type.
Proposed change: set {{javaType =
"List<software.amazon.awssdk.services.redshiftdata.model.SqlParameter>"}}.
h4. 5. The label path parameter is required but not used
{{RedshiftData2Configuration.label}} is marked {{required = true}}, but it has
no getter or setter, and {{RedshiftData2Component.createEndpoint()}} never uses
{{remaining}}. The value of the path is thrown away.
Proposed change: keep the path for URI compatibility, and make it optional.
h4. 6. operation is required although a header replaces it
{{RedshiftData2Configuration.operation}} has {{@Metadata(required = true)}},
but {{RedshiftData2Producer.determineOperation()}} takes the
{{CamelAwsRedshiftDataOperation}} header first and the option only as a
fallback. Tooling that checks required options, such as the catalog validation,
then flags a route that sets the operation only per message.
Proposed change: drop {{required = true}}, and fail in {{determineOperation()}}
with a clear message when neither the header nor the option is set (today a
missing operation ends in a {{NullPointerException}} in the {{switch}}).
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)