Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9ee0a7df
Commit
9ee0a7df
authored
Oct 29, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some allocation size calculation errors that would cause pgbench
to fail with large test scripts.
parent
4a57a457
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
contrib/pgbench/pgbench.c
contrib/pgbench/pgbench.c
+9
-9
No files found.
contrib/pgbench/pgbench.c
View file @
9ee0a7df
/*
/*
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.4
4 2005/10/15 20:24:00
tgl Exp $
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.4
5 2005/10/29 19:38:07
tgl Exp $
*
*
* pgbench: a simple benchmark program for PostgreSQL
* pgbench: a simple benchmark program for PostgreSQL
* written by Tatsuo Ishii
* written by Tatsuo Ishii
...
@@ -868,7 +868,7 @@ process_file(char *filename)
...
@@ -868,7 +868,7 @@ process_file(char *filename)
}
}
alloc_num
=
COMMANDS_ALLOC_NUM
;
alloc_num
=
COMMANDS_ALLOC_NUM
;
my_commands
=
(
Command
**
)
malloc
(
sizeof
(
Command
*
*
)
*
alloc_num
);
my_commands
=
(
Command
**
)
malloc
(
sizeof
(
Command
*
)
*
alloc_num
);
if
(
my_commands
==
NULL
)
if
(
my_commands
==
NULL
)
return
false
;
return
false
;
...
@@ -876,7 +876,7 @@ process_file(char *filename)
...
@@ -876,7 +876,7 @@ process_file(char *filename)
fd
=
stdin
;
fd
=
stdin
;
else
if
((
fd
=
fopen
(
filename
,
"r"
))
==
NULL
)
else
if
((
fd
=
fopen
(
filename
,
"r"
))
==
NULL
)
{
{
fprintf
(
stderr
,
"%s: %s
\n
"
,
strerror
(
errno
),
filename
);
fprintf
(
stderr
,
"%s: %s
\n
"
,
filename
,
strerror
(
errno
)
);
return
false
;
return
false
;
}
}
...
@@ -899,7 +899,7 @@ process_file(char *filename)
...
@@ -899,7 +899,7 @@ process_file(char *filename)
if
(
lineno
>=
alloc_num
)
if
(
lineno
>=
alloc_num
)
{
{
alloc_num
+=
COMMANDS_ALLOC_NUM
;
alloc_num
+=
COMMANDS_ALLOC_NUM
;
my_commands
=
realloc
(
my_commands
,
alloc_num
);
my_commands
=
realloc
(
my_commands
,
sizeof
(
Command
*
)
*
alloc_num
);
if
(
my_commands
==
NULL
)
if
(
my_commands
==
NULL
)
{
{
fclose
(
fd
);
fclose
(
fd
);
...
@@ -930,7 +930,7 @@ process_builtin(char *tb)
...
@@ -930,7 +930,7 @@ process_builtin(char *tb)
return
NULL
;
return
NULL
;
alloc_num
=
COMMANDS_ALLOC_NUM
;
alloc_num
=
COMMANDS_ALLOC_NUM
;
my_commands
=
malloc
(
sizeof
(
Command
*
*
)
*
alloc_num
);
my_commands
=
(
Command
**
)
malloc
(
sizeof
(
Command
*
)
*
alloc_num
);
if
(
my_commands
==
NULL
)
if
(
my_commands
==
NULL
)
return
NULL
;
return
NULL
;
...
@@ -965,7 +965,7 @@ process_builtin(char *tb)
...
@@ -965,7 +965,7 @@ process_builtin(char *tb)
if
(
lineno
>=
alloc_num
)
if
(
lineno
>=
alloc_num
)
{
{
alloc_num
+=
COMMANDS_ALLOC_NUM
;
alloc_num
+=
COMMANDS_ALLOC_NUM
;
my_commands
=
realloc
(
my_commands
,
alloc_num
);
my_commands
=
realloc
(
my_commands
,
sizeof
(
Command
*
)
*
alloc_num
);
if
(
my_commands
==
NULL
)
if
(
my_commands
==
NULL
)
{
{
return
NULL
;
return
NULL
;
...
@@ -1031,7 +1031,7 @@ main(int argc, char **argv)
...
@@ -1031,7 +1031,7 @@ main(int argc, char **argv)
* 2: skip update of branches and tellers */
* 2: skip update of branches and tellers */
char
*
filename
=
NULL
;
char
*
filename
=
NULL
;
static
CState
*
state
;
/* status of clients */
CState
*
state
;
/* status of clients */
struct
timeval
tv1
;
/* start up time */
struct
timeval
tv1
;
/* start up time */
struct
timeval
tv2
;
/* after establishing all connections to the
struct
timeval
tv2
;
/* after establishing all connections to the
...
@@ -1101,7 +1101,7 @@ main(int argc, char **argv)
...
@@ -1101,7 +1101,7 @@ main(int argc, char **argv)
if
(
getrlimit
(
RLIMIT_OFILE
,
&
rlim
)
==
-
1
)
if
(
getrlimit
(
RLIMIT_OFILE
,
&
rlim
)
==
-
1
)
#endif
/* RLIMIT_NOFILE */
#endif
/* RLIMIT_NOFILE */
{
{
fprintf
(
stderr
,
"getrlimit failed
. reason
: %s
\n
"
,
strerror
(
errno
));
fprintf
(
stderr
,
"getrlimit failed: %s
\n
"
,
strerror
(
errno
));
exit
(
1
);
exit
(
1
);
}
}
if
(
rlim
.
rlim_cur
<=
(
nclients
+
2
))
if
(
rlim
.
rlim_cur
<=
(
nclients
+
2
))
...
@@ -1173,7 +1173,7 @@ main(int argc, char **argv)
...
@@ -1173,7 +1173,7 @@ main(int argc, char **argv)
remains
=
nclients
;
remains
=
nclients
;
state
=
(
CState
*
)
malloc
(
sizeof
(
*
s
tate
)
*
nclients
);
state
=
(
CState
*
)
malloc
(
sizeof
(
CS
tate
)
*
nclients
);
if
(
state
==
NULL
)
if
(
state
==
NULL
)
{
{
fprintf
(
stderr
,
"Couldn't allocate memory for state
\n
"
);
fprintf
(
stderr
,
"Couldn't allocate memory for state
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment