RE: Perform streaming logical transactions by background workers and parallel apply

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "wangw(dot)fnst(at)fujitsu(dot)com" <wangw(dot)fnst(at)fujitsu(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Perform streaming logical transactions by background workers and parallel apply
Date: 2022-12-13 13:07:09
Message-ID: OS0PR01MB57167EC0CB469325788CA79194E39@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 13, 2022 7:06 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> Some minor review comments for v58-0001

Thanks for your comments.

> ======
>
> .../replication/logical/applyparallelworker.c
>
> 1. pa_can_start
>
> + /*
> + * Don't start a new parallel worker if user has set skiplsn as it's
> + * possible that user want to skip the streaming transaction. For
> + streaming
> + * transaction, we need to serialize the transaction to a file so
> + that we
> + * can get the last LSN of the transaction to judge whether to skip
> + before
> + * starting to apply the change.
> + */
> + if (!XLogRecPtrIsInvalid(MySubscription->skiplsn))
> + return false;
>
>
> "that user want" -> "that they want"
>
> "For streaming transaction," -> "For streaming transactions,"

Changed.

> ~~~
>
> 2. pa_free_worker_info
>
> + /* Remove from the worker pool. */
> + ParallelApplyWorkerPool = list_delete_ptr(ParallelApplyWorkerPool,
> + winfo);
>
> Unnecessary wrapping

Changed.

> ~~~
>
> 3. pa_set_stream_apply_worker
>
> +/*
> + * Set the worker that required to apply the current streaming transaction.
> + */
> +void
> +pa_set_stream_apply_worker(ParallelApplyWorkerInfo *winfo) {
> +stream_apply_worker = winfo; }
>
> Comment wording seems wrong.

Tried to improve this comment.

> ======
>
> src/include/replication/worker_internal.h
>
> 4. ParallelApplyWorkerShared
>
> + * XactLastCommitEnd from the parallel apply worker. This is required
> +to
> + * update the lsn_mappings by leader worker.
> + */
> + XLogRecPtr last_commit_end;
> +} ParallelApplyWorkerShared;
>
>
> "This is required to update the lsn_mappings by leader worker." -->
> did you mean "This is required by the leader worker so it can update
> the lsn_mappings." ??

Changed.

Also thanks for the kind reminder in [1], rebased the patch set.
Attach the new patch set.

[1] - https://www.postgresql.org/message-id/CAHut%2BPt4qv7xfJUmwdn6Vy47L5mqzKtkPr31%3DDmEayJWXetvYg%40mail.gmail.com

Best regards,
Hou zj

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Isaac Morland 2022-12-13 13:25:04 Re: Ordering behavior for aggregates
Previous Message houzj.fnst@fujitsu.com 2022-12-13 13:07:06 RE: Perform streaming logical transactions by background workers and parallel apply