mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 15:54:08 +03:00
Use correctly-sized buffer when zero-filling a WAL file.
I mixed up BLCKSZ and XLOG_BLCKSZ when I changed the way the buffer is allocated a couple of weeks ago. With the default settings, they are both 8k, but they can be changed at compile-time.
This commit is contained in:
parent
2b3136de9e
commit
a4c4e0bf60
@ -2449,7 +2449,7 @@ XLogFileInit(uint32 log, uint32 seg,
|
|||||||
{
|
{
|
||||||
char path[MAXPGPATH];
|
char path[MAXPGPATH];
|
||||||
char tmppath[MAXPGPATH];
|
char tmppath[MAXPGPATH];
|
||||||
char zbuffer_raw[BLCKSZ + MAXIMUM_ALIGNOF];
|
char zbuffer_raw[XLOG_BLCKSZ + MAXIMUM_ALIGNOF];
|
||||||
char *zbuffer;
|
char *zbuffer;
|
||||||
uint32 installed_log;
|
uint32 installed_log;
|
||||||
uint32 installed_seg;
|
uint32 installed_seg;
|
||||||
@ -2511,7 +2511,7 @@ XLogFileInit(uint32 log, uint32 seg,
|
|||||||
* cycles transferring data to the kernel.
|
* cycles transferring data to the kernel.
|
||||||
*/
|
*/
|
||||||
zbuffer = (char *) MAXALIGN(zbuffer_raw);
|
zbuffer = (char *) MAXALIGN(zbuffer_raw);
|
||||||
memset(zbuffer, 0, BLCKSZ);
|
memset(zbuffer, 0, XLOG_BLCKSZ);
|
||||||
for (nbytes = 0; nbytes < XLogSegSize; nbytes += XLOG_BLCKSZ)
|
for (nbytes = 0; nbytes < XLogSegSize; nbytes += XLOG_BLCKSZ)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user