Skip to content

Commit

Permalink
Update code of mgist and mspgist to PG 17.0 (#21)
Browse files Browse the repository at this point in the history
* Update mgist and mspgist code to pg17

* Update github action to PG17

* Update readme files
  • Loading branch information
mschoema authored Nov 8, 2024
1 parent 39926f7 commit d49e4de
Show file tree
Hide file tree
Showing 22 changed files with 103 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mest-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg: [16]
pg: [17]
name: PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For more information about each extension, please refer to their associated READ

Dependencies
------------
- [PostgreSQL 16](https://www.postgresql.org/)
- [PostgreSQL 17](https://www.postgresql.org/)

Installation
------------
Expand Down
10 changes: 5 additions & 5 deletions contrib/mobilitydb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ This directory contains an implementation of Multi-Entry Search Trees for Mobili

Dependencies
------------
- [PostgreSQL 16](https://www.postgresql.org/)
- [MobilityDB 1.1 (latest version of the master branch)](https://github.com/MobilityDB/MobilityDB)
- [MEOS (latest version of the master branch of MobilityDB)](https://www.libmeos.org/)
- [PostgreSQL 17](https://www.postgresql.org/)
- [MobilityDB 1.2](https://github.com/MobilityDB/MobilityDB)
- [MEOS 1.2](https://www.libmeos.org/)
- [mest](https://github.com/MobilityDB/mest)

You should also set the following in postgresql.conf depending on the version of PostGIS and MobilityDB you have installed (below we use PostGIS 3, MobilityDB 1.1):
You should also set the following in postgresql.conf depending on the version of PostGIS and MobilityDB you have installed (below we use PostGIS 3, MobilityDB 1.2):

```
shared_preload_libraries = 'postgis-3,libMobilityDB-1.1'
shared_preload_libraries = 'postgis-3,libMobilityDB-1.2'
```

Installation
Expand Down
2 changes: 1 addition & 1 deletion contrib/postgis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ However, the PostGIS support functions are not yet implemented for MGiST indexes

Dependencies
------------
- [PostgreSQL 16](https://www.postgresql.org/)
- [PostgreSQL 17](https://www.postgresql.org/)
- [PostGIS 3.4](https://postgis.net/)
- [mgist](../mgist)

Expand Down
19 changes: 10 additions & 9 deletions src/mgist/mgist.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "nodes/execnodes.h"
#include "storage/lmgr.h"
#include "storage/predicate.h"
#include "utils/builtins.h"
#include "utils/fmgrprotos.h"
#include "utils/index_selfuncs.h"
#include "utils/memutils.h"
#include "utils/rel.h"
Expand All @@ -48,7 +47,7 @@ static void gistprunepage(Relation rel, Page page, Buffer buffer,


#define ROTATEDIST(d) do { \
SplitedPageLayout *tmp=(SplitedPageLayout*)palloc0(sizeof(SplitedPageLayout)); \
SplitPageLayout *tmp=(SplitPageLayout*)palloc0(sizeof(SplitPageLayout)); \
tmp->block.blkno = InvalidBlockNumber; \
tmp->buffer = InvalidBuffer; \
tmp->next = (d); \
Expand Down Expand Up @@ -81,6 +80,7 @@ mgisthandler(PG_FUNCTION_ARGS)
amroutine->amclusterable = true;
amroutine->ampredlocks = true;
amroutine->amcanparallel = false;
amroutine->amcanbuildparallel = false;
amroutine->amcaninclude = true;
amroutine->amusemaintenanceworkmem = false;
amroutine->amsummarizing = false;
Expand All @@ -91,6 +91,7 @@ mgisthandler(PG_FUNCTION_ARGS)
amroutine->ambuild = mgistbuild;
amroutine->ambuildempty = gistbuildempty;
amroutine->aminsert = mgistinsert;
amroutine->aminsertcleanup = NULL;
amroutine->ambulkdelete = gistbulkdelete;
amroutine->amvacuumcleanup = gistvacuumcleanup;
amroutine->amcanreturn = gistcanreturn;
Expand Down Expand Up @@ -290,11 +291,11 @@ mgistplacetopage(Relation rel, Size freespace, MGISTSTATE *mgiststate,
/* no space for insertion */
IndexTuple *itvec;
int tlen;
SplitedPageLayout *dist = NULL,
SplitPageLayout *dist = NULL,
*ptr;
BlockNumber oldrlink = InvalidBlockNumber;
GistNSN oldnsn = 0;
SplitedPageLayout rootpg;
SplitPageLayout rootpg;
bool is_rootsplit;
int npage;

Expand Down Expand Up @@ -1087,7 +1088,7 @@ gistFindCorrectParent(Relation r, GISTInsertStack *child, bool is_build)
{
/*
* End of chain and still didn't find parent. It's a very-very
* rare situation when root splitted.
* rare situation when root was split.
*/
break;
}
Expand Down Expand Up @@ -1442,7 +1443,7 @@ mgistfinishsplit(GISTInsertState *state, GISTInsertStack *stack,
* used for XLOG and real writes buffers. Function is recursive, ie
* it will split page until keys will fit in every page.
*/
SplitedPageLayout *
SplitPageLayout *
mgistSplit(Relation r,
Page page,
IndexTuple *itup, /* contains compressed entry */
Expand All @@ -1453,7 +1454,7 @@ mgistSplit(Relation r,
*rvectup;
GistSplitVector v;
int i;
SplitedPageLayout *res = NULL;
SplitPageLayout *res = NULL;

/* this should never recurse very deeply, but better safe than sorry */
check_stack_depth();
Expand Down Expand Up @@ -1503,7 +1504,7 @@ mgistSplit(Relation r,

if (!gistfitpage(lvectup, v.splitVector.spl_nleft))
{
SplitedPageLayout *resptr,
SplitPageLayout *resptr,
*subres;

resptr = subres = mgistSplit(r, page, lvectup, v.splitVector.spl_nleft, mgiststate);
Expand Down
6 changes: 3 additions & 3 deletions src/mgist/mgist.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ extern bool mgistplacetopage(Relation rel, Size freespace, MGISTSTATE *mgiststat
Relation heapRel,
bool is_build);

extern SplitedPageLayout *mgistSplit(Relation r, Page page, IndexTuple *itup,
extern SplitPageLayout *mgistSplit(Relation r, Page page, IndexTuple *itup,
int len, MGISTSTATE *mgiststate);

/* mgistget.c */
Expand All @@ -188,9 +188,9 @@ extern IndexTuple mgistgetadjusted(Relation r,
IndexTuple addtup,
MGISTSTATE *mgiststate);
extern IndexTuple mgistFormTuple(MGISTSTATE *mgiststate,
Relation r, Datum *attdata, bool *isnull, bool isleaf);
Relation r, const Datum *attdata, bool *isnull, bool isleaf);
extern void mgistCompressValues(MGISTSTATE *mgiststate, Relation r,
Datum *attdata, bool *isnull, bool isleaf, Datum *compatt);
const Datum *attdata, bool *isnull, bool isleaf, Datum *compatt);
extern OffsetNumber mgistchoose(Relation r, Page p,
IndexTuple it,
MGISTSTATE *mgiststate);
Expand Down
Loading

0 comments on commit d49e4de

Please sign in to comment.