数据写零回退补充

This commit is contained in:
@oliverwxx
2024-06-17 09:55:08 +08:00
committed by yaoxin
parent 544d61f038
commit 7a9a104e7c
2 changed files with 10 additions and 11 deletions

View File

@ -104690,8 +104690,8 @@ msgstr "无法找到文件\"%s\": "
#: storage/smgr/segment/data_file.cpp:57
#, c-format
msgid "dv_open_file filename: %s, flags is %d, mode is %d, fd is %d"
msgstr "dv_open_file filename: %s, flags is %d, mode is %d, fd is %d"
msgid "dv_open_file filename: %s, flags is %lu, mode is %d, fd is %d"
msgstr "dv_open_file filename: %s, flags is %lu, mode is %d, fd is %d"
#: storage/smgr/segment/data_file.cpp:67
#, c-format

View File

@ -31,14 +31,13 @@
#include "storage/smgr/fd.h"
#include "storage/smgr/knl_usync.h"
#include "storage/smgr/segment.h"
#include "storage/dss/dss_adaptor.h"
#include "storage/file/fio_device.h"
#include "postmaster/pagerepair.h"
#include "ddes/dms/ss_common_attr.h"
static const mode_t SEGMENT_FILE_MODE = S_IWUSR | S_IRUSR;
static int dv_open_file(char *filename, int flags, int mode);
static int dv_open_file(char *filename, uint32 flags, int mode);
static void dv_close_file(int fd);
static void df_open_target_files(SegLogicFile *sf, int targetno);
@ -50,12 +49,12 @@ void df_extend_file_vector(SegLogicFile *sf);
* We can not use virtual fd because space data files are accessed by multi-thread.
* Callers must handle fd < 0
*/
static int dv_open_file(char *filename, int flags, int mode)
static int dv_open_file(char *filename, uint32 flags, int mode)
{
int fd = -1;
fd = BasicOpenFile(filename, flags, mode);
int err = errno;
ereport(LOG, (errmsg("dv_open_file filename: %s, flags is %d, mode is %d, fd is %d", filename, flags, mode, fd)));
ereport(LOG, (errmsg("dv_open_file filename: %s, flags is %d, mode is %lu, fd is %d", filename, flags, mode, fd)));
errno = err;
return fd;
}
@ -107,7 +106,7 @@ void df_create_file(SegLogicFile *sf, bool redo)
}
} else {
// File not exists
int flags = O_RDWR | O_CREAT | O_EXCL | PG_BINARY;
uint32 flags = O_RDWR | O_CREAT | O_EXCL | PG_BINARY;
if (sf->segfiles != NULL) {
ereport(LOG,
(errmodule(MOD_SEGMENT_PAGE),
@ -155,7 +154,7 @@ bool df_ss_update_segfile_size(SegLogicFile *sf, BlockNumber target_block)
return false;
}
int flags = O_RDWR | PG_BINARY;
uint32 flags = O_RDWR | PG_BINARY;
/* need palloc segfiles if file_num is 0 */
if (sf->vector_capacity == 0) {
df_extend_file_vector(sf);
@ -389,7 +388,7 @@ void df_open_all_file(RepairFileKey key, int32 max_sliceno)
{
int fd = -1;
char *filename = NULL;
int flags = O_RDWR | PG_BINARY;
uint32 flags = O_RDWR | PG_BINARY;
Oid relNode = key.relfilenode.relNode;
ForkNumber forknum = key.forknum;
SegSpace *spc = spc_init_space_node(key.relfilenode.spcNode, key.relfilenode.dbNode);
@ -437,7 +436,7 @@ void df_open_all_file(RepairFileKey key, int32 max_sliceno)
static void df_open_target_files(SegLogicFile *sf, int targetno)
{
int sliceno = sf->file_num;
int flags = O_RDWR | PG_BINARY;
uint32 flags = O_RDWR | PG_BINARY;
for (;;) {
if (targetno != 0 && targetno < sliceno) {
@ -613,7 +612,7 @@ void df_shrink(SegLogicFile *sf, BlockNumber target)
if (unlink(filename) != 0) {
/* The fd is closed, if we can not open it, next access to this file will panic */
int flags = O_RDWR | O_EXCL | PG_BINARY;
uint32 flags = O_RDWR | O_EXCL | PG_BINARY;
sf->segfiles[i].fd = dv_open_file(filename, flags, SEGMENT_FILE_MODE);
if (sf->segfiles[i].fd < 0) {
ereport(PANIC, (errmsg("Unlink file %s failed and unable to read it again.", filename)));