On Tue, Nov 29, 2022 at 10:18 AM houzj.f...@fujitsu.com <houzj.f...@fujitsu.com> wrote: > > Attach the new version patch which addressed all comments. >
Some comments on v53-0002* ======================== 1. I think testing the scenario where the shm_mq buffer is full between the leader and parallel apply worker would require a large amount of data and then also there is no guarantee. How about having a developer GUC [1] force_apply_serialize which allows us to serialize the changes and only after commit the parallel apply worker would be allowed to apply it? I am not sure if we can reliably test the serialization of partial changes (like some changes have been already sent to parallel apply worker and then serialization happens) but at least we can test the serialization of complete xacts and their execution via parallel apply worker. 2. + /* + * The stream lock is released when processing changes in a + * streaming block, so the leader needs to acquire the lock here + * before entering PARTIAL_SERIALIZE mode to ensure that the + * parallel apply worker will wait for the leader to release the + * stream lock. + */ + if (in_streamed_transaction && + action != LOGICAL_REP_MSG_STREAM_STOP) + { + pa_lock_stream(winfo->shared->xid, AccessExclusiveLock); This comment is not completely correct because we can even acquire the lock for the very streaming chunk. This check will work but doesn't appear future-proof or at least not very easy to understand though I don't have a better suggestion at this stage. Can we think of a better check here? 3. I have modified a few comments in v53-0002* patch and the incremental patch for the same is attached. [1] - https://www.postgresql.org/docs/devel/runtime-config-developer.html -- With Regards, Amit Kapila.
changes_amit_v53_0002.patch
Description: Binary data