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
5997386a
Commit
5997386a
authored
Jan 25, 2006
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the no-longer-useful HashItem/HashItemData level of structure.
Same motivation as for BTItem.
parent
c389760c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
98 deletions
+34
-98
src/backend/access/hash/hash.c
src/backend/access/hash/hash.c
+7
-15
src/backend/access/hash/hashinsert.c
src/backend/access/hash/hashinsert.c
+9
-14
src/backend/access/hash/hashovfl.c
src/backend/access/hash/hashovfl.c
+6
-7
src/backend/access/hash/hashpage.c
src/backend/access/hash/hashpage.c
+5
-9
src/backend/access/hash/hashsearch.c
src/backend/access/hash/hashsearch.c
+4
-10
src/backend/access/hash/hashutil.c
src/backend/access/hash/hashutil.c
+1
-33
src/include/access/hash.h
src/include/access/hash.h
+2
-10
No files found.
src/backend/access/hash/hash.c
View file @
5997386a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.8
2 2005/11/06 19:29:00
tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.8
3 2006/01/25 23:26:11
tgl Exp $
*
*
* NOTES
* NOTES
* This file contains only the public interface routines.
* This file contains only the public interface routines.
...
@@ -91,7 +91,6 @@ hashbuildCallback(Relation index,
...
@@ -91,7 +91,6 @@ hashbuildCallback(Relation index,
{
{
HashBuildState
*
buildstate
=
(
HashBuildState
*
)
state
;
HashBuildState
*
buildstate
=
(
HashBuildState
*
)
state
;
IndexTuple
itup
;
IndexTuple
itup
;
HashItem
hitem
;
/* form an index tuple and point it at the heap tuple */
/* form an index tuple and point it at the heap tuple */
itup
=
index_form_tuple
(
RelationGetDescr
(
index
),
values
,
isnull
);
itup
=
index_form_tuple
(
RelationGetDescr
(
index
),
values
,
isnull
);
...
@@ -104,13 +103,10 @@ hashbuildCallback(Relation index,
...
@@ -104,13 +103,10 @@ hashbuildCallback(Relation index,
return
;
return
;
}
}
hitem
=
_hash_formitem
(
itup
);
_hash_doinsert
(
index
,
itup
);
_hash_doinsert
(
index
,
hitem
);
buildstate
->
indtuples
+=
1
;
buildstate
->
indtuples
+=
1
;
pfree
(
hitem
);
pfree
(
itup
);
pfree
(
itup
);
}
}
...
@@ -132,7 +128,6 @@ hashinsert(PG_FUNCTION_ARGS)
...
@@ -132,7 +128,6 @@ hashinsert(PG_FUNCTION_ARGS)
Relation
heapRel
=
(
Relation
)
PG_GETARG_POINTER
(
4
);
Relation
heapRel
=
(
Relation
)
PG_GETARG_POINTER
(
4
);
bool
checkUnique
=
PG_GETARG_BOOL
(
5
);
bool
checkUnique
=
PG_GETARG_BOOL
(
5
);
#endif
#endif
HashItem
hitem
;
IndexTuple
itup
;
IndexTuple
itup
;
/* generate an index tuple */
/* generate an index tuple */
...
@@ -154,11 +149,8 @@ hashinsert(PG_FUNCTION_ARGS)
...
@@ -154,11 +149,8 @@ hashinsert(PG_FUNCTION_ARGS)
PG_RETURN_BOOL
(
false
);
PG_RETURN_BOOL
(
false
);
}
}
hitem
=
_hash_formitem
(
itup
);
_hash_doinsert
(
rel
,
itup
);
_hash_doinsert
(
rel
,
hitem
);
pfree
(
hitem
);
pfree
(
itup
);
pfree
(
itup
);
PG_RETURN_BOOL
(
true
);
PG_RETURN_BOOL
(
true
);
...
@@ -565,12 +557,12 @@ loop_top:
...
@@ -565,12 +557,12 @@ loop_top:
maxoffno
=
PageGetMaxOffsetNumber
(
page
);
maxoffno
=
PageGetMaxOffsetNumber
(
page
);
while
(
offno
<=
maxoffno
)
while
(
offno
<=
maxoffno
)
{
{
HashItem
hitem
;
IndexTuple
itup
;
ItemPointer
htup
;
ItemPointer
htup
;
hitem
=
(
HashItem
)
PageGetItem
(
page
,
itup
=
(
IndexTuple
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offno
));
PageGetItemId
(
page
,
offno
));
htup
=
&
(
hitem
->
hash_itup
.
t_tid
);
htup
=
&
(
itup
->
t_tid
);
if
(
callback
(
htup
,
callback_state
))
if
(
callback
(
htup
,
callback_state
))
{
{
/* delete the item from the page */
/* delete the item from the page */
...
...
src/backend/access/hash/hashinsert.c
View file @
5997386a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.4
0 2005/11/06 19:29:00
tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.4
1 2006/01/25 23:26:11
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -20,23 +20,21 @@
...
@@ -20,23 +20,21 @@
static
OffsetNumber
_hash_pgaddtup
(
Relation
rel
,
Buffer
buf
,
static
OffsetNumber
_hash_pgaddtup
(
Relation
rel
,
Buffer
buf
,
Size
itemsize
,
HashItem
hitem
);
Size
itemsize
,
IndexTuple
itup
);
/*
/*
* _hash_doinsert() -- Handle insertion of a single
HashItem in the tab
le.
* _hash_doinsert() -- Handle insertion of a single
index tup
le.
*
*
* This routine is called by the public interface routines, hashbuild
* This routine is called by the public interface routines, hashbuild
* and hashinsert. By here, hashitem is completely filled in.
* and hashinsert. By here, itup is completely filled in.
* The datum to be used as a "key" is in the hashitem.
*/
*/
void
void
_hash_doinsert
(
Relation
rel
,
HashItem
hitem
)
_hash_doinsert
(
Relation
rel
,
IndexTuple
itup
)
{
{
Buffer
buf
;
Buffer
buf
;
Buffer
metabuf
;
Buffer
metabuf
;
HashMetaPage
metap
;
HashMetaPage
metap
;
IndexTuple
itup
;
BlockNumber
blkno
;
BlockNumber
blkno
;
Page
page
;
Page
page
;
HashPageOpaque
pageopaque
;
HashPageOpaque
pageopaque
;
...
@@ -51,7 +49,6 @@ _hash_doinsert(Relation rel, HashItem hitem)
...
@@ -51,7 +49,6 @@ _hash_doinsert(Relation rel, HashItem hitem)
* Compute the hash key for the item. We do this first so as not to need
* Compute the hash key for the item. We do this first so as not to need
* to hold any locks while running the hash function.
* to hold any locks while running the hash function.
*/
*/
itup
=
&
(
hitem
->
hash_itup
);
if
(
rel
->
rd_rel
->
relnatts
!=
1
)
if
(
rel
->
rd_rel
->
relnatts
!=
1
)
elog
(
ERROR
,
"hash indexes support only one index key"
);
elog
(
ERROR
,
"hash indexes support only one index key"
);
datum
=
index_getattr
(
itup
,
1
,
RelationGetDescr
(
rel
),
&
isnull
);
datum
=
index_getattr
(
itup
,
1
,
RelationGetDescr
(
rel
),
&
isnull
);
...
@@ -59,9 +56,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
...
@@ -59,9 +56,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
hashkey
=
_hash_datum2hashkey
(
rel
,
datum
);
hashkey
=
_hash_datum2hashkey
(
rel
,
datum
);
/* compute item size too */
/* compute item size too */
itemsz
=
IndexTupleDSize
(
hitem
->
hash_itup
)
itemsz
=
IndexTupleDSize
(
*
itup
);
+
(
sizeof
(
HashItemData
)
-
sizeof
(
IndexTupleData
));
itemsz
=
MAXALIGN
(
itemsz
);
/* be safe, PageAddItem will do this but we
itemsz
=
MAXALIGN
(
itemsz
);
/* be safe, PageAddItem will do this but we
* need to be consistent */
* need to be consistent */
...
@@ -157,7 +152,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
...
@@ -157,7 +152,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
}
}
/* found page with enough space, so add the item here */
/* found page with enough space, so add the item here */
(
void
)
_hash_pgaddtup
(
rel
,
buf
,
itemsz
,
hitem
);
(
void
)
_hash_pgaddtup
(
rel
,
buf
,
itemsz
,
itup
);
/* write and release the modified page */
/* write and release the modified page */
_hash_wrtbuf
(
rel
,
buf
);
_hash_wrtbuf
(
rel
,
buf
);
...
@@ -199,7 +194,7 @@ static OffsetNumber
...
@@ -199,7 +194,7 @@ static OffsetNumber
_hash_pgaddtup
(
Relation
rel
,
_hash_pgaddtup
(
Relation
rel
,
Buffer
buf
,
Buffer
buf
,
Size
itemsize
,
Size
itemsize
,
HashItem
hitem
)
IndexTuple
itup
)
{
{
OffsetNumber
itup_off
;
OffsetNumber
itup_off
;
Page
page
;
Page
page
;
...
@@ -208,7 +203,7 @@ _hash_pgaddtup(Relation rel,
...
@@ -208,7 +203,7 @@ _hash_pgaddtup(Relation rel,
page
=
BufferGetPage
(
buf
);
page
=
BufferGetPage
(
buf
);
itup_off
=
OffsetNumberNext
(
PageGetMaxOffsetNumber
(
page
));
itup_off
=
OffsetNumberNext
(
PageGetMaxOffsetNumber
(
page
));
if
(
PageAddItem
(
page
,
(
Item
)
hitem
,
itemsize
,
itup_off
,
LP_USED
)
if
(
PageAddItem
(
page
,
(
Item
)
itup
,
itemsize
,
itup_off
,
LP_USED
)
==
InvalidOffsetNumber
)
==
InvalidOffsetNumber
)
elog
(
ERROR
,
"failed to add index item to
\"
%s
\"
"
,
elog
(
ERROR
,
"failed to add index item to
\"
%s
\"
"
,
RelationGetRelationName
(
rel
));
RelationGetRelationName
(
rel
));
...
...
src/backend/access/hash/hashovfl.c
View file @
5997386a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.
49 2005/11/22 18:17:05 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.
50 2006/01/25 23:26:11 tgl
Exp $
*
*
* NOTES
* NOTES
* Overflow pages look like ordinary relation pages.
* Overflow pages look like ordinary relation pages.
...
@@ -561,7 +561,7 @@ _hash_squeezebucket(Relation rel,
...
@@ -561,7 +561,7 @@ _hash_squeezebucket(Relation rel,
HashPageOpaque
ropaque
;
HashPageOpaque
ropaque
;
OffsetNumber
woffnum
;
OffsetNumber
woffnum
;
OffsetNumber
roffnum
;
OffsetNumber
roffnum
;
HashItem
hitem
;
IndexTuple
itup
;
Size
itemsz
;
Size
itemsz
;
/*
/*
...
@@ -608,10 +608,9 @@ _hash_squeezebucket(Relation rel,
...
@@ -608,10 +608,9 @@ _hash_squeezebucket(Relation rel,
/* this test is needed in case page is empty on entry */
/* this test is needed in case page is empty on entry */
if
(
roffnum
<=
PageGetMaxOffsetNumber
(
rpage
))
if
(
roffnum
<=
PageGetMaxOffsetNumber
(
rpage
))
{
{
hitem
=
(
HashItem
)
PageGetItem
(
rpage
,
itup
=
(
IndexTuple
)
PageGetItem
(
rpage
,
PageGetItemId
(
rpage
,
roffnum
));
PageGetItemId
(
rpage
,
roffnum
));
itemsz
=
IndexTupleDSize
(
hitem
->
hash_itup
)
itemsz
=
IndexTupleDSize
(
*
itup
);
+
(
sizeof
(
HashItemData
)
-
sizeof
(
IndexTupleData
));
itemsz
=
MAXALIGN
(
itemsz
);
itemsz
=
MAXALIGN
(
itemsz
);
/*
/*
...
@@ -645,7 +644,7 @@ _hash_squeezebucket(Relation rel,
...
@@ -645,7 +644,7 @@ _hash_squeezebucket(Relation rel,
* we have found room so insert on the "write" page.
* we have found room so insert on the "write" page.
*/
*/
woffnum
=
OffsetNumberNext
(
PageGetMaxOffsetNumber
(
wpage
));
woffnum
=
OffsetNumberNext
(
PageGetMaxOffsetNumber
(
wpage
));
if
(
PageAddItem
(
wpage
,
(
Item
)
hitem
,
itemsz
,
woffnum
,
LP_USED
)
if
(
PageAddItem
(
wpage
,
(
Item
)
itup
,
itemsz
,
woffnum
,
LP_USED
)
==
InvalidOffsetNumber
)
==
InvalidOffsetNumber
)
elog
(
ERROR
,
"failed to add index item to
\"
%s
\"
"
,
elog
(
ERROR
,
"failed to add index item to
\"
%s
\"
"
,
RelationGetRelationName
(
rel
));
RelationGetRelationName
(
rel
));
...
...
src/backend/access/hash/hashpage.c
View file @
5997386a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.5
4 2005/11/22 18:17:05 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.5
5 2006/01/25 23:26:11 tgl
Exp $
*
*
* NOTES
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
* Postgres hash pages look like ordinary relation pages. The opaque
...
@@ -249,7 +249,7 @@ _hash_metapinit(Relation rel)
...
@@ -249,7 +249,7 @@ _hash_metapinit(Relation rel)
*/
*/
data_width
=
get_typavgwidth
(
RelationGetDescr
(
rel
)
->
attrs
[
0
]
->
atttypid
,
data_width
=
get_typavgwidth
(
RelationGetDescr
(
rel
)
->
attrs
[
0
]
->
atttypid
,
RelationGetDescr
(
rel
)
->
attrs
[
0
]
->
atttypmod
);
RelationGetDescr
(
rel
)
->
attrs
[
0
]
->
atttypmod
);
item_width
=
MAXALIGN
(
sizeof
(
HashItem
Data
))
+
MAXALIGN
(
data_width
)
+
item_width
=
MAXALIGN
(
sizeof
(
IndexTuple
Data
))
+
MAXALIGN
(
data_width
)
+
sizeof
(
ItemIdData
);
/* include the line pointer */
sizeof
(
ItemIdData
);
/* include the line pointer */
ffactor
=
(
BLCKSZ
*
3
/
4
)
/
item_width
;
ffactor
=
(
BLCKSZ
*
3
/
4
)
/
item_width
;
/* keep to a sane range */
/* keep to a sane range */
...
@@ -539,7 +539,6 @@ _hash_splitbucket(Relation rel,
...
@@ -539,7 +539,6 @@ _hash_splitbucket(Relation rel,
BlockNumber
nblkno
;
BlockNumber
nblkno
;
bool
null
;
bool
null
;
Datum
datum
;
Datum
datum
;
HashItem
hitem
;
HashPageOpaque
oopaque
;
HashPageOpaque
oopaque
;
HashPageOpaque
nopaque
;
HashPageOpaque
nopaque
;
IndexTuple
itup
;
IndexTuple
itup
;
...
@@ -618,8 +617,7 @@ _hash_splitbucket(Relation rel,
...
@@ -618,8 +617,7 @@ _hash_splitbucket(Relation rel,
* It is annoying to call the hash function while holding locks, but
* It is annoying to call the hash function while holding locks, but
* releasing and relocking the page for each tuple is unappealing too.
* releasing and relocking the page for each tuple is unappealing too.
*/
*/
hitem
=
(
HashItem
)
PageGetItem
(
opage
,
PageGetItemId
(
opage
,
ooffnum
));
itup
=
(
IndexTuple
)
PageGetItem
(
opage
,
PageGetItemId
(
opage
,
ooffnum
));
itup
=
&
(
hitem
->
hash_itup
);
datum
=
index_getattr
(
itup
,
1
,
itupdesc
,
&
null
);
datum
=
index_getattr
(
itup
,
1
,
itupdesc
,
&
null
);
Assert
(
!
null
);
Assert
(
!
null
);
...
@@ -633,9 +631,7 @@ _hash_splitbucket(Relation rel,
...
@@ -633,9 +631,7 @@ _hash_splitbucket(Relation rel,
* current page in the new bucket, we must allocate a new overflow
* current page in the new bucket, we must allocate a new overflow
* page and place the tuple on that page instead.
* page and place the tuple on that page instead.
*/
*/
itemsz
=
IndexTupleDSize
(
hitem
->
hash_itup
)
itemsz
=
IndexTupleDSize
(
*
itup
);
+
(
sizeof
(
HashItemData
)
-
sizeof
(
IndexTupleData
));
itemsz
=
MAXALIGN
(
itemsz
);
itemsz
=
MAXALIGN
(
itemsz
);
if
(
PageGetFreeSpace
(
npage
)
<
itemsz
)
if
(
PageGetFreeSpace
(
npage
)
<
itemsz
)
...
@@ -650,7 +646,7 @@ _hash_splitbucket(Relation rel,
...
@@ -650,7 +646,7 @@ _hash_splitbucket(Relation rel,
}
}
noffnum
=
OffsetNumberNext
(
PageGetMaxOffsetNumber
(
npage
));
noffnum
=
OffsetNumberNext
(
PageGetMaxOffsetNumber
(
npage
));
if
(
PageAddItem
(
npage
,
(
Item
)
hitem
,
itemsz
,
noffnum
,
LP_USED
)
if
(
PageAddItem
(
npage
,
(
Item
)
itup
,
itemsz
,
noffnum
,
LP_USED
)
==
InvalidOffsetNumber
)
==
InvalidOffsetNumber
)
elog
(
ERROR
,
"failed to add index item to
\"
%s
\"
"
,
elog
(
ERROR
,
"failed to add index item to
\"
%s
\"
"
,
RelationGetRelationName
(
rel
));
RelationGetRelationName
(
rel
));
...
...
src/backend/access/hash/hashsearch.c
View file @
5997386a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.4
2 2005/11/06 19:29:00
tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.4
3 2006/01/25 23:26:11
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -37,7 +37,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
...
@@ -37,7 +37,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
Page
page
;
Page
page
;
OffsetNumber
offnum
;
OffsetNumber
offnum
;
ItemPointer
current
;
ItemPointer
current
;
HashItem
hitem
;
IndexTuple
itup
;
IndexTuple
itup
;
/* we still have the buffer pinned and read-locked */
/* we still have the buffer pinned and read-locked */
...
@@ -55,8 +54,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
...
@@ -55,8 +54,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
offnum
=
ItemPointerGetOffsetNumber
(
current
);
offnum
=
ItemPointerGetOffsetNumber
(
current
);
_hash_checkpage
(
rel
,
buf
,
LH_BUCKET_PAGE
|
LH_OVERFLOW_PAGE
);
_hash_checkpage
(
rel
,
buf
,
LH_BUCKET_PAGE
|
LH_OVERFLOW_PAGE
);
page
=
BufferGetPage
(
buf
);
page
=
BufferGetPage
(
buf
);
hitem
=
(
HashItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offnum
));
itup
=
(
IndexTuple
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offnum
));
itup
=
&
hitem
->
hash_itup
;
scan
->
xs_ctup
.
t_self
=
itup
->
t_tid
;
scan
->
xs_ctup
.
t_self
=
itup
->
t_tid
;
return
true
;
return
true
;
...
@@ -126,7 +124,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
...
@@ -126,7 +124,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
Page
page
;
Page
page
;
HashPageOpaque
opaque
;
HashPageOpaque
opaque
;
HashMetaPage
metap
;
HashMetaPage
metap
;
HashItem
hitem
;
IndexTuple
itup
;
IndexTuple
itup
;
ItemPointer
current
;
ItemPointer
current
;
OffsetNumber
offnum
;
OffsetNumber
offnum
;
...
@@ -218,8 +215,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
...
@@ -218,8 +215,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
offnum
=
ItemPointerGetOffsetNumber
(
current
);
offnum
=
ItemPointerGetOffsetNumber
(
current
);
_hash_checkpage
(
rel
,
buf
,
LH_BUCKET_PAGE
|
LH_OVERFLOW_PAGE
);
_hash_checkpage
(
rel
,
buf
,
LH_BUCKET_PAGE
|
LH_OVERFLOW_PAGE
);
page
=
BufferGetPage
(
buf
);
page
=
BufferGetPage
(
buf
);
hitem
=
(
HashItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offnum
));
itup
=
(
IndexTuple
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offnum
));
itup
=
&
hitem
->
hash_itup
;
scan
->
xs_ctup
.
t_self
=
itup
->
t_tid
;
scan
->
xs_ctup
.
t_self
=
itup
->
t_tid
;
return
true
;
return
true
;
...
@@ -248,7 +244,6 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
...
@@ -248,7 +244,6 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
OffsetNumber
maxoff
;
OffsetNumber
maxoff
;
OffsetNumber
offnum
;
OffsetNumber
offnum
;
BlockNumber
blkno
;
BlockNumber
blkno
;
HashItem
hitem
;
IndexTuple
itup
;
IndexTuple
itup
;
current
=
&
(
scan
->
currentItemData
);
current
=
&
(
scan
->
currentItemData
);
...
@@ -345,8 +340,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
...
@@ -345,8 +340,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
}
}
/* get ready to check this tuple */
/* get ready to check this tuple */
hitem
=
(
HashItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offnum
));
itup
=
(
IndexTuple
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offnum
));
itup
=
&
hitem
->
hash_itup
;
}
while
(
!
_hash_checkqual
(
scan
,
itup
));
}
while
(
!
_hash_checkqual
(
scan
,
itup
));
/* if we made it to here, we've found a valid tuple */
/* if we made it to here, we've found a valid tuple */
...
...
src/backend/access/hash/hashutil.c
View file @
5997386a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.4
5 2006/01/14 22:03:35
tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.4
6 2006/01/25 23:26:11
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -60,38 +60,6 @@ _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
...
@@ -60,38 +60,6 @@ _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
return
true
;
return
true
;
}
}
/*
* _hash_formitem -- construct a hash index entry
*/
HashItem
_hash_formitem
(
IndexTuple
itup
)
{
int
nbytes_hitem
;
HashItem
hitem
;
Size
tuplen
;
/* disallow nulls in hash keys */
if
(
IndexTupleHasNulls
(
itup
))
ereport
(
ERROR
,
(
errcode
(
ERRCODE_FEATURE_NOT_SUPPORTED
),
errmsg
(
"hash indexes cannot contain null keys"
)));
/*
* make a copy of the index tuple (XXX do we still need to copy?)
*
* HashItemData used to have more fields than IndexTupleData, but no
* longer...
*/
tuplen
=
IndexTupleSize
(
itup
);
nbytes_hitem
=
tuplen
+
(
sizeof
(
HashItemData
)
-
sizeof
(
IndexTupleData
));
hitem
=
(
HashItem
)
palloc
(
nbytes_hitem
);
memcpy
(
&
(
hitem
->
hash_itup
),
itup
,
tuplen
);
return
hitem
;
}
/*
/*
* _hash_datum2hashkey -- given a Datum, call the index's hash procedure
* _hash_datum2hashkey -- given a Datum, call the index's hash procedure
*/
*/
...
...
src/include/access/hash.h
View file @
5997386a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.6
4 2005/11/06 19:29:0
1 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.6
5 2006/01/25 23:26:1
1 tgl Exp $
*
*
* NOTES
* NOTES
* modeled after Margo Seltzer's hash implementation for unix.
* modeled after Margo Seltzer's hash implementation for unix.
...
@@ -158,13 +158,6 @@ typedef struct HashMetaPageData
...
@@ -158,13 +158,6 @@ typedef struct HashMetaPageData
typedef
HashMetaPageData
*
HashMetaPage
;
typedef
HashMetaPageData
*
HashMetaPage
;
typedef
struct
HashItemData
{
IndexTupleData
hash_itup
;
}
HashItemData
;
typedef
HashItemData
*
HashItem
;
/*
/*
* Maximum size of a hash index item (it's okay to have only one per page)
* Maximum size of a hash index item (it's okay to have only one per page)
*/
*/
...
@@ -267,7 +260,7 @@ extern Datum hash_any(register const unsigned char *k, register int keylen);
...
@@ -267,7 +260,7 @@ extern Datum hash_any(register const unsigned char *k, register int keylen);
/* private routines */
/* private routines */
/* hashinsert.c */
/* hashinsert.c */
extern
void
_hash_doinsert
(
Relation
rel
,
HashItem
hitem
);
extern
void
_hash_doinsert
(
Relation
rel
,
IndexTuple
itup
);
/* hashovfl.c */
/* hashovfl.c */
extern
Buffer
_hash_addovflpage
(
Relation
rel
,
Buffer
metabuf
,
Buffer
buf
);
extern
Buffer
_hash_addovflpage
(
Relation
rel
,
Buffer
metabuf
,
Buffer
buf
);
...
@@ -305,7 +298,6 @@ extern bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
...
@@ -305,7 +298,6 @@ extern bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
/* hashutil.c */
/* hashutil.c */
extern
bool
_hash_checkqual
(
IndexScanDesc
scan
,
IndexTuple
itup
);
extern
bool
_hash_checkqual
(
IndexScanDesc
scan
,
IndexTuple
itup
);
extern
HashItem
_hash_formitem
(
IndexTuple
itup
);
extern
uint32
_hash_datum2hashkey
(
Relation
rel
,
Datum
key
);
extern
uint32
_hash_datum2hashkey
(
Relation
rel
,
Datum
key
);
extern
Bucket
_hash_hashkey2bucket
(
uint32
hashkey
,
uint32
maxbucket
,
extern
Bucket
_hash_hashkey2bucket
(
uint32
hashkey
,
uint32
maxbucket
,
uint32
highmask
,
uint32
lowmask
);
uint32
highmask
,
uint32
lowmask
);
...
...
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