PostgreSQL ts_kv export now retries transient query failures from the same
cursor, fails fast on non-transient errors, and cleans up time-series files
on latest-read failures.
Cassandra export reads partitions in ordered pages through retried queries.
The importer stops reading immediately after a failed insert, abort deletes
files even when close fails, and startup failures force JVM exit.
CassandraTsKvImporter submitted inserts with executor.submit and never
looked at the result, so a row whose insert failed after all retries was
dropped and the import still exited 0. CassandraService also retried every
error, including ones that can't succeed such as an invalid query, for
about 100s per row.
Now every failed insert is recorded with the row's position (counted
across files, like skip_lines). The import stops reading, skips queued rows
after the failure, lets earlier ones complete, and exits with an error
naming the CASSANDRA_IMPORT_TS_KV_SKIP_LINES value to resume from: every
row before it is imported. Unreadable files are handled the same way.
CassandraService retries only transient errors (timeouts, unavailable or
overloaded replicas, connection failures) and rethrows the rest at once.
- Failed or aborted exports can't be imported: abort() deletes all
time-series files (also the legacy ts_kv.gz), worker Throwables are
counted as failed keys, and the Cassandra exporter now fails like the
PostgreSQL one instead of writing a manifest for a partial export.
- The import rejects a working directory with both ts_kv_manifest.gz and
ts_kv.gz, which are files of two different exports.
- Each worker thread compresses into its own files, rolled over on the
compressed bytes written, so gzip no longer serializes the export.
- Key ids are resolved by name in key_dictionary, so a reused
ts_kv_latest.gz from an earlier export can't map to the wrong key.
- Timestamps near the long bounds are clamped instead of failing the key;
the first page is inclusive instead of using startTs - 1.
- MigrationService stops its workers when start() throws, so the JVM exits
instead of hanging.
- Validated at startup: DATABASE_MAX_POOL_SIZE > PARALLELISM_LEVEL,
Cassandra export start/end filters, TS_KV_EXPORT_MAX_FILE_SIZE_MB >= 0
(new TsKvWriterFactory).
- The query delay applies after every ts_kv query; NaN and Infinity
doubles are imported; part names use Locale.ROOT.
- Tests: PostgreSQL container test for PostgresTsKvExporter, importer
skip_lines across files and non-finite doubles, writer abort/crash/mixed
export cases. README: compatibility with older importers, keys without
latest values, measured cost per key by partition count.
Add PostgresTsKvExporter, so a tenant can be migrated from a PostgreSQL-only
(or TimescaleDB) setup to a hybrid PostgreSQL + Cassandra one. It reads the
history of every key in the exported ts_kv_latest from ts_kv with keyset
pagination and writes it in the CassandraTsKvExporter format, computing the
Cassandra partition from POSTGRES_TS_EXPORT_PARTITIONING (must match the
target's TS_KV_PARTITIONING). Invalid configs fail at startup, and a failed
key makes the export exit with an error without creating data.tar.
Both time-series exporters now write ts_kv_00001.gz, ts_kv_00002.gz, ... of
about TS_KV_EXPORT_MAX_FILE_SIZE_MB (default 256) and a ts_kv_manifest.gz
listing them, written last. The importer reads the manifest (or the legacy
single ts_kv.gz), rejects exports without it, reports progress against the
total row count and applies skip_lines across files. 0 keeps the legacy format.
Also cap the Hikari pool above parallelism_level and document Cassandra 4/5
compatibility (protocol pinning, the 2038 TTL limit).
Also derive the deb and rpm package version once (pkg.version, 4.4.1~SNAPSHOT for snapshots) and use it for the packages and their purls, so package purls match the installed packages.