Thread

Commits

  1. BRIN de-summarization

  1. BRIN de-summarize ranges

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2017-02-28T04:56:43Z

    Here's a small patch to make a BRIN page range unsummarized.  This is
    useful if data has been deleted, and the heap pages are now used for
    completely different data.
    
    -- 
    Álvaro Herrera
    
  2. Re: BRIN de-summarize ranges

    Tom Lane <tgl@sss.pgh.pa.us> — 2017-02-28T13:51:24Z

    Alvaro Herrera <alvherre@2ndquadrant.com> writes:
    > Here's a small patch to make a BRIN page range unsummarized.  This is
    > useful if data has been deleted, and the heap pages are now used for
    > completely different data.
    
    This seems remarkably, um, manual.  Why shouldn't users expect the system
    to take care of this for them?
    
    			regards, tom lane
    
    
    
  3. Re: BRIN de-summarize ranges

    Simon Riggs <simon@2ndquadrant.com> — 2017-03-07T12:46:22Z

    On 28 February 2017 at 12:56, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
    
    > Here's a small patch to make a BRIN page range unsummarized.  This is
    > useful if data has been deleted, and the heap pages are now used for
    > completely different data.
    
    We currently have a manual interface for summarize new values, so it
    makes sense to include a manual interface for desummarize also. Since
    this adds desummarize_range it would make sense to expose
    summarize_range also.
    
    I'd prefer if we had a way to know when the summary is no longer
    useful and to do this automatically, but we'd need more info and
    research to work out how to do that, so we can only do it this way at
    present.
    
    Other than that the patch looks fairly straightforward, so adding a
    few tests will be all we need here.
    
    Plus function docs. I'm on the hook to write brin docs anyway, so no
    more needed here.
    
    -- 
    Simon Riggs                http://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  4. Re: BRIN de-summarize ranges

    Seki, Eiji <seki.eiji@jp.fujitsu.com> — 2017-03-22T08:25:16Z

    On 2017-02-28 04:56:43 Alvaro Herrera wrote:
    > Here's a small patch to make a BRIN page range unsummarized.  This is
    > useful if data has been deleted, and the heap pages are now used for
    > completely different data.
    
    Hi,
    
    I tried to apply your patch and use it. Applying and "make check" were successed.
    
    However, I found that when calling brin_desummarize_range successively, an assertion is failed. It seems to me that it occurs when desummarizing a revmap page that is already desummarized.
    
    The tried queries and their outputs are the followings:
    
    $ CREATE SCHEMA test_sc;
    CREATE SCHEMA
    $ CREATE TABLE test_sc.test(a int);
    CREATE TABLE
    $ INSERT INTO test_sc.test SELECT s FROM generate_series(1, 10000) s;
    INSERT 0 10000
    $ CREATE INDEX idx_brin ON test_sc.test USING brin(a);
    CREATE INDEX
    $ SELECT brin_desummarize_range('test_sc.idx_brin', 1);
     brin_desummarize_range 
    ------------------------
     
    (1 row)
    
    $ SELECT brin_desummarize_range('test_sc.idx_brin', 1);
    psql:check_brin_desum.sql:10: server closed the connection unexpectedly
            This probably means the server terminated abnormally
            before or while processing the request.
    psql:check_brin_desum.sql:10: connection to server was lost
    
    
    Then, the server log is the following:
    
    TRAP: FailedAssertion("!(!LWLockHeldByMe(((LWLock*) (&(buf)->content_lock))))", File: "bufmgr.c", Line: 1714)
    2017-03-22 15:06:12.842 JST [23107] LOG:  server process (PID 23186) was terminated by signal 6: Aborted
    2017-03-22 15:06:12.842 JST [23107] DETAIL:  Failed process was running: SELECT brin_desummarize_range('test_sc.idx_brin', 1);
    
    
    When assertion is failed, the following brinRevmapTerminate function is called. Then, it tries to release revmap->rm_currBuf by ReleaseBuffer function and it is failed.
    
    +bool
    +brinRevmapDesummarizeRange(Relation idxrel, BlockNumber heapBlk)
    +{
    ...
    +	if (!ItemPointerIsValid(iptr))
    +	{
    +		/* no index tuple: range not summarized, we're done */
    +		brinRevmapTerminate(revmap);
    +		return true;
    +	}
    
    --
    Regards,
    Eiji Seki
    Fujitsu
    
    
  5. Re: BRIN de-summarize ranges

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2017-04-01T17:42:27Z

    Seki, Eiji wrote:
    
    > However, I found that when calling brin_desummarize_range
    > successively, an assertion is failed. It seems to me that it occurs
    > when desummarizing a revmap page that is already desummarized.
    
    You're right, it's broken for that case.  Here's a fixed patch.
    
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
  6. Re: BRIN de-summarize ranges

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2017-04-01T19:16:30Z

    Alvaro Herrera wrote:
    
    > > However, I found that when calling brin_desummarize_range
    > > successively, an assertion is failed. It seems to me that it occurs
    > > when desummarizing a revmap page that is already desummarized.
    > 
    > You're right, it's broken for that case.  Here's a fixed patch.
    
    Pushed.
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services