Re: pgsql: Compress GIN posting lists, for smaller index size.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: pgsql: Compress GIN posting lists, for smaller index size.
Дата
Msg-id 5405A97B.6050907@vmware.com
обсуждение исходный текст
Ответ на Re: pgsql: Compress GIN posting lists, for smaller index size.  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-committers
On 09/02/2014 02:11 PM, Andres Freund wrote:
> 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?

Yep. Fixed, thanks.

- Heikki



В списке pgsql-committers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Silence warning on new versions of clang.
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Refactor per-page logic common to all redo routines to a new fun