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

Commitad1581d

Browse files
committed
Use USECS_PER_SEC from datatype/timestamp.h
We had two places defining their own constants for this.Author: Álvaro Herrera <alvherre@kurilemu.de>Reviewed-by: Peter Smith <smithpb2250@gmail.com>Discussion:https://postgr.es/m/202510311750.mxiykx3tp4mx@alvherre.pgsql
1 parent65f4976 commitad1581d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

‎src/bin/pg_basebackup/pg_createsubscriber.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include"common/logging.h"
2424
#include"common/pg_prng.h"
2525
#include"common/restricted_token.h"
26+
#include"datatype/timestamp.h"
2627
#include"fe_utils/recovery_gen.h"
2728
#include"fe_utils/simple_list.h"
2829
#include"fe_utils/string_utils.h"
@@ -129,7 +130,6 @@ static void drop_existing_subscription(PGconn *conn, const char *subname,
129130
staticvoidget_publisher_databases(structCreateSubscriberOptions*opt,
130131
booldbnamespecified);
131132

132-
#defineUSEC_PER_SEC1000000
133133
#defineWAIT_INTERVAL1/* 1 second */
134134

135135
staticconstchar*progname;
@@ -1604,8 +1604,7 @@ wait_for_end_recovery(const char *conninfo, const struct CreateSubscriberOptions
16041604
}
16051605

16061606
/* Keep waiting */
1607-
pg_usleep(WAIT_INTERVAL*USEC_PER_SEC);
1608-
1607+
pg_usleep(WAIT_INTERVAL*USECS_PER_SEC);
16091608
timer+=WAIT_INTERVAL;
16101609
}
16111610

‎src/bin/pg_ctl/pg_ctl.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include"common/file_perm.h"
2727
#include"common/logging.h"
2828
#include"common/string.h"
29+
#include"datatype/timestamp.h"
2930
#include"getopt_long.h"
3031
#include"utils/pidfile.h"
3132

@@ -68,9 +69,9 @@ typedef enum
6869

6970
#defineDEFAULT_WAIT60
7071

71-
#defineUSEC_PER_SEC1000000
72-
73-
#defineWAITS_PER_SEC10/* shoulddivideUSEC_PER_SEC evenly */
72+
#defineWAITS_PER_SEC10
73+
StaticAssertDecl(USECS_PER_SEC %WAITS_PER_SEC==0,
74+
"WAITS_PER_SEC mustdivideUSECS_PER_SEC evenly");
7475

7576
staticbooldo_wait= true;
7677
staticintwait_seconds=DEFAULT_WAIT;
@@ -699,7 +700,7 @@ wait_for_postmaster_start(pid_t pm_pid, bool do_checkpoint)
699700
print_msg(".");
700701
}
701702

702-
pg_usleep(USEC_PER_SEC /WAITS_PER_SEC);
703+
pg_usleep(USECS_PER_SEC /WAITS_PER_SEC);
703704
}
704705

705706
/* out of patience; report that postmaster is still starting up */
@@ -738,7 +739,7 @@ wait_for_postmaster_stop(void)
738739

739740
if (cnt %WAITS_PER_SEC==0)
740741
print_msg(".");
741-
pg_usleep(USEC_PER_SEC /WAITS_PER_SEC);
742+
pg_usleep(USECS_PER_SEC /WAITS_PER_SEC);
742743
}
743744
return false;/* timeout reached */
744745
}
@@ -771,7 +772,7 @@ wait_for_postmaster_promote(void)
771772

772773
if (cnt %WAITS_PER_SEC==0)
773774
print_msg(".");
774-
pg_usleep(USEC_PER_SEC /WAITS_PER_SEC);
775+
pg_usleep(USECS_PER_SEC /WAITS_PER_SEC);
775776
}
776777
return false;/* timeout reached */
777778
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp