I needed to perform a model update and thought draining the queues would be quick. It turned out to be one of those things that looks simple but can break replication if done the wrong way.
Why queue draining matters
For a model update:
- Queues must be empty
- Or at least have no data for the requests being modified
If not, the update can fail or leave the system in an inconsistent state.
What actually works
Here’s the approach that consistently worked for me:
1. Let CDC do the work
- Start the request if it’s not running
- Allow it to naturally process data in the queue
CDC is designed to drain queues safely on its own.
2. Stop new incoming data
- On IBM i / DB2 → stop the Change Selector
- On other platforms → stop source updates
This prevents the queue from filling back up while draining.
3. Wait until queues are empty
- Monitor queue statistics in MonCon
- Let replication catch up fully
Patience is key here. Forcing it usually causes problems later.
When queues don’t drain
This is where most trouble starts.
If data is stuck:
- Restart the affected request
- CDC will reprocess from the top of the queue
If errors appear:
- Check kernel logs
- Look for data issues, constraints, or DB problems
Sometimes the queue contains data that simply cannot be applied.
Last resort
If the data in the queue is invalid:
- Clear the queues properly
- Perform a copy or cold start
This should not be the first option, but sometimes it’s necessary.
What I stopped doing
What made things worse for me earlier:
- Manually deleting queue rows
- Forcing partial cleanup
- Ignoring errors and retrying blindly
Those approaches usually lead to deeper issues like mismatches or data inconsistency.
What changed for me
I stopped thinking of queues as just a backlog of rows.
They are structured transactions waiting to be applied.
The safest way to clear them is to let CDC process them completely.
Takeaway
Draining queues is not about clearing data fast.
It is about clearing data safely so the system stays consistent.
If you let CDC finish what it started, model updates become much smoother.
Have you run into queues that just wouldn’t drain, and what ended up being the root cause?