Обсуждение: Standardize LSN-based filename

Поиск
Список
Период
Сортировка

Standardize LSN-based filename

От
Japin Li
Дата:
In commit 2633dae2e, I standardized the LSN formatting for log messages using
zero-padding.  However, I mistakenly changed the snapshot file name[1].

I'd like to standardize the LSN-based filename.  What's your feedback on this?

[1] https://www.postgresql.org/message-id/CAJpy0uDYtHGLkcr1sDqKFUm-ef33Kdky9R8qdDC5JgeM7VdWNA%40mail.gmail.com

-- 
Best regards,
Japin Li
ChengDu WenWu Information Technology Co., LTD.



Re: Standardize LSN-based filename

От
Fujii Masao
Дата:
On Wed, Aug 13, 2025 at 9:56 AM Japin Li <japinli@hotmail.com> wrote:
>
> In commit 2633dae2e, I standardized the LSN formatting for log messages using
> zero-padding.  However, I mistakenly changed the snapshot file name[1].
>
> I'd like to standardize the LSN-based filename.  What's your feedback on this?

Thanks for starting a new thread on this topic!

I understand it's worth standardizing LSN formatting in log messages
so users can read them consistently across tools and easily compare
values. On the other hand, is there a strong reason to also standardize
file names with zero-padding? Is it just for consistency, or is it to make
file names more sortable?

Regards,

--
Fujii Masao



Re: Standardize LSN-based filename

От
Japin Li
Дата:
On Wed, Aug 20, 2025 at 12:37:27AM +0900, Fujii Masao wrote:
> On Wed, Aug 13, 2025 at 9:56 AM Japin Li <japinli@hotmail.com> wrote:
> >
> > In commit 2633dae2e, I standardized the LSN formatting for log messages using
> > zero-padding.  However, I mistakenly changed the snapshot file name[1].
> >
> > I'd like to standardize the LSN-based filename.  What's your feedback on this?
> 
> Thanks for starting a new thread on this topic!
> 
> I understand it's worth standardizing LSN formatting in log messages
> so users can read them consistently across tools and easily compare
> values. On the other hand, is there a strong reason to also standardize
> file names with zero-padding? Is it just for consistency, or is it to make
> file names more sortable?
> 

Yeah.  It's for both consistency and for proper file sorting.

Zero-padding ensures that when a file system or tool sorts the snapshot files
alphabetically, the order is also chronological. For example, without
zero-padding, 2-1.snap would come before 10-1.snap, which is incorrect.  With
zero-padding, the files would sort as 00000002-00000001.snap and
00000010-00000001.snap, which is the correct order.

-- 
Best regards,
Japin Li
ChengDu WenWu Information Technology Co., LTD.



Re: Standardize LSN-based filename

От
Fujii Masao
Дата:
On Wed, Aug 20, 2025 at 10:37 AM Japin Li <japinli@hotmail.com> wrote:
> Yeah.  It's for both consistency and for proper file sorting.
>
> Zero-padding ensures that when a file system or tool sorts the snapshot files
> alphabetically, the order is also chronological. For example, without
> zero-padding, 2-1.snap would come before 10-1.snap, which is incorrect.

I understand this situation can occur. Does this actually cause any real issues?
If not, and if no other programs depend on file name ordering, then the current
naming should be fine?

Regards,

--
Fujii Masao



Re: Standardize LSN-based filename

От
Japin Li
Дата:
On Thu, 21 Aug 2025 at 15:52, Fujii Masao <masao.fujii@gmail.com> wrote:
> On Wed, Aug 20, 2025 at 10:37 AM Japin Li <japinli@hotmail.com> wrote:
>> Yeah.  It's for both consistency and for proper file sorting.
>>
>> Zero-padding ensures that when a file system or tool sorts the snapshot files
>> alphabetically, the order is also chronological. For example, without
>> zero-padding, 2-1.snap would come before 10-1.snap, which is incorrect.
>
> I understand this situation can occur. Does this actually cause any real issues?
No.

> If not, and if no other programs depend on file name ordering, then the current
> naming should be fine?

Yeah! I don't insist on implementing this now; I'm simply documenting the
potential issue.

--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.