Before this change we used one connection to migrate one change. We
observed an excessive number of DB connections using netstat during
the execution of the setNoteDbPrimary method. The number of connections
reached 27K and then opening a new connection started to fail and the
migration started to fail. I assume that this is caused by the
exhaustion of the local port range: we open/close connections in quick
succession and the operating system doesn't have enough time to release
local ports.
By updating a chunk of changes from a single thread, we make sure to use
only one DB connection for one chunk. This should reduce the rate at
which DB connections are open/closed and the overall number of
connections open during the migration.
Change-Id: Ie4a1b4d41b92824c87a0ae39b13a13d9ccb4ca3c