CedarDB agent
Target CedarDB
CedarDB speaks the PostgreSQL 16 wire protocol, so this agent is the PostgreSQL target with CedarDB’s connection defaults and with the parts of the PostgreSQL write path that CedarDB changes. The JDBC driver is the PostgreSQL one, and there is no separate SQL dialect.
The agent is target only: CedarDB has no logical replication, replication slots or triggers yet, so change capture from CedarDB is not available.
Prerequisites
To have Gluesync writing into your CedarDB instance you will need:
-
A CedarDB server, Community or Enterprise edition. The Community edition is limited to 64 GiB and becomes read-only once the database exceeds it;
-
A user with permission to read and write the target tables and, for bulk operations, to create the staging tables;
-
Network access from Core Hub to the server, on port
5432by default.
Setup via Web UI
Specific configuration
The settings of the PostgreSQL target apply, see PostgreSQL target advanced settings.
Enable Recursion Protection is not offered, and it is off whatever a copied configuration says: it needs replication origins, which CedarDB does not have.
TLS
CedarDB creates a self-signed certificate at its first start and also accepts plain connections, so TLS is off by default. The JDBC sslmode follows the two TLS fields:
| Enable TLS | Trust server certificate | JDBC sslmode |
|---|---|---|
Off |
Not used |
|
On |
On |
|
On |
Off |
|
With TLS off the agent sets sslmode to disable explicitly, so the driver does not negotiate TLS. A CedarDB server with its self-signed certificate needs Trust server certificate on, or a trust store that holds its certificate.
Server check
When the connection is checked, the agent runs SELECT version() and the answer must name CedarDB. Any other server, including a plain PostgreSQL, fails the check with a message that names the server that answered:
This target needs CedarDB; the server reports 'PostgreSQL 16...'
The agent logs the CedarDB version once.
Connections
CedarDB accepts at most 100 connections. Set the Max connections count of the connection (maxConnectionsCount) so that all pipelines that write to the same CedarDB server stay below that limit, with room left for your own clients.
Write modes
Batch
The default. The agent uses the PostgreSQL statements: INSERT, INSERT … ON CONFLICT DO UPDATE (an upsert by key) and DELETE. CedarDB has no MERGE, and the agent does not need it.
A decimal is bound as text and cast to the precision and scale of the column, so every digit is stored.
Bulk
Bulk operations are set per entity with Use bulk operations during Snapshot (useBulkOperationsWhileSnapshot) and Use bulk operations during CDC (useBulkOperationsDuringCDC), see Write strategies and Bulk load.
- Snapshot
-
Each flush is one transaction with one
COPYstraight into the target table. There is no staging table and no second pass. TheCOPYis binary, except for the columns CedarDB does not read in binary (tinyint,vectorand anumericthat needs 38 digits), which use the text format. A snapshot of an entity without a key takes the same directCOPY.If the target already holds a key that the flush writes (for example a snapshot over existing rows), the
COPYis rolled back and the entity is loaded through the staging merge below, which replaces rows by key until the snapshot ends. The agent logs that once per entity. - Change capture
-
Changes are written to a staging table and merged into the target table, in one transaction per flush.
|
When Use bulk operations during CDC ( For the target table this has the following effects:
Entities whose target table has an identity (auto-increment) column ignore the option: their updates are always applied as |
An entity with an enum column that also needs a text COPY (a tinyint, vector, inet, bit string, range, wide numeric or array column next to it) is not bulk loaded. The batch statements write it, because a text COPY into a table with an enum column stops the CedarDB server.
Each bulk flush logs one INFO line with the entity, the path (direct-copy or staging-merge), rows, bytes, the time of the COPY and of the merge, rows per second and MB per second.
Retry on write conflicts
CedarDB never waits for a row that another transaction is writing: it fails at once with SQLSTATE 40001. The agent runs every write transaction, batch or bulk, again in a fresh transaction, for up to 6 attempts. The delay starts at 50 ms, doubles after each attempt, includes jitter and is capped at 2 seconds. If the last attempt fails, the error is reported with the attempt count. Writes are idempotent (upsert by key, delete by key, staging merge), so a retry does not duplicate rows. Other errors are not retried by the agent.
A staging merge that follows earlier snapshot flushes whose rows are still in the staging table is not repeated inside the agent, because the staging table is emptied when a merge fails. The failure is reported and the snapshot resumes from its last confirmed position.
Performance
The direct snapshot COPY is about twice as fast as staging the rows and merging them. The benchmark loads one million rows (a bigint key, int, double, a 40-character varchar, timestamp and numeric(18,4), about 91 MB as COPY text) as the snapshot of an entity with a key. Median of three runs on an Apple M5 Max with a Docker VM of 18 vCPU and 23 GiB, with Gluesync and CedarDB on the same host:
| Path | Flush | Rows/s | MB/s |
|---|---|---|---|
Staging and merge |
10,000 rows |
361,934 |
32.9 |
Direct |
10,000 rows |
764,742 |
69.5 |
Staging and merge |
One flush of 1M rows |
231,309 |
21.0 |
Direct |
One flush of 1M rows |
388,878 |
35.3 |
The flush of 10,000 rows is the most a source hands over per iteration by default. The rates include the agent’s own work (building the rows and the binary encoding) and move with the load of the host. In a real pipeline the throughput is usually bound by the source, not by the target.
Tables created by the agent
Gluesync can create the target tables, as it does for any SQL target (see Target table creation). The tables are the PostgreSQL ones, except for the types CedarDB lacks or limits:
-
numericanddecimal: CedarDB holds 38 digits at most. A type that fits is kept asnumeric(p, s). Anumericwithout precision becomesnumeric(38, s)with its declared scale, ornumeric(38, 10)when it has none, because the barenumericof CedarDB isnumeric(38, 6)and rejects a value with more fractional digits. A negative scale or a scale above the precision is widened so every source value fits (NUMBER(5,-2)becomesnumeric(7,0),NUMBER(5,9)becomesnumeric(9,9)). A type that needs more than 38 digits, such asnumeric(60,45)ornumeric(40,2), becomestextholding the plain digits of each value, never rounded, with a warning that names the column and its declared type. A value with more fractional digits than itsnumericcolumn is rounded half up, and the first rounding of a column that drops a non-zero digit is logged as a warning; -
time with time zone(timetz) becomestext, written as ISO-8601HH:mm:ss[.SSSSSS]±hh:mm; -
any other type CedarDB does not have (
xml,cidr,macaddr,macaddr8,hstore, multiranges,money, geometric types, text search types,pg_snapshot,txid_snapshot,pg_lsnand the PostGIS types) becomestext, with a warning.
Data types
The type matrix lists the types CedarDB has. These are the Gluesync types and the CedarDB types the agent writes:
| Gluesync type | Default | Supported |
|---|---|---|
SHORT |
|
|
INT |
|
|
LONG |
|
|
BOOLEAN |
|
|
BIG_DECIMAL |
|
|
FLOAT |
|
|
DOUBLE |
|
|
LOCAL_DATE |
|
|
LOCAL_TIME |
|
|
LOCAL_DATE_TIME |
|
|
OFFSET_DATE_TIME |
|
|
STRING |
|
|
BYTE_ARRAY |
|
|
ARRAY |
|
|
Limitations
-
numericanddecimalhave a precision of at most 38 digits (a wider type is created astext, see Tables created by the agent), andNaNis not accepted for them; -
dateandtimestampvalues cannot beinfinityor-infinity; -
CedarDB canonicalises
tsrangeandtstzrangevalues to[lower, upper). A range written as(a,b]is read back as the equivalent range at microsecond precision.numrangeis not supported: CedarDB changes its bounds, so the values would not be the same; -
An enum column that needs a text
COPYis written in batch, see Write modes; -
With bulk operations, an array of
numeric(p,s)cannot be part of a key, because CedarDB does not compare it with the staging array. Arrays of the other types, withNULLelements, are matched; -
A
timestamptzis shown in the time zone of the session that reads it; -
Recursion protection is not available;
-
CedarDB accepts at most 100 connections, see Connections;
-
CedarDB is not available as a source.
Setup via Rest APIs
Here following an example of calling the Core Hub’s Rest API via curl to setup the connection for this Agent.
Connect the agent
curl --location --request PUT 'http://core-hub-ip-address/pipelines/{pipelineId}/agents/{agentId}/config/credentials' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"hostCredentials": {
"connectionName": "myAgentNickName",
"host": "cedardb-host",
"port": 5432,
"databaseName": "postgres",
"username": "postgres",
"password": "",
"maxConnectionsCount": 50,
"enableTls": false,
"trustServerCertificate": false
}
}'