> I found two race conditions wrong remote_xid can be reported for streaming=on
> case.
I also found similar issue that wrong remote_commit_ts can be reported for
streaming=on
and PREPARED transaction.
1. insert initial tuples on publisher:
2. Delete a tuple on subscriber:
3. Start a large transaction (T1) to stream the change and PREPARE:
publisher=# BEGIN;
SELECT txid_current();
UPDATE foo
SET b = 'T1-' || repeat('x', 20000000)
WHERE a = 1;
BEGIN
txid_current
--------------
697
(1 row)
publisher=*# PREPARE TRANSACTION 'test';
4. Do COMMIT PREPARED. CLT can be updated here.
5. Check the conflict log table on subscriber. remote_commit_ts should be
appeared
but NULL can be reported. If the apply worker had applied other transactions
before,
the timetstamp could be reported.
subscriber=# SELECT remote_xid, remote_commit_ts FROM
pg_conflict.pg_conflict_log_16392;
remote_xid | remote_commit_ts
------------+------------------
697 |
(1 row)
IIUC it's because remote_commit_ts is not updated in
apply_handle_stream_prepare().
We should follow what apply_handle_stream_commit() does.
Best regards,
Hayato Kuroda
FUJITSU LIMITED