* feat(redshift): support COMPUPDATE, STATUPDATE, and TRIMBLANKS in COPY (#7751)
* fix(redshift): keep NULL markers and empty strings correct under COPY TRIMBLANKS (#7751)
Skip trimming for a field that is the NULL marker, and quote a CSV field that trims to an empty string so it is not read as NULL.
* fix(redshift): accept COMPUPDATE PRESET and trim trailing tabs under TRIMBLANKS (#7751)
* feat(redshift): support CopyClusterSnapshot API action (#7748)
* fix(redshift): address review findings and sync docs for CopyClusterSnapshot (#7748)
* refactor(redshift): simplify CopyClusterSnapshot using existing helpers (#7748)
Drop Tags, KmsKeyId and the ARN branch, which CopyClusterSnapshotMessage does not carry.
Reuse validateManualRetention (InvalidRetentionPeriodFault), takenFrom and SnapshotDumpCopier.copy,
and share the automated-snapshot setup across the new tests.
CreateIntegration accepts arn:aws:s3:::bucket with a Serverless namespace or cluster target. The bucket must exist in the integration's Region and have no period in its name, a bucket joins a target once, and a target takes at most 50. The integration reports SourceType s3-event-notifications, starts no poller and publishes no zero-ETL events.
fix(redshift): validate S3 integration source and target identities
fix(redshift): resolve unstored S3 bucket Region in default Region
Fall back to the deployment default Region when an S3 bucket has no stored Region, match bucket partition using RegionResolver.partitionForRegion, and remove the unused two-argument RedshiftZeroEtlEndpoints constructor.
A job stores the parameters of a COPY from S3 in the cluster database, and sys_copy_job lists it with AWS's columns. The checks AWS documents are made when the job is created: an S3 source, an explicit IAM_ROLE, no manifest, access keys, MAXERROR or IGNOREALLERRORS, no hyphen in the name, no transaction block, at most 200 jobs. COPY JOB RUN is refused until files can be loaded automatically.
* feat(redshift): prune external table partitions from query WHERE predicates
Load only the partitions selected by top-level AND predicates of the query WHERE clause for external tables, accumulating partitions across queries and avoiding full scans when specific partitions are requested.
* fix(redshift): handle CASE in partition pruner, overlapping refreshes, and isolate spectrum test schema
* fix(redshift): identify materialized rows by partition and share SQL lexer
Tell materialized external table rows apart by an internal partition identifier column so that refreshing or deleting a partition only deletes its exact rows and never removes rows belonging to partitions whose keys overlap when converted. Dropping a partition no longer reads or authorizes retained overlapping partitions, preventing unauthorized S3 access errors on unselected partitions.
Share tokenization rules between ExternalReferenceScanner and PartitionPruner in SpectrumSqlLexer.
* fix(redshift): hide the partition column behind a view and read strings as strings in the scanner
A partitioned external table kept the partition each row came from in a column of the public table,
so SELECT * returned an extra column and INSERT ... SELECT * could fail on the column count. The rows
now live in a backing table, _floci_spectrum_<table>, and the name the user queries is a view of the
declared columns only. DROP TABLE drops the view and the backing table, and the Data API ListTables
does not list the backing table.
ExternalReferenceScanner took a one-character string such as ';' for a statement separator, which
cleared the table context and let the query skip preparation and its S3 checks. It now reads the
structural characters by token kind.
The pruning integration test used the legacy catalog, whose parser does not read PARTITIONED BY, so
it now creates a Glue database.
* fix(redshift): keep the partition backing table in a schema of its own and send plain batches
The batches that drop and replace the relation of a partitioned external table started with a DO
block. PostgresExtendedBackendSession wraps only batches that start with CREATE or DROP, so an
extended query sent them unchanged and PostgreSQL refused several commands in one prepared
statement. A DO block nested in the wrapper is not valid either, and a schema or table name that
held the dollar-quote tag would have closed the body early. The relation is now dropped with
DROP VIEW or DROP TABLE as the last load made it, so every batch is plain statements.
The backing table was named after the table it backs in the user's schema, so a Glue table of the
same name could drop or reuse it, and the Data API ListTables hid every table with that prefix. It
now lives in the schema floci_spectrum under a name made from the external schema and table, and
ListSchemas and ListTables hide only that schema.
* fix(redshift): load the whole external table when partition keys overlap instead of keeping a backing table
Delete by key value is only safe when no two partitions cast to the same value. When they do (integer 1 and 01, decimal 1.0 and 1.00, boolean true and t), the query reads every partition and a change replaces the whole table. This drops the backing table, view and floci_spectrum schema, which broke dropping a table whose Glue definition gained partition keys, other users' loads, and DROP SCHEMA CASCADE.
* fix(redshift): expect 22P02 SQLSTATE on invalid partition data
* feat(redshift): add PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy
aws_redshift_resource_policy could not be created: the provisioned Redshift API had none of the three operations. They now take the ARN of a Redshift Serverless namespace or a provisioned cluster, the targets of a zero-ETL integration, matched exactly in the caller's account and Region. The policy is kept on its namespace or cluster, so it goes with the resource, and is stored and echoed, not evaluated.
* feat(redshift): return resource policies and their errors as AWS does
Checked against AWS with read-only GetResourcePolicy calls: a stored policy comes back with Version and
Statement first and each statement's Effect, Principal, Action, Resource and Condition first,
pretty-printed, so it is now stored in that form. A namespace that does not exist answers "The requested
namespace doesn't exist."; an ARN in another Region, a namespace id that is not a UUID and an ARN of any
other resource type are InvalidParameterValue with AWS's messages, not UnsupportedOperation.
Adds an SDK compatibility test for the three operations.
* fix(redshift): keep a namespace's resource policy across updates
The Namespace copy constructor, used by tagging, untagging and UpdateNamespace, did not copy the
resource policy, so any of them dropped it. findClusterByArn now reads the ARN through AwsArnUtils.
Without a Version, GetResourcePolicy reached Elastic Load Balancing, which defines the name but does
not serve it; it now goes to Redshift.
* fix(redshift): refuse an empty resource policy before looking the resource up
* feat(redshift): take a DynamoDB table and a Serverless namespace in zero-ETL integrations
CreateIntegration took only a DynamoDB stream ARN as SourceArn and a provisioned cluster ARN as
TargetArn. AWS takes the table ARN and a Redshift Serverless namespace ARN (its model allows no
cluster: ARN), so a Terraform aws_redshift_integration written for AWS failed to create.
Both AWS forms are now accepted and the original ones are kept. A missing table is
IntegrationSourceNotFoundFault and a missing namespace IntegrationTargetNotFoundFault, as the API
reference lists. A namespace is written through its workgroup into the namespace's database. A
table source reads changes from the table's latest stream, following one turned on after the
integration was created.
Stream records never landed: the writer bound ApproximateCreationDateTime as an Instant, which the
PostgreSQL driver refuses, so only backfilled items reached the landing table. It now binds an
OffsetDateTime as TIMESTAMPTZ.
* fix(redshift): drain a table's replaced stream and match the source table ARN
A table source moved to the table's latest stream as soon as it changed, dropping records the old
stream still held, and moved to no stream when DynamoDB Local reported none for a table whose streams
were turned off. It now reads the followed stream until a read comes back empty, or until the stream
has expired, before moving, keeps it while the table reports no stream, and persists the move.
A source table ARN was resolved by its table name alone, so a table of another account, or an ARN
with more after the name, was taken for the caller's table of that name. The resolved table must now
have the supplied ARN. The docs no longer promise IntegrationSourceNotFoundFault for a missing stream.
* test(redshift): use the shared Docker probe and Query request helpers in the zero-ETL test
* feat(redshift): support MAXERROR in COPY
MAXERROR n of 2 or more now asks the backend to skip records it cannot convert
(ON_ERROR ignore) and to fail the COPY at the n-th one (REJECT_LIMIT n - 1),
which needs a PostgreSQL 18 backend. A MAXERROR of 0 or 1 fails at the first
error, as without the option.
* test(redshift): add PostgreSQL 18 MAXERROR integration test
* test(redshift): use shared DockerAvailability and RedshiftConnections in PostgreSQL 18 IT
Address review feedback on PR #7291:
- Call testing.DockerAvailability.isAvailable() instead of carrying a private copy of the probe.
- Use RedshiftConnections.waitForConnection(cluster) instead of duplicating the JDBC connection wait helper.
* fix(redshift): keep tags, VPC and subnet detail on cluster subnet groups
CreateClusterSubnetGroup dropped Tags and passed a null VPC, so
DescribeClusterSubnetGroups returned no Tags, VpcId, SubnetGroupStatus or
SubnetAvailabilityZone and the Terraform provider saw drift on every plan.
Tags are now parsed (Tags.member.N and Tags.Tag.N) and stored on the group,
where DescribeTags/CreateTags already find them under the subnetgroup ARN.
The VPC and each subnet's zone are resolved from EC2 on create and modify;
subnets EC2 does not know are kept unresolved, as before. Groups persisted
earlier load unchanged (the new zone map is nullable).
* fix(redshift): inject Ec2Service through the constructor
Replace the Ec2Service field injection with a constructor parameter held
in a final field. The previous @Inject signature stays as a package-private
delegating constructor passing null, so hand-built test services still
skip subnet resolution.
* test(redshift): build the EC2 setup requests with Ec2Requests
ec2Id now only extracts the id from the response; the auth header and
Action come from the shared Ec2Requests.ec2 helper.
* test(redshift): make ec2Id a plain path extraction
Call sites build the EC2 request with Ec2Requests.ec2 and pass it in;
the account and region are named constants.
* feat(redshift): support FILLRECORD in COPY
A text or CSV record that stops short of the last columns is loaded with the
rest of them filled: a character column gets a zero-length string and any other
column NULL, as in Redshift. EMPTYASNULL and NULL AS '' make the character
columns NULL too. Without FILLRECORD nothing changes.
* fix(redshift): bound memory growth for FILLRECORD output
Count transformed output against COPY_TRANSFORM_MAX_OBJECT_BYTES and the shared COPY_TRANSFORM_HEAP_MIB budget as records are written, so short records expanded by FILLRECORD fail with the statement limit or memory budget error rather than exhausting the emulator heap.
* fix(redshift): load missing CHAR columns as NULL on FILLRECORD
* feat(redshift): copy cluster snapshots into the configured destination region
EnableSnapshotCopy used to only record the destination on the cluster. A background sweep now copies each available snapshot taken after copy was enabled into a per-Region copy store, with its own dump file, retention and KMS key from the copy grant. Describe, delete, restore and tagging use the copy when the request's Region has one.
* fix(redshift): harden snapshot copy expiry, rollback and same-region enable
Expiry re-reads the copy under the lock so a replaced copy is not deleted. A failed flush undoes the copy record and the source mark before the dump is removed. A sweep re-checks that copy is still enabled to the destination. EnableSnapshotCopy refuses the cluster's own Region, and CreateClusterSnapshot refuses an identifier a copy already holds in that Region.
* fix(redshift): harden snapshot copy and share the sweep scheduler base and dump copier
Snapshot copy: keep a retained copy when a source snapshot is recreated under the same name, flush the copy before marking the source, only apply the cluster's copy retention to copies of the same cluster generation, recheck the copy settings under the snapshot lock before each copy, and leave shadowed sources out of DescribeTags.
Refactor: the five SweepWorker scheduler wrappers now extend SweepScheduler, and both services copy dumps through SnapshotDumpCopier.
* docs(redshift): note the hybrid storage limit of snapshot copy
Hybrid storage does not report a failed flush, so a crash can leave a source snapshot marked as copied without its copy. Persistent and WAL storage report the failure before the source is marked.
* feat(redshift): support event history and SNS notifications
* fix(redshift): guard stale delivery failures and prune all event scopes
* feat(cloudformation): provision Redshift event subscriptions
* fix(redshift): scope snapshot events and serialize subscription tag mutations
* feat(cloudformation): provision Redshift event subscriptions
* fix(cloudformation): resolve Redshift subscription list parameters
Use the shared list reader for SourceIds and EventCategories. Cover CommaDelimitedList and List<String> parameters through the AWS SDK and verify concurrent tag requests preserve CloudFormation tag updates.
* fix(redshift): honor event disablement and restore rollback attributes
Check the EventBridge external service key before publishing API events. Snapshot and restore CloudFormation resource attributes alongside subscription state during in-place rollback.
* fix(redshift): drop API event publisher and share subscription setup
Remove RedshiftApiEventPublisher, its handler hook, tests and docs, which are not part of the CloudFormation resource and emit CloudTrail-style events without a trail. Route createSubscription and replaceSubscription through one helper that normalizes the subscription fields.
* feat(redshift): publish CloudWatch cluster metrics
* fix(redshift): skip duplicate CloudWatch publication minutes
* test(redshift): isolate metrics publisher between integration tests
* fix(test): use Java 17 list access in Redshift metrics compatibility test
* fix(metrics): share minute publishing and prevent duplicate SQS samples
Centralize daemon scheduling, minute claims, per-target failures, retention and shutdown for SQS and Redshift. Carry the Redshift proxy key in metric targets and use the shared compatibility await fixture.
* docs(metrics): restore publisher class docs after the shared publisher move
Keep the SQS sample shape on SqsMetricsPublisher and document minute stamping, 15-day retention and the nothing-may-escape rule on MinuteMetricsPublisher.
* feat(redshift): add event subscriptions with SNS delivery
Add Create, Modify, Delete and DescribeEventSubscriptions, subscription tagging, and publication of matching events to the subscription's SNS topic, honouring the topic policy.
* fix(redshift): deliver events from a consistent subscription snapshot and reject nameless subscription ARNs
Delivery copied no state under the lock modifySubscription holds, so a concurrent
update could change the topic between matching and publishing. Match and publish
from a snapshot taken under that lock.
A tag ARN ending in eventsubscription: passed an empty name to
describeSubscriptions, which lists all subscriptions. Reject it up front.
* feat(redshift): execute automated snapshot schedules
* fix(redshift): address automated snapshot review findings
Flush snapshot metadata before deleting an expired dump, pause the
snapshot scheduler across emulator reset, run retention even when the
next dump fails, and remove checkpoints of deleted clusters.
* fix(redshift): retake an automated snapshot whose metadata was lost
The checkpoint is a separate store, so it can persist while the snapshot
metadata never reached disk. Skip a completed occurrence only when its
snapshot still exists.
* test(redshift): restore the automated snapshot on the shared interceptor cluster
Run the Docker restore scenario in RedshiftInterceptorIntegrationTest
against the cluster it already starts, so only the restore pays for a
container, and drop the hand-rolled Docker probe.
* fix(redshift): raise postgres max_connections to 500
The Postgres container behind a Redshift cluster runs with the default max_connections of 100, and each retained session keeps a connection open. Near 100 sessions, Data API calls and JDBC clients on that cluster encounter 'sorry, too many clients already', well before reaching the 500-session limit. Raising max_connections to 500 in RedshiftContainerManager lets the documented 500-session limit apply.
* fix(redshift): raise default proxy max connections to 500
The PostgreSQL backend limit was raised to 500, but the Redshift auth proxy connection semaphore defaulted to 100 via proxy-max-connections. As a result, client connections above 100 were refused by the proxy before reaching PostgreSQL. Raise the default proxy-max-connections to 500 across config, application YAML, and documentation.
* fix(redshift): follow node type for max_connections and raise proxy default to 2000
* fix(redshift): support rg node types, pass serverless from runtime, and update test stubs
- Include rg.* node types for 2,000 max_connections
- Pass 'serverless' node type from RedshiftServerlessRuntime and drop prefix check
- Update start(...) stubs across integration tests with the six-argument signature
Reclaim disposable anonymous volumes while preserving adopted containers during failed recovery. Retain pre-reboot dumps and failed cleanup ownership across partial teardown. Preserve the original database when only proxy shutdown fails. Share startup orchestration while retaining the opt-in cleanup policy.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat(redshift): support default IAM roles for COPY and UNLOAD
* fix(redshift): distinguish default role keyword from literals
* fix(redshift): accept blank default IAM roles
Under IAM enforcement a request that passes a role to a service needs iam:PassRole on that role,
but no Redshift or Redshift Serverless operation was checked for it. A caller allowed to create a
cluster or change its roles could attach any role to it, and Floci's COPY, UNLOAD and Spectrum
statements then run as that role; statements run through the Data API on a Redshift Serverless
workgroup can use its namespace's roles the same way.
Now checked, with iam:PassedToService as the Service Authorization Reference gives it:
- Redshift CreateCluster and RestoreFromClusterSnapshot pass the roles in IamRoles, and
ModifyClusterIamRoles those in AddIamRoles, to redshift.amazonaws.com. The lists are read through
the Redshift handler's own member pattern, so IamRoles.IamRoleArn.N, as the SDK sends it,
IamRoles.member.N and IamRoles.N all count. RestoreFromClusterSnapshot is checked although
Floci's restore attaches no role yet, as AWS checks it.
- Redshift Serverless CreateNamespace and UpdateNamespace pass the roles in iamRoles and the one
in defaultIamRoleArn, and CreateScheduledAction and UpdateScheduledAction pass roleArn, to
redshift-serverless.amazonaws.com.
The Redshift management guide: "To associate an IAM role with a cluster, a user must have
iam:PassRole permission for that IAM role." A role named only as a cluster's default,
DefaultIamRoleArn, is not checked on its own: the default is one of the roles the cluster holds, and
Floci does not act on it. A namespace's defaultIamRoleArn is checked, since Floci keeps it whether
or not iamRoles holds it.
COPY, UNLOAD and Spectrum now take a role only under the ARN IAM holds it under, path included, as
STS AssumeRole does. They looked the role up by its name alone, so a cluster given
role/sandbox/AdminRole, which a PassRole grant on role/sandbox/* allows, ran its statements as the
AdminRole IAM holds under another path.
IAM's AddRoleToInstanceProfile now passes the role it adds to ec2.amazonaws.com. Every instance
running with the profile gets that role's credentials from the instance metadata service, so adding
a role to a profile already attached to a running instance handed it any role. The IAM API
reference: "The caller of this operation must be granted the PassRole permission on the IAM role by
a permissions policy." RoleName names the role without its path, so the check uses the ARN IAM holds
the role under, or, for a role IAM does not hold, the ARN the name gives.
docs/services/iam.md lists the new operations, and docs/services/redshift.md the path rule.
* feat(firehose): deliver staged Redshift batches with single-attempt COPY
A flush stages the batch in the intermediate S3 location, then runs COPY against the cluster proxy over JDBC simple-query mode without an IAM role. The load runs on its own thread so that slow COPY queries do not hold the shared flush executor or PutRecord callers, and failures are logged with the staged batch kept in S3.
* fix(firehose): address review comments on Redshift single-attempt COPY delivery
- Drain buffers before shutting down the Redshift delivery executor on Firehose shutdown and log dropped queued tasks.
- Catch RejectedExecutionException in deliverRedshiftBatch to prevent staged records from returning to the buffer.
- Extract DatabaseSecretCredentials helper in core.common to deduplicate Secrets Manager credentials parsing across RDS Data, Redshift Data, and Firehose.
- Extract RedshiftConnections test helper for waitForConnection and use DockerAvailability.isAvailable() in FirehoseRedshiftDeliveryIntegrationTest.
- Update docs and Javadocs to remove outdated references to retries and shared flush threads.
* fix(firehose): wait for queued Redshift COPY delivery before shutdown and log secret parse errors
* refactor(firehose): deduplicate dropAndLogQueuedTasks helper on shutdown
Rebuild host-resource uploads and catalog tar streams for transient Docker I/O retries. Keep SQL outside the retry boundary and preserve snapshot failure and optional bootstrap behavior.
Refs #5096.
* feat(redshift): add snapshot copy and snapshot schedule operations
Terraform's aws_redshift_snapshot_copy, aws_redshift_snapshot_schedule and
aws_redshift_snapshot_schedule_association failed with InvalidAction because
the Query handler had no arms for these actions.
- EnableSnapshotCopy / DisableSnapshotCopy / ModifySnapshotCopyRetentionPeriod
store the copy settings on the cluster, and DescribeClusters reports
ClusterSnapshotCopyStatus while copy is enabled. RetentionPeriod defaults
to 7 and ManualSnapshotRetentionPeriod to -1. Faults follow the Redshift
model: SnapshotCopyAlreadyEnabledFault, SnapshotCopyAlreadyDisabledFault,
SnapshotCopyDisabledFault (modify), InvalidRetentionPeriodFault and
SnapshotCopyGrantNotFoundFault.
- Create/Describe/Modify/DeleteSnapshotSchedule and
ModifyClusterSnapshotSchedule. The association lives on the cluster, so
DescribeSnapshotSchedules derives AssociatedClusters (state ACTIVE) and
filters by ClusterIdentifier from it, and a deleted cluster cannot leave a
stale association. Deleting a schedule in use is refused with
InvalidClusterSnapshotScheduleState.
- Snapshot schedules take part in CreateTags/DeleteTags/DescribeTags as
resource type snapshotschedule.
No snapshot is copied to another region or taken on a schedule; the docs
say so.
* fix(redshift): reject malformed snapshot schedules and in-use copy grant deletion
* fix(redshift): validate snapshot copy region and snapshot schedule identifier
EnableSnapshotCopy now refuses a DestinationRegion that is not a published
AWS region with UnknownSnapshotCopyRegionFault (404), as the model lists.
CreateSnapshotSchedule now refuses a ScheduleIdentifier containing anything
but letters, digits and hyphens with InvalidParameterValue (400). The API
reference allows alphanumerics; the management guide's example uses a hyphen.
* feat(redshift): support more COPY and UNLOAD options
COPY now accepts REGION, CREDENTIALS, key-based credentials, EMPTYASNULL,
BLANKSASNULL, REMOVEQUOTES, ACCEPTINVCHARS and TRUNCATECOLUMNS. UNLOAD now
accepts REGION, CREDENTIALS, key-based credentials and EXTENSION. Field
content options run in a new CopyRecordTransformer; TRUNCATECOLUMNS reads
column lengths from the catalog and so needs the Simple Query protocol.
Clauses that cannot be honoured still fail open to PostgreSQL.
* feat(redshift): support UNLOAD ESCAPE, CLEANPATH and server-side encryption options
UNLOAD now accepts ESCAPE (text framing only), CLEANPATH, ENCRYPTED AUTO and
ENCRYPTED with KMS_KEY_ID, which is stored as aws:kms server-side encryption
on the data and manifest objects. CLEANPATH lists and authorizes every delete
up front but removes the objects only when the first output arrives, so a
query that PostgreSQL rejects keeps the previous export. An empty prefix,
ALLOWOVERWRITE and client-side encryption still fail open to PostgreSQL.
* fix(redshift): address review findings on COPY and UNLOAD options
- Reject blank access key, secret, session token and IAM role so an empty
pair cannot enable unsigned S3 access.
- CLEANPATH lists and authorizes the prefix again when the first output
arrives, so an object uploaded since preparation does not survive.
- REMOVEQUOTES no longer closes a text-mode field on an escaped quote.
- TRUNCATECOLUMNS counts characters, as PostgreSQL does for varchar(n),
and cuts decoded text so escape sequences are never split.
- Bound the heap used by field-level COPY options with a per-object size
limit and a budget shared across connections.
* fix(redshift): delete the CLEANPATH prefix under one bucket lock
S3Service.deleteObjectsWithPrefix lists the prefix, authorizes every key
and deletes them while holding the bucket monitor that PutObject and
DeleteObject already use, so an upload cannot land between the listing
and the deletes and survive next to the new export.
* fix(redshift): measure TRUNCATECOLUMNS in bytes and tighten review follow-ups
Redshift counts CHAR(n) and VARCHAR(n) in bytes, so TRUNCATECOLUMNS now
measures decoded bytes and cuts on a character boundary instead of
counting characters. The UNLOAD docs described bare ENCRYPTED as
client-side; client-side is the MASTER_SYMMETRIC_KEY form. The
concurrent-put lock test now waits for the put thread to be BLOCKED
instead of a fixed 300 ms timeout.
* style(redshift): fix import order in S3CopySimulatorTest
* feat: add relational queries for Redshift Spectrum
* fix(redshift): harden Spectrum relational query preparation
Catch RuntimeException during preparation so the client gets an ErrorResponse
instead of a dropped connection, skip preparation while the backend discards
until Sync, defer schema binding until the transaction commits, make the
catalog functions SECURITY DEFINER, and track COMMIT and ROLLBACK from the
command tag.
* fix(redshift): address review findings on transaction handling in Spectrum relational queries
- Undo Glue tables created inside a rolled back transaction (Data API batch and wire proxy)
- Keep bindings and Glue tables on ROLLBACK TO SAVEPOINT; only a closed transaction discards them
- Report the real transaction status for locally handled simple queries instead of idle
- Use a switch expression in BackendResponseCoordinator
- Map host.docker.internal into the floci-duck container on Linux
* fix(redshift): undo Glue tables across sessions and on rollback to savepoint
- Scope staged Glue tables by the backend socket so the proxy rollback finds tables created by another session
- Track SAVEPOINT, ROLLBACK TO and RELEASE so a Data API batch undoes only the tables created after the savepoint
* fix(redshift): defer Glue undo on rollback to savepoint until the backend confirms and bundle bootstrap catalog in native image
* fix(redshift): reject CREATE EXTERNAL TABLE inside a transaction like AWS
AWS does not allow CREATE EXTERNAL TABLE inside a transaction block, and a
Data API batch runs as one transaction. Return SQLSTATE 25001 instead of
staging Glue tables and undoing them on rollback, which removes the savepoint
tracking and cross-session undo code. Reuse ExternalTableMaterializer.quote.
* fix(redshift): reject CREATE EXTERNAL TABLE in a transaction for legacy schemas too
* feat(redshift): add external catalog statement parsing and metadata writers
* fix(redshift): harden external statement parsing and reference scanning
- Scanner: recognise dollar-quoted bodies, E'..\'..' strings and nested
block comments; catch SELECT INTO, CREATE VIEW and CREATE INDEX writes;
ignore FROM inside EXTRACT, SUBSTRING, TRIM and IS DISTINCT FROM.
- Parser: accept CREATE EXTERNAL SCHEMA IF NOT EXISTS, strip leading
comments, support quoted names with dots, read TBLPROPERTIES and
PARTITION values that contain parentheses or escaped quotes, validate
IAM_ROLE as one quoted literal, and canonicalise Redshift type aliases
to Hive types.
- Registry: percent-encode key parts so separators in identifiers cannot
collide.
- Backend session: do not treat socket write failures as source read
failures during COPY.
- Keep property order stable in statements.
* fix(redshift): address external catalog review findings
* fix(redshift): inherit omitted partition settings
* fix(redshift): preserve explicit empty partition settings
* fix(redshift): canonicalise character and varbyte external column types
* fix(redshift): default unsized character types
* fix(redshift): enforce Spectrum varchar default length
* fix(redshift): null surplus varchar values during Spectrum copy
* refactor(dynamodb): add a stream reader and key native streams by table ARN
DynamoDbStreamReader is the engine-neutral way to read DynamoDB Streams.
DynamoDbApiStreamReader implements it over the selected DynamoDbOperations using the Streams wire API.
Native streams were keyed by region and table name, so same-named tables in two accounts shared one stream.
They are now keyed by table ARN, and ListStreams returns only the caller's account and region.
Streams of every account are restored from persisted tables at startup.
* refactor(dynamodb): move stream consumers onto the stream reader
The Lambda DynamoDB Streams poller reads through DynamoDbStreamReader: each tick renews iterators from committed progress for every readable shard, and reads a child shard only after its parent was read to its end.
It discards restart checkpoints only for a process-lifetime engine, and pins LATEST per shard via newestSequenceNumbers, replacing DynamoDbStreamService.latestSequenceNumber.
A read fills a batch from as many GetRecords calls as it needs, so a batch is not cut at the 1000 record GetRecords maximum.
EventBridge Pipes reads DynamoDB streams the same way, committing a batch only once it is delivered or sent to the DLQ, delivers the AWS stream record shape with eventSourceARN, and honors LATEST.
The Redshift zero-ETL consumer reads the same way, keeping per-shard progress in the integration (legacy checkpointSequenceNumber is ignored on load) and committing a batch only after it is written to the landing table.
It discards that progress at startup for a process-lifetime engine, and the writer now takes AWS stream records, so Redshift no longer uses DynamoDbStreamService or DynamoDbStreamRecord, whose SHARD_ID is now package-private.
* fix(redshift): accept s3table log destination and reject mutual snapshot restore params
Closes#4242
* fix(redshift): preserve S3-table logging configuration and report status
Pass S3TableKmsKeyId and S3TableGranularity through EnableLogging, store them on Cluster, and serialize S3Tables in LoggingStatus responses.
* fix(redshift): validate S3-table logging settings
* fix(redshift): complete S3 table logging status
* fix(redshift): add SnapshotArn and SnapshotCreateTime to snapshot responses
DescribeClusterSnapshots and CreateClusterSnapshot never populated
SnapshotArn or SnapshotCreateTime — the Snapshot model didn't carry
either field. Real AWS returns both, and callers that filter on
recovery-point age or restore by ARN have nothing to key off.
SnapshotArn reuses the existing snapshotArn(clusterIdentifier,
snapshotIdentifier) helper (already used for tagging, just never
attached to the model). SnapshotCreateTime is captured via Instant.now()
at snapshot creation and formatted with the same DateTimeFormatter.ISO_INSTANT
convention already used elsewhere in this file for Expiration/CreateTime.
Both elements are omitted from the XML response when the snapshot predates
this field (an on-disk store surviving an upgrade), matching how the other
optional elements in buildSnapshotXml already degrade.
* feat(redshift): support DescribeLoggingStatus, EnableLogging, DisableLogging
The Upbound Terraform provider's redshift Cluster resource calls
DescribeLoggingStatus on every observe cycle, unconditionally, as part
of its standard drift check across all configurable cluster aspects —
not something a caller opts into. Without it, every cluster's observe
step failed outright with InvalidAction, and the cluster could never
report Synced/Ready even once fully created and available.
Adds the three logging actions as a set, matching how EnableLogging/
DisableLogging/DescribeLoggingStatus share one response shape in the
real API. No log delivery is emulated — only the configuration a caller
set (enabled, bucket, prefix) is tracked and returned, the same
graceful-scope choice already made for snapshot dump handling.
XML wrapper element names (DescribeLoggingStatusResult, EnableLoggingResult,
DisableLoggingResult) were verified against aws-sdk-go-v2's own generated
deserializer, not assumed from the docs.
* fix(redshift): default parameter group and MultiAZ on cluster responses
Terraform provider's resourceClusterRead indexes ClusterParameterGroups[0]
and requires MultiAZ to be exactly "enabled" or "disabled" unconditionally.
Real AWS always attaches a default parameter group and never returns MultiAZ
blank; floci previously omitted both, causing a panic and then a read error
in the provider.
* fix(redshift): resolve RestoreFromClusterSnapshot by SnapshotArn too
Real AWS lets callers restore from either SnapshotIdentifier or
SnapshotArn. Terraform's aws_redshift_cluster resource populates only
snapshot_arn when that's the field configured, so the request carried
no SnapshotIdentifier at all and floci NPE'd looking one up as null.
* fix(redshift): use the real AWS error code for missing subnet groups
RedshiftService threw "ClusterSubnetGroupNotFound", but AWS's actual
code is "ClusterSubnetGroupNotFoundFault" and the Terraform AWS
provider's generated deserializer type-matches on that exact string to
recognize "doesn't exist yet, create it". A bare code fell through to
an unclassified error, so the provider never got past Observe and a
cluster subnet group could never be created through Crossplane.
* fix(redshift): address PR review feedback
Validate SnapshotArn (400 on malformed/missing, account and region check),
honor ClusterParameterGroupName and MultiAZ, seed the default parameter
group, allow CloudWatch EnableLogging, return 400 for missing subnet
groups, sync docs, and add tests.
* test(redshift): fix merge of logging tests with main's IAM role tests
* refactor(redshift): share logging response helper and trim comments
* fix(redshift): restore testDisableLogging's closing brace lost in the main merge
Merging main's snapshot-copy-grant tests (#3628) next to the logging
tests dropped the closing brace of testDisableLogging and the @Test
annotation on describesSnapshotCopyGrants, so the latter body ran
inside the former and the file failed to compile.
* docs(redshift): resync action table order after the main merge
make docs-sync moved ModifyCluster after the snapshot-copy-grant rows
main added, matching the generator's canonical action order.
---------
Co-authored-by: yarammanasa2001-max <271440416+yarammanasa2001-max@users.noreply.github.com>
* feat(redshift): implement snapshot copy grant lifecycle
Terraform's aws_redshift_snapshot_copy_grant needs the full CRUD, and all
three actions returned InvalidAction. Add CreateSnapshotCopyGrant,
DescribeSnapshotCopyGrants and DeleteSnapshotCopyGrant to the Query handler,
backed by a new storage map on RedshiftService.
The grant name is the key: a duplicate create raises
SnapshotCopyGrantAlreadyExistsFault, and describe-by-name or delete of a
missing grant raises SnapshotCopyGrantNotFoundFault. Describe without a name
returns every grant. KmsKeyId is optional and defaults to the account's
AWS-managed Redshift key alias ARN, mirroring how Ec2EbsEncryptionService
stands in for a default key.
Tags ride along on create, since the CLI sends them inline as
Tags.Tag.N.Key/.Value on this action rather than via CreateTags, and
snapshotcopygrant ARNs now resolve in the tagging operations alongside the
other Redshift resource types.
* test(redshift): cover snapshot copy grants through the real SDK
* fix(redshift): paginate DescribeSnapshotCopyGrants
The action returned every grant in one page and ignored MaxRecords and
Marker, so a client with more grants than fit in a page had no way to walk
them.
Page through the shared Pagination helper, which sorts by the grant name and
encodes the last returned name as an opaque base64 cursor, so ordering is
stable and a marker stays resumable when grants are created or deleted
between pages. Marker is emitted only while further pages remain, which is
what tells a paginating client to stop.
MaxRecords follows the Redshift model: default 100, and a value outside
20 to 100 is rejected with InvalidParameterValue rather than clamped.
The model documents SnapshotCopyGrantName and Marker as mutually exclusive
but declares no error for sending both, so this filters by name and then
paginates instead of rejecting the pair. A name matches at most one grant,
which fits in any page.
* fix(redshift): enforce the SnapshotCopyGrantName contract
AWS validates SnapshotCopyGrantName as 1-63 characters, first a lowercase
letter, then lowercase letters, digits or single hyphens with no trailing
or doubled hyphen. Create accepted anything non-blank, so names Redshift
rejects (1grant, Grant, grant--copy, grant-, 64 characters) persisted
locally and diverged from AWS.
Validate in RedshiftService before persistence, matching the existing
snapshot identifier check, and answer InvalidParameterValue as the rest of
the handler does.
* fix(redshift): return 400 for SnapshotCopyGrantNotFoundFault on Describe and Delete
AWS documents SnapshotCopyGrantNotFoundFault as HTTP 400 in the error tables
for both DescribeSnapshotCopyGrants and DeleteSnapshotCopyGrant; we returned
404. Two existing wire-level assertions in RedshiftOperationsTest pinned the
wrong status, so they move with the code, and the unit tests now assert the
status alongside the error code.
The third throw site, in the tagging helper, deliberately stays 404: the
status belongs to the action rather than the fault code, and that path is
reached only from CreateTags/DeleteTags/DescribeTags, whose documented
missing-resource error is ResourceNotFoundFault at 404. A regression pins
that, and a comment says why the two differ.
Refs:
https://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeSnapshotCopyGrants.htmlhttps://docs.aws.amazon.com/redshift/latest/APIReference/API_DeleteSnapshotCopyGrant.htmlhttps://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateTags.html
* fix(redshift): serialize grant create/delete, and use ResourceNotFoundFault on the tag path
Two findings from the latest review round.
createSnapshotCopyGrant checked the name was free and then wrote, with nothing
between the two steps, so two concurrent creates of one name could both succeed
and the second would overwrite the first. create and delete are now synchronized,
as createCluster and modifyCluster already are. The new wire-level test holds two
threads on a latch and releases them into the same name: it fails on every run
without the keyword (3/3 locally) and passes with it, so it pins the lock rather
than describing it.
The tagging path threw SnapshotCopyGrantNotFoundFault with HTTP 404. Both halves
of that pairing cannot be right at once: botocore's Redshift model gives that
shape httpStatusCode 400, and an error shape's status is a property of the shape,
not of the calling action. But 404 is the correct status here, because
CreateTags/DeleteTags/DescribeTags do not list that fault at all -- they document
ResourceNotFoundFault, modelled at 404, for any missing resource. So the status
stays and the code changes. That also explains why the three sibling cases in the
same switch are already consistent: ClusterNotFound, ClusterSnapshotNotFound and
ClusterParameterGroupNotFound are each modelled at 404 themselves.
Describe and Delete still return SnapshotCopyGrantNotFoundFault at 400, which is
what those two actions document.
Docs gain a short section on the grant surface: the alias-ARN KmsKeyId default,
the unvalidated tag limits, and why a missing grant reports two different faults
depending on which action you reach it through.
* style(test): name the new snapshot copy grant tests without the testX prefix
AGENTS.md: "Name test methods either as a camelCase sentence or as
method_scenario_expectation. Both are established. testX names are common in
older tests and are not the pattern to copy." The 31 tests this PR adds to
src/test all used testX because the three Redshift files they landed in are
unusually full of it -- 7/7, 30/50 and 69/104 -- but that is the local exception,
not the repo convention, and the rule is explicit about not copying it.
Renames only; no test body changes. The two new tests in
compatibility-tests/sdk-test-java keep testX: that module has the opposite idiom
and AGENTS.md says to follow the module you are in, and all five methods in that
file, three of them pre-existing, are named that way.
ModifyClusterIamRoles adds and removes the IAM roles associated with a
cluster. The change is pushed to the running auth proxy, so COPY and
UNLOAD on new connections authorize against the updated role list.
Cluster IamRoles now report ApplyStatus in-sync.
DescribeClusterVersions and DescribeOrderableClusterOptions return static
data so IaC providers can validate node types before creating a cluster.