Re: pgsql: Compress GIN posting lists, for smaller index size. - Mailing list pgsql-committers

From Andres Freund
Subject Re: pgsql: Compress GIN posting lists, for smaller index size.
Date
Msg-id 20140902111146.GA27095@awork2.anarazel.de
Whole thread Raw
In response to pgsql: Compress GIN posting lists, for smaller index size.  (Heikki Linnakangas <heikki.linnakangas@iki.fi>)
Responses Re: pgsql: Compress GIN posting lists, for smaller index size.
List pgsql-committers
Hi,
On 2014-01-22 17:28:48 +0000, Heikki Linnakangas wrote:
> Compress GIN posting lists, for smaller index size.
>
> GIN posting lists are now encoded using varbyte-encoding, which allows them
> to fit in much smaller space than the straight ItemPointer array format used
> before. The new encoding is used for both the lists stored in-line in entry
> tree items, and in posting tree leaf pages.
>
> To maintain backwards-compatibility and keep pg_upgrade working, the code
> can still read old-style pages and tuples. Posting tree leaf pages in the
> new format are flagged with GIN_COMPRESSED flag, to distinguish old and new
> format pages. Likewise, entry tree tuples in the new format have a
> GIN_ITUP_COMPRESSED flag set in a bit that was previously unused.

A new version of clang complains:

/home/andres/src/postgresql/src/backend/access/gin/ginvacuum.c:512:34: warning: signed shift result (0x80000000) sets
thesign bit of the 
      shift expression's type ('int') and becomes negative [-Wshift-sign-overflow]
                                uncompressed = (ItemPointer) GinGetPosting(itup);
                                                             ^~~~~~~~~~~~~~~~~~~
/home/andres/src/postgresql/src/include/access/gin_private.h:226:59: note: expanded from macro 'GinGetPosting'
#define GinGetPosting(itup)                     ((Pointer) ((char*)(itup) + GinGetPostingOffset(itup)))
                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/andres/src/postgresql/src/include/access/gin_private.h:224:85: note: expanded from macro 'GinGetPostingOffset'
#define GinGetPostingOffset(itup)       (GinItemPointerGetBlockNumber(&(itup)->t_tid) & (~GIN_ITUP_COMPRESSED))
                                                                                          ^~~~~~~~~~~~~~~~~~~
/home/andres/src/postgresql/src/include/access/gin_private.h:223:33: note: expanded from macro 'GIN_ITUP_COMPRESSED'
#define GIN_ITUP_COMPRESSED             (1 << 31)

As far as I understand the code it should rather be
#define GIN_ITUP_COMPRESSED             (1U << 31)

Is that right?

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-committers by date:

Previous
From: Fujii Masao
Date:
Subject: pgsql: Support ALTER SYSTEM RESET command.
Next
From: Andres Freund
Date:
Subject: pgsql: Add psql PROMPT variable showing which line of a statement is be