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
b6ec7c92
Commit
b6ec7c92
authored
Mar 18, 2014
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some remaining int64 vestiges in contrib/test_shm_mq.
Andres Freund and Tom Lane
parent
c676ac0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
contrib/test_shm_mq/setup.c
contrib/test_shm_mq/setup.c
+10
-5
contrib/test_shm_mq/test.c
contrib/test_shm_mq/test.c
+2
-2
No files found.
contrib/test_shm_mq/setup.c
View file @
b6ec7c92
...
...
@@ -92,7 +92,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
{
shm_toc_estimator
e
;
int
i
;
uint64
segsize
;
Size
segsize
;
dsm_segment
*
seg
;
shm_toc
*
toc
;
test_shm_mq_header
*
hdr
;
...
...
@@ -101,8 +101,12 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
if
(
queue_size
<
0
||
((
uint64
)
queue_size
)
<
shm_mq_minimum_size
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"queue size must be at least %lu bytes"
,
(
unsigned
long
)
shm_mq_minimum_size
)));
errmsg
(
"queue size must be at least %zu bytes"
,
shm_mq_minimum_size
)));
if
(
queue_size
!=
((
Size
)
queue_size
))
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"queue size overflows size_t"
)));
/*
* Estimate how much shared memory we need.
...
...
@@ -116,7 +120,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
shm_toc_initialize_estimator
(
&
e
);
shm_toc_estimate_chunk
(
&
e
,
sizeof
(
test_shm_mq_header
));
for
(
i
=
0
;
i
<=
nworkers
;
++
i
)
shm_toc_estimate_chunk
(
&
e
,
queue_size
);
shm_toc_estimate_chunk
(
&
e
,
(
Size
)
queue_size
);
shm_toc_estimate_keys
(
&
e
,
2
+
nworkers
);
segsize
=
shm_toc_estimate
(
&
e
);
...
...
@@ -138,7 +142,8 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
{
shm_mq
*
mq
;
mq
=
shm_mq_create
(
shm_toc_allocate
(
toc
,
queue_size
),
queue_size
);
mq
=
shm_mq_create
(
shm_toc_allocate
(
toc
,
(
Size
)
queue_size
),
(
Size
)
queue_size
);
shm_toc_insert
(
toc
,
i
+
1
,
mq
);
if
(
i
==
0
)
...
...
contrib/test_shm_mq/test.c
View file @
b6ec7c92
...
...
@@ -254,12 +254,12 @@ verify_message(Size origlen, char *origdata, Size newlen, char *newdata)
if
(
origlen
!=
newlen
)
ereport
(
ERROR
,
(
errmsg
(
"message corrupted"
),
errdetail
(
"The original message was
"
UINT64_FORMAT
" bytes but the final message is "
UINT64_FORMAT
"
bytes."
,
errdetail
(
"The original message was
%zu bytes but the final message is %zu
bytes."
,
origlen
,
newlen
)));
for
(
i
=
0
;
i
<
origlen
;
++
i
)
if
(
origdata
[
i
]
!=
newdata
[
i
])
ereport
(
ERROR
,
(
errmsg
(
"message corrupted"
),
errdetail
(
"The new and original messages differ at byte
"
UINT64_FORMAT
" of "
UINT64_FORMAT
"
."
,
i
,
origlen
)));
errdetail
(
"The new and original messages differ at byte
%zu of %zu
."
,
i
,
origlen
)));
}
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