Skip to content

rework file stat handling to simplify and cross-platform-ability #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 16, 2022

Conversation

funny-falcon
Copy link
Collaborator

  • don't use full struct stat since it differs between platforms
  • store file kind separately from mode in pb specific way
  • add pioFilesAreSame as replacement of fio_is_same_file since it needs st_ino and st_dev, therefore had to run on localdrive always.

PIO_KIND_FIFO = 4,
PIO_KIND_SOCK = 5,
PIO_KIND_CHARDEV = 6,
PIO_KIND_BLOCKDEV = 7,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

запятая в последнем элементе enum - это C99? документация postgres говорит - "at least C89-compliant".

src/archive.c Outdated
@@ -388,7 +388,7 @@ push_file_internal(const char *wal_file_name, const char *pg_xlog_dir,
char to_fullpath[MAXPGPATH];
char to_fullpath_part[MAXPGPATH];
/* partial handling */
struct stat st;
pio_stat_t st;
int partial_try_count = 0;
ssize_t partial_file_size = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial_file_size тоже должен стать беззнаковым

@@ -55,6 +55,7 @@ pgBackupValidate(pgBackup *backup, pgRestoreParams *params)
pthread_t *threads;
validate_files_arg *threads_args;
int i;
err_i err;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно ли сюда FOBJ_FUNC_ARP или того, который в main достаточно?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В принципе, достаточно, т.к. если будет ошибка, то мы вывалимся.

…ability

- don't use full `struct stat` since it differs between platforms
- store file kind separately from mode in pb specific way
- add pioFilesAreSame as replacement of fio_is_same_file since it needs
  st_ino and st_dev, therefore had to run on localdrive always.
@funny-falcon funny-falcon merged commit d78283c into REL_2_6 Nov 16, 2022
@Burus Burus added this to the 2.6.0 milestone Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants