BlogServiceNow

How Does a MID Server Failover Cause Duplicate JDBC Rows?

Scott Sternloff

By Scott Sternloff, Senior Enterprise Architect

LinkedIn · Updated · 5 min read

How Does a MID Server Failover Cause Duplicate JDBC Rows?
On this page

Short answer

When a MID Server in a failover cluster stops, the next server restarts the JDBC task from the beginning of the ECC queue task, so rows can arrive twice. Make the transform map coalesce on a unique key, load only changed rows, and give the JDBC source its own MID Server.

When a MID Server in a failover cluster stops, the next server restarts the JDBC task from the beginning of the ECC queue task, even if much of the data was already returned. ServiceNow warns that this may produce duplicate data. The fix is in two places: a transform map that can take the same row twice, and a dedicated, non-clustered MID Server for the JDBC source.

This is the failure path for one kind of load. If you want a second pair of eyes on yours, our ServiceNow consulting page explains how a review works. Everything below comes from ServiceNow's own documentation, read 4 December 2026; check it against your release.

What happens to a JDBC load when its MID Server fails?

The cluster's Cluster Management business rule selects the highest available MID Server in the failover order. That server checks the ECC queue and starts with jobs that are Processing or Ready, so an interrupted JDBC job is picked up again from its first row, not from where it stopped.

  1. The import set load starts and the MID Server runs the SQL statement from the data source.
  2. Rows come back and land in the import set staging table.
  3. The MID Server fails part way. ServiceNow says the restart happens even if much of the data was already returned.
  4. The failover server takes the Processing job and restarts the ECC queue task from the beginning.
  5. The same rows arrive again. Whether the target table ends up with two records is decided later, by the transform map (our reading of the page).

Two limits sit next to this. Clustering does not support the Command and SystemCommand ECC queue topics, and ServiceNow says to keep LDAP, export set and JDBC data sources off clusters, using dedicated MID Servers instead.

Failover cluster or load balancing cluster: which suits JDBC?

Neither. ServiceNow says JDBC data sources should not be used with MID Server clusters, and the warning is not limited to one cluster type. ServiceNow's introduction says a load balancing cluster also handles failover. A failover cluster keeps an ordered list and moves work to the next available MID Server. Pick the cluster type for work where a repeat is harmless, and give the JDBC source one dedicated MID Server.

Why does the transform map decide whether you get duplicates?

The coalesce setting on the field map decides it. If a target record with the same value exists, ServiceNow updates it; if not, it creates one. With no coalesce, every imported row is treated as a new record, so a rerun inserts the whole load again.

How coalesce treats a row that arrives twice (ServiceNow import set documentation, read 4 December 2026)
Transform map setupWhat a repeated row does
No coalesceTreated as new. A rerun inserts every row a second time.
Coalesce on a unique key (single or multiple fields)Updates the existing record. No second record.
Coalesce on a field that is not uniqueOnly the first matching target record is updated, per ServiceNow.
Conditional coalesce scriptUpdates when the script returns the sys_id of the target record.

Pick the source system's primary key where you can, and test with a deliberate repeat load before trusting the setup.

How do you make a JDBC load safe to run twice?

Make the load idempotent first, then reduce what a rerun repeats, then remove the failover path that causes the rerun. In that order, because the first step protects you even when the others are not in place.

  1. Coalesce on a stable, unique key. A second pass then updates rows instead of inserting them.
  2. Load only what changed. On the JDBC data source, Use last run datetime limits each run to rows changed since the last one. Without it, all rows in the table are imported every time. ServiceNow does not say how the value behaves after a run that failed over, so test that case.
  3. Set a query timeout. A value of 0 means no timeout. After the timeout, ServiceNow treats the JDBC result as inaccessible and puts it in an error state, which is easier to alert on than a load that hangs.
  4. Use a dedicated MID Server for the JDBC source. It has no failover partner, so a failure stops the load instead of repeating it. That is the trade, and it is why the next step matters.

What should you monitor, rehearse and troubleshoot?

ServiceNow raises the mid_server.cluster.down event when it cannot find a MID Server with the right capabilities to replace a failed one in a failover cluster. Use it to send an email. A dedicated JDBC server needs its own alert, because nothing takes over from it.

Then rehearse in a sub-production instance. Start a load, stop the MID Server service part way, and compare source and target row counts. If a load already ran twice, troubleshooting starts with the same comparison. The MID Server polls the ECC queue every 40 seconds by default (mid.poll.time) and listens on an AMB channel, so allow for that polling interval when you time the rehearsal. Our MID Server and JDBC load design use case lists what a written plan for this covers, and the questions in what to look for in a ServiceNow integration partner include how a partner would answer this one.

Sources

Frequently Asked Questions

Does a MID Server failover dedupe a JDBC load for me?

No. ServiceNow says the failover server restarts from the beginning of the ECC queue task and may produce duplicate data. Coalescing on a unique key in the transform map is what prevents duplicate target records.

Can I put JDBC sources on a load balance cluster instead?

ServiceNow says LDAP, export set and JDBC data sources should not be used with MID Server clusters, and should use dedicated MID Servers. That guidance is not limited to the failover type.

How do I see that a failover happened?

ServiceNow documents no check for this. The ECC queue records show which MID Server picked up a job and its state, but that is our suggestion, not a ServiceNow instruction. The cluster.down event fires only when no suitable replacement MID Server can be found.

Scott Sternloff

Author

Scott SternloffSenior Enterprise Architect

Senior Enterprise Architect at AceMQ. Writes the technical coverage here: RabbitMQ, Kafka and Redis architecture, clustering and migrations.

Talk to an engineer

Need a hand with ServiceNow?

Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

Free Consultation

Get Expert Eyes on Your ServiceNow Environment

Whether you're troubleshooting a production incident, planning a migration, or want a second opinion on your architecture — our team is ready. No pitch, just answers.

Email Us