TEST: After tablesyn-early-exit patch code change to avoid tablesync processing... ... 2020-12-08 14:25:12.820 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop 2020-12-08 14:25:12.820 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables 2020-12-08 14:25:13.821 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop 2020-12-08 14:25:13.821 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables 2020-12-08 14:25:14.125 AEDT [10125] LOG: logical decoding found consistent point at 0/162A760 2020-12-08 14:25:14.125 AEDT [10125] DETAIL: There are no running transactions. 2020-12-08 14:25:14.125 AEDT [10125] STATEMENT: CREATE_REPLICATION_SLOT "tap_sub_16438_sync_16385" TEMPORARY LOGICAL pgoutput USE_SNAPSHOT 2020-12-08 14:25:14.130 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop 2020-12-08 14:25:14.130 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables 2020-12-08 14:25:14.144 AEDT [8904] LOG: !!>> tablesync worker: wait for CATCHUP state notification 2020-12-08 14:25:14.144 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop 2020-12-08 14:25:14.144 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables ## Attached and paused in debugger where the "tablesync" is told to CATCHUP. ## At this point we might execute any number of SQL commands ## e.g 10 inserts psql -d test_pub -c "INSERT INTO test_tab VALUES(1, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(2, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(3, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(4, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(5, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(6, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(7, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(8, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(9, 'foo');" psql -d test_pub -c "INSERT INTO test_tab VALUES(10, 'foo');" ## Now continue in the "tablesync" worker ## But because of this patch the "tablesync" will exit before doing anything in the LogicalRepApplyLoop 2020-12-08 14:26:43.339 AEDT [8904] LOG: !!>> tablesync worker: called process_syncing_tables 2020-12-08 14:26:43.339 AEDT [8904] LOG: logical replication table synchronization worker for subscription "tap_sub", table "test_tab" has finished ## So the "apply" worker now will process all 10x INSERTs 2020-12-08 14:26:43.340 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop 2020-12-08 14:26:43.340 AEDT [8895] LOG: !!>> apply worker: apply_dispatch for message kind 'B' 2020-12-08 14:26:43.340 AEDT [8895] LOG: !!>> apply worker: apply_dispatch for message kind 'R' 2020-12-08 14:26:43.340 AEDT [8895] LOG: !!>> apply worker: apply_dispatch for message kind 'I' 2020-12-08 14:26:43.341 AEDT [8895] LOG: !!>> apply worker: should_apply_changes_for_rel: true rel->state == READY: false rel->state == SYNCDONE: true rel->statelsn <= remote_final_lsn: true 2020-12-08 14:26:43.342 AEDT [8895] LOG: !!>> apply worker: apply_dispatch for message kind 'C' 2020-12-08 14:26:43.342 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables X 10 ... ## Then apply worker just waiting for next incoming message like normal 2020-12-08 14:26:43.344 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables 2020-12-08 14:26:43.344 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop 2020-12-08 14:26:43.344 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables 2020-12-08 14:26:43.545 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop 2020-12-08 14:26:43.545 AEDT [8895] LOG: !!>> apply worker: called process_syncing_tables 2020-12-08 14:26:43.748 AEDT [8895] LOG: !!>> apply worker: LogicalRepApplyLoop ...