Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
38a2b95c
Commit
38a2b95c
authored
10 years ago
by
Heikki Linnakangas
Browse files
Options
Downloads
Patches
Plain Diff
Zero padding byte at end of GIN posting list.
This isn't strictly necessary, but helps debugging.
parent
f235db03
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/access/gin/ginpostinglist.c
+13
-0
13 additions, 0 deletions
src/backend/access/gin/ginpostinglist.c
with
13 additions
and
0 deletions
src/backend/access/gin/ginpostinglist.c
+
13
−
0
View file @
38a2b95c
...
@@ -176,6 +176,9 @@ decode_varbyte(unsigned char **ptr)
...
@@ -176,6 +176,9 @@ decode_varbyte(unsigned char **ptr)
* 'maxsize' bytes in size. The number items in the returned segment is
* 'maxsize' bytes in size. The number items in the returned segment is
* returned in *nwritten. If it's not equal to nipd, not all the items fit
* returned in *nwritten. If it's not equal to nipd, not all the items fit
* in 'maxsize', and only the first *nwritten were encoded.
* in 'maxsize', and only the first *nwritten were encoded.
*
* The allocated size of the returned struct is short-aligned, and the padding
* byte at the end, if any, is zero.
*/
*/
GinPostingList
*
GinPostingList
*
ginCompressPostingList
(
const
ItemPointer
ipd
,
int
nipd
,
int
maxsize
,
ginCompressPostingList
(
const
ItemPointer
ipd
,
int
nipd
,
int
maxsize
,
...
@@ -188,9 +191,12 @@ ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize,
...
@@ -188,9 +191,12 @@ ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize,
unsigned
char
*
ptr
;
unsigned
char
*
ptr
;
unsigned
char
*
endptr
;
unsigned
char
*
endptr
;
maxsize
=
SHORTALIGN_DOWN
(
maxsize
);
result
=
palloc
(
maxsize
);
result
=
palloc
(
maxsize
);
maxbytes
=
maxsize
-
offsetof
(
GinPostingList
,
bytes
);
maxbytes
=
maxsize
-
offsetof
(
GinPostingList
,
bytes
);
Assert
(
maxbytes
>
0
);
/* Store the first special item */
/* Store the first special item */
result
->
first
=
ipd
[
0
];
result
->
first
=
ipd
[
0
];
...
@@ -228,6 +234,13 @@ ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize,
...
@@ -228,6 +234,13 @@ ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize,
}
}
result
->
nbytes
=
ptr
-
result
->
bytes
;
result
->
nbytes
=
ptr
-
result
->
bytes
;
/*
* If we wrote an odd number of bytes, zero out the padding byte at the
* end.
*/
if
(
result
->
nbytes
!=
SHORTALIGN
(
result
->
nbytes
))
result
->
bytes
[
result
->
nbytes
]
=
0
;
if
(
nwritten
)
if
(
nwritten
)
*
nwritten
=
totalpacked
;
*
nwritten
=
totalpacked
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment