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

Commit56f8f96

Browse files
committed
Fix compilation failure of vacuumdb and reindexdb with OpenBSD
FD_SETSIZE is included in sys/select.h per POSIX, and this headerinclusion has been moved to scripts_parallel.c as of5f38403 withoutmoving the variable, causing a compilation failure on recent versions ofOpenBSD (6.6 was the version used in the report).In order to take care of the failure, move FD_SETSIZE directly toscripts_parallel.c with a wrapper controlling the maximum number ofparallel slots supported, based on a suggestion by Andres Freund.While on it, reduce the maximum number to be less than FD_SETSIZE,leaving some room for stdin, stdout and such as they consume some filedescriptors.The buildfarm did not complain about that, as it happens to only bean issue on recent versions of OpenBSD and there is no coverage in thisarea.51c3e9f fixed a similar set of issues.Bug: #15964Reported-by: Sean FarrellDiscussion:https://postgr.es/m/15964-c1753bdfed722e04@postgresql.org
1 parent0431a78 commit56f8f96

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

‎src/bin/scripts/reindexdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ main(int argc, char *argv[])
153153
pg_log_error("number of parallel jobs must be at least 1");
154154
exit(1);
155155
}
156-
if (concurrentCons>FD_SETSIZE-1)
156+
if (concurrentCons>ParallelSlotsMax())
157157
{
158158
pg_log_error("too many parallel jobs requested (maximum: %d)",
159-
FD_SETSIZE-1);
159+
ParallelSlotsMax());
160160
exit(1);
161161
}
162162
break;

‎src/bin/scripts/scripts_parallel.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ select_loop(int maxFd, fd_set *workerset, bool *aborting)
9494
returni;
9595
}
9696

97+
/*
98+
* ParallelSlotsMax
99+
*Returns the maximum number of parallel slots supported.
100+
*
101+
* Note that this is included here as FD_SETSIZE is declared in sys/select.h
102+
* per POSIX.
103+
*/
104+
int
105+
ParallelSlotsMax(void)
106+
{
107+
/* leave some room for pre-existing fds */
108+
returnFD_SETSIZE-10;
109+
}
110+
97111
/*
98112
* ParallelSlotsGetIdle
99113
*Return a connection slot that is ready to execute a command.

‎src/bin/scripts/scripts_parallel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ typedef struct ParallelSlot
2121
boolisFree;/* Is it known to be idle? */
2222
}ParallelSlot;
2323

24+
externintParallelSlotsMax(void);
25+
2426
externParallelSlot*ParallelSlotsGetIdle(ParallelSlot*slots,intnumslots);
2527

2628
externParallelSlot*ParallelSlotsSetup(constchar*dbname,constchar*host,

‎src/bin/scripts/vacuumdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ main(int argc, char *argv[])
181181
pg_log_error("number of parallel jobs must be at least 1");
182182
exit(1);
183183
}
184-
if (concurrentCons>FD_SETSIZE-1)
184+
if (concurrentCons>ParallelSlotsMax())
185185
{
186186
pg_log_error("too many parallel jobs requested (maximum: %d)",
187-
FD_SETSIZE-1);
187+
ParallelSlotsMax());
188188
exit(1);
189189
}
190190
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp