mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* feat(firehose): convert JSON records to Parquet via the floci-duck sidecar Deliver data-format-converting streams for real: each flushed record is parsed and type-checked in Java against the stream's Glue table schema (per-record ParseError/MalformedData routing with AWS's probed message shapes), valid rows are staged as normalized NDJSON and written to the destination as Parquet by DuckDB's COPY, and failed records go to the evaluated ErrorOutputPrefix as AWS-shaped NDJSON error lines. Batch-level failures (missing Glue table, unsupported schema, sidecar errors) route every record to the error output instead of dropping them. Adds the floci.services.firehose.staging-bucket setting and replaces the PR-1-era unconverted-delivery warning. * fix(firehose): deliver a scheduled flush as the stream's own account A scheduled flush runs on the flusher thread, where no request context is active, so the Glue lookup, the staging writes, the destination writes and the sidecar all resolved the default account instead of the stream's owner. A stream owned by another account had its Glue table missed and its objects written to the wrong partition. The delivery now runs under RequestScopes, which the CUR scheduler already uses for the same reason, so every store the delivery touches agrees on the owner. The unconverted path gets this too. Cleanup failures in the compatibility test are logged rather than swallowed, per the repository rule on tolerated exceptions. * fix(firehose): cap the staging buffer size hints rows.size() * 128 overflows an int at about 16.7 million records, so a batch of many small records failed before writing any of them, and short of that it asked for a multi-gigabyte array. Both hints are computed as a long and capped at 8 MiB; the streams grow as needed, so this only affects the first allocation. * docs(firehose): state what a failed error-output write actually guarantees The comment claimed a failure of the error-output write leaves the converted rows in the staging bucket, but the enclosing finally removes the staged object however the method exits, and the Parquet bytes are read into memory before either destination write, so nothing is retained to recover from. What holds is that nothing is delivered and the flush fails as a whole, which is what it says now, along with where recovery does live: the source, which a Kinesis-backed stream has and a DirectPut buffer does not. The reverse ordering is documented rather than claimed away: the two destination writes are not atomic, so an error object can land and the Parquet write then fail, reporting the failed records while the converted ones are gone.