Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit94370e4

Browse files
author
Sergey Fukanchik
committed
[PBCKP-314] move err_i to the beginning of a function.
1 parentb8d6ab0 commit94370e4

File tree

6 files changed

+26
-44
lines changed

6 files changed

+26
-44
lines changed

‎src/backup.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
111111
time_tstart_time,end_time;
112112
charpretty_time[20];
113113
charpretty_bytes[20];
114+
err_ierr=$noerr();
115+
114116

115117
elog(INFO,"Database backup start");
116118
if(current.external_dir_str)
@@ -250,7 +252,6 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
250252
if (current.stream)
251253
{
252254
charstream_xlog_path[MAXPGPATH];
253-
err_ierr;
254255

255256
join_path_components(stream_xlog_path,current.database_dir,PG_XLOG_DIR);
256257
err=$i(pioMakeDir,current.backup_location, .path=stream_xlog_path,
@@ -406,15 +407,11 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
406407
join_path_components(dirpath,current.database_dir,file->rel_path);
407408

408409
elog(LOG,"Create directory '%s'",dirpath);
410+
err=$i(pioMakeDir,current.backup_location, .path=dirpath,
411+
.mode=DIR_PERMISSION, .strict= false);
412+
if ($haserr(err))
409413
{
410-
err_ierr;
411-
412-
err=$i(pioMakeDir,current.backup_location, .path=dirpath,
413-
.mode=DIR_PERMISSION, .strict= false);
414-
if ($haserr(err))
415-
{
416-
elog(WARNING,"%s",$errmsg(err));
417-
}
414+
elog(WARNING,"%s",$errmsg(err));
418415
}
419416
}
420417

‎src/catalog.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ pgBackupInitDir(pgBackup *backup, const char *backup_instance_path)
14611461
inti;
14621462
chartemp[MAXPGPATH];
14631463
parray*subdirs;
1464-
err_ierr;
1464+
err_ierr=$noerr();
14651465

14661466
/* Try to create backup directory at first */
14671467
err=create_backup_dir(backup,backup_instance_path);
@@ -1500,7 +1500,6 @@ pgBackupInitDir(pgBackup *backup, const char *backup_instance_path)
15001500
/* create directories for actual backup files */
15011501
for (i=0;i<parray_num(subdirs);i++)
15021502
{
1503-
err_ierr;
15041503
join_path_components(temp,backup->root_dir,parray_get(subdirs,i));
15051504
err=$i(pioMakeDir,backup->backup_location, .path=temp,
15061505
.mode=DIR_PERMISSION, .strict= false);

‎src/catchup.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
633633
ssize_ttransfered_datafiles_bytes=0;
634634
ssize_ttransfered_walfiles_bytes=0;
635635
charpretty_source_bytes[20];
636+
err_ierr=$noerr();
637+
636638

637639
source_conn=catchup_init_state(&source_node_info,source_pgdata,dest_pgdata);
638640
catchup_preflight_checks(&source_node_info,source_conn,source_pgdata,dest_pgdata);
@@ -705,8 +707,6 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
705707
join_path_components(dest_xlog_path,dest_pgdata,PG_XLOG_DIR);
706708
if (!dry_run)
707709
{
708-
err_ierr;
709-
710710
err=$i(pioMakeDir,local_location, .path=dest_xlog_path,
711711
.mode=DIR_PERMISSION, .strict= false);
712712
if($haserr(err))
@@ -829,8 +829,6 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
829829
elog(LOG,"Create directory '%s'",dirpath);
830830
if (!dry_run)
831831
{
832-
err_ierr;
833-
834832
err=$i(pioMakeDir,local_location, .path=dirpath,
835833
.mode=DIR_PERMISSION, .strict= false);
836834
if ($haserr(err))
@@ -870,8 +868,6 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
870868

871869
if (!dry_run)
872870
{
873-
err_ierr;
874-
875871
/* create tablespace directory */
876872
err=$i(pioMakeDir,local_location, .path=linked_path,
877873
.mode=file->mode, .strict= false);

‎src/dir.c‎

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,8 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
852852
parray*links=NULL;
853853
mode_tpg_tablespace_mode=DIR_PERMISSION;
854854
charto_path[MAXPGPATH];
855+
err_ierr=$noerr();
856+
855857

856858
if (waldir_path&& !dir_is_empty(waldir_path,location))
857859
{
@@ -933,15 +935,11 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
933935
waldir_path,to_path);
934936

935937
/* create tablespace directory from waldir_path*/
938+
err=$i(pioMakeDir,drive, .path=waldir_path,
939+
.mode=pg_tablespace_mode, .strict= false);
940+
if ($haserr(err))
936941
{
937-
err_ierr;
938-
939-
err=$i(pioMakeDir,drive, .path=waldir_path,
940-
.mode=pg_tablespace_mode, .strict= false);
941-
if ($haserr(err))
942-
{
943-
elog(WARNING,"%s",$errmsg(err));
944-
}
942+
elog(WARNING,"%s",$errmsg(err));
945943
}
946944

947945
/* create link to linked_path */
@@ -984,15 +982,11 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
984982
linked_path,to_path);
985983

986984
/* create tablespace directory */
985+
err=$i(pioMakeDir,drive, .path=linked_path,
986+
.mode=pg_tablespace_mode, .strict= false);
987+
if ($haserr(err))
987988
{
988-
err_ierr;
989-
990-
err=$i(pioMakeDir,drive, .path=linked_path,
991-
.mode=pg_tablespace_mode, .strict= false);
992-
if ($haserr(err))
993-
{
994-
elog(WARNING,"%s",$errmsg(err));
995-
}
989+
elog(WARNING,"%s",$errmsg(err));
996990
}
997991

998992
/* create link to linked_path */
@@ -1011,15 +1005,11 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
10111005
join_path_components(to_path,data_dir,dir->rel_path);
10121006

10131007
// TODO check exit code
1008+
err=$i(pioMakeDir,drive, .path=to_path, .mode=dir->mode,
1009+
.strict= false);
1010+
if ($haserr(err))
10141011
{
1015-
err_ierr;
1016-
1017-
err=$i(pioMakeDir,drive, .path=to_path, .mode=dir->mode,
1018-
.strict= false);
1019-
if ($haserr(err))
1020-
{
1021-
elog(WARNING,"%s",$errmsg(err));
1022-
}
1012+
elog(WARNING,"%s",$errmsg(err));
10231013
}
10241014
}
10251015

‎src/merge.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ merge_chain(InstanceState *instanceState,
461461
/* in-place merge flags */
462462
boolcompression_match= false;
463463
boolprogram_version_match= false;
464+
err_ierr=$noerr();
465+
464466
/* It's redundant to check block checksumms during merge */
465467
skip_block_validation= true;
466468

@@ -641,7 +643,6 @@ merge_chain(InstanceState *instanceState,
641643
{
642644
chardirpath[MAXPGPATH];
643645
charnew_container[MAXPGPATH];
644-
err_ierr;
645646

646647
makeExternalDirPathByNum(new_container,full_external_prefix,
647648
file->external_dir_num);

‎src/restore.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ restore_chain(pgBackup *dest_backup, parray *parent_chain,
720720
size_ttotal_bytes=0;
721721
charpretty_time[20];
722722
time_tstart_time,end_time;
723+
err_ierr=$noerr();
723724

724725
/* Preparations for actual restoring */
725726
time2iso(timestamp,lengthof(timestamp),dest_backup->start_time, false);
@@ -818,7 +819,6 @@ restore_chain(pgBackup *dest_backup, parray *parent_chain,
818819
for (i=0;i<parray_num(external_dirs);i++)
819820
{
820821
char*dirpath=parray_get(external_dirs,i);
821-
err_ierr;
822822

823823
err=$i(pioMakeDir,dest_backup->database_location,
824824
.path=dirpath, .mode=DIR_PERMISSION, .strict= false);
@@ -844,7 +844,6 @@ restore_chain(pgBackup *dest_backup, parray *parent_chain,
844844
{
845845
char*external_path;
846846
chardirpath[MAXPGPATH];
847-
err_ierr;
848847

849848
if (parray_num(external_dirs)<file->external_dir_num-1)
850849
elog(ERROR,"Inconsistent external directory backup metadata");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp