Temporary CDC buffering while intial data snapshot is running

Before the initial data snapshot is running we need to send a signal to the logical replication thread to alter its behavior.

  1. The initial data snapshot thread starts.
  2. Before exporting the snapshot, we notify the logical replication thread with the name of the table.
  3. The logical replication thread for that given table will start buffering logical replication events in a temporary buffer.
  4. When the initial data snapshot thread is finished, notify the logical replication thread again with the table name.
  5. At this point the initial data snapshot is already in the "queue", we can now copy the temporary buffer created for the logical replication to the queue.
  6. Start consuming logical replication data for the table without the buffer.