| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bryan Green <dbryan(dot)green(at)gmail(dot)com> |
| Subject: | Re: Switch buffile.c/h to use pgoff_t |
| Date: | 2025-12-26 01:11:48 |
| Message-ID: | B685F6F2-2372-499B-90B7-213340E3B1DE@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Dec 26, 2025, at 07:45, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Thu, Dec 25, 2025 at 10:40:02AM +0800, Chao Li wrote:
>> In attached v3, I have applied int64 to the 2 struct fields and
>> corresponding local variables. I ran a clean build, no warning was
>> introduced, and "make check" passed.
>
> The advantage of being able to make the code transparently more
> pluggable for max large sizes while we already use 8-byte offsets is
> kind of nice, I guess. "availbytes" is a clarification bonus as it is
> not an offset per-se. I can see that you have missed on cast spot, so
> adjusted things a bit, then applied the result.
> --
> Michael
Thanks a lot for pushing.
WRT to the original (int) casts, I intentionally removed them, because file->nbytes, newOffset and file->curOffset are all signed 64 bit integers now. Compiling with -Wextra won’t get a warning, so technically, the type cast is no longer needed.
I saw you changed to:
```
- file->pos = (int) (newOffset - file->curOffset);
+ file->pos = (int64) (newOffset - file->curOffset);
- file->pos = (int) (newOffset - file->curOffset);
+ file->pos = (int64) newOffset - file->curOffset;
- file->nbytes = (int) (newOffset - file->curOffset);
+ file->nbytes = (int64) newOffset - file->curOffset;
```
The latter two places missed (), but that should also work, just a little inconsistent.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hayato Kuroda (Fujitsu) | 2025-12-26 03:20:35 | RE: Parallel Apply |
| Previous Message | Xuneng Zhou | 2025-12-26 00:31:26 | Re: Implement waiting for wal lsn replay: reloaded |