Skip to content

Capture Agents

Problems with the Capture Agents: replication held up by a few subscriptions, agents that don't start, and agents that restart over and over. Start with the agent's Health Check and its Read the Capture Agent and server logs in the SQDR Control Center. For errors from the staging databases (Db2 on the Stelo VM), see Control and staging databases.

A few stalled subscriptions hold up all replication ("Log reading has been paused")

Symptoms

  • Replication stops, or falls far behind, for many or all tables of a source at once. It looks like a full outage.
  • On the agent's Summary tab, the workers show Paused and the log position stops moving. The agent log has Log reading has been paused. Current storage count=n.
  • On the agent's Subscriptions tab, one or a few subscriptions have a very large Rows Waiting (tens of millions) and an old Oldest Transaction. The others have little or nothing waiting.

Cause

The Capture Agent is healthy, but those subscriptions stopped applying at the destination, for example because their destination stopped accepting rows. Their changes pile up in the staging database. When the rows waiting reach the storage monitor's throttle level (smThrottleLevel, 50 million rows by default), the agent stops reading the source log for all its subscriptions until the backlog drains (see Storage monitor). The backlog can't drain while the stalled subscriptions don't apply.

What to do

Free the other subscriptions first:

  1. On the agent's Subscriptions tab, find the stalled subscriptions: the largest Rows Waiting (see Reading the numbers).
  2. Take them Offline. Their staged changes are deleted, the backlog drops, and the agent resumes reading the log for the other subscriptions within minutes. The other groups then catch up, which can take some hours.

Offline acts on the source table for every subscriber of that table: all groups and destinations that replicate it stop receiving its changes (see Subscriptions offline and online).

Then fix the stalled subscriptions and bring them back:

  1. Find out why they stopped applying: check the group's replication events in the Data Replicator Manager, and the destination database itself. Fix that first, or they stall again.
  2. Take them Online.
  3. Run a baseline of each, or let Automatic Snapshot start it. Offline deleted their staged changes, so a baseline is the only way back in step. During the baseline the destination table is emptied and reloaded.

Don't delete and re-create the subscriptions: Online and a baseline are enough. And don't leave them offline and forgotten: an offline table isn't replicated at all.

Prevention

  • Get warned before the throttle level: the storage monitor sends a warning at smWarningLevel (40 million rows by default) when email notification is set up (see Email notifications).
  • Check Rows Waiting and Oldest Transaction regularly, and act on a subscription whose oldest transaction stops changing.
  • Before a planned mass update of a large table, take its subscription offline, and baseline it afterwards, instead of replicating every changed row.

For the other reasons an agent falls behind, see When a Capture Agent falls behind.

Capture Agents don't start: memory overcommitted

Symptoms

Seen on Stelo Capture servers with many Capture Agents:

  • Some agents never finish starting: their status stays Start initiated.
  • Showing an agent's subscriptions fails with:

    Request failed.
    An error occurred. Unable to retrieve subscription information
    [jcc] Exception java.net.ConnectionException: Error opening socket to server localhost/127.0.0.1 on port 50,000
    with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001
    

    although Services shows that Db2 is running.

  • Windows shows "Your computer is low on memory" from time to time, or free space on C: disappears as the agents start (Windows grows the page file).

  • In Task Manager, the memory in use is low (for example 16 GB of 64 GB), but Committed is at its limit. On the Details tab, each java process has a large Commit size (around 1 GB) but uses far less.

Cause

Unless the maximum Java heap is set (-Xmx), Java sizes it from the computer's physical memory. On a server with a lot of memory, each Capture Agent's Java process reserves much more memory than it needs. With many agents, the reserved (committed) memory reaches the Windows limit, and new processes, including Db2's, can't get memory.

What to do

  1. On the server's Configuration tab in the SQDR Control Center (the Launch Agent's configuration; see Configuration), add the property jvmParms with the value -Xms32m -Xmx128m. It applies to every Capture Agent.
  2. Restart the Capture Agents (restarting the SQDR Plus Launch Agent service restarts them all), so that their Java processes start with the new values.
  3. Watch Committed memory in Task Manager and check that it's no longer at its limit.

If one agent then needs more memory (for example it logs Java heap errors), give it a larger -Xmx in its own jvmParms on its Configuration tab.

"Invalid data conversion" (ERRORCODE=-4461) after a source schema change

Symptom

After a change to a source table, such as widening a character column, the Capture Agent restarts over and over to recover from an error like this one in its log:

SEVERE: CaptureAgentLog: ReplicationWorker.run:
com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][1091][10404] Invalid data conversion: Parameter instance ...
is invalid for the requested conversion. ERRORCODE=-4461, SQLSTATE=42815

Cause

The agent still uses its saved definition of the table, which no longer matches the source.

What to do

  1. On the agent's Configuration tab, add validateMetadata with the value true. Saving restarts the agent, which reads each subscribed table's definition from the source again, and flags the altered tables for a new baseline.
  2. Once the agent runs normally, remove the property (or set it to false, the default): it slows down every agent start.
  3. Run the baselines of the flagged subscriptions, or let Automatic Snapshot start them.

To handle the next schema change without this, see Schema changes.

"javax.crypto.BadPaddingException: Given final block not properly padded" after a move or reinstall

Cause: the passwords Stelo Capture stores are encrypted with the key in conf\node.properties; the old server's file, or the Launch Agent's old password value, wasn't put back.

What to do: see Restore on the new server, steps 4 and 5.