Skip to content
Snippets Groups Projects
  1. Jan 01, 2013
  2. Aug 16, 2012
    • Heikki Linnakangas's avatar
      Fix GiST buffering build bug, which caused "failed to re-find parent" errors. · 89911b3a
      Heikki Linnakangas authored
      We use a hash table to track the parents of inner pages, but when inserting
      to a leaf page, the caller of gistbufferinginserttuples() must pass a
      correct block number of the leaf's parent page. Before gistProcessItup()
      descends to a child page, it checks if the downlink needs to be adjusted to
      accommodate the new tuple, and updates the downlink if necessary. However,
      updating the downlink might require splitting the page, which might move the
      downlink to a page to the right. gistProcessItup() doesn't realize that, so
      when it descends to the leaf page, it might pass an out-of-date parent block
      number as a result. Fix that by returning the block a tuple was inserted to
      from gistbufferinginserttuples().
      
      This fixes the bug reported by Zdeněk Jílovec.
      89911b3a
  3. Jun 10, 2012
  4. May 30, 2012
    • Heikki Linnakangas's avatar
      Change the way parent pages are tracked during buffered GiST build. · d1996ed5
      Heikki Linnakangas authored
      We used to mimic the way a stack is constructed when descending the tree
      during normal GiST inserts, but that was quite complicated during a buffered
      build. It was also wrong: in GiST, the left-to-right relationships on
      different levels might not match each other, so that when you know the
      parent of a child page, you won't necessarily find the parent of the page to
      the right of the child page by following the rightlinks at the parent level.
      This sometimes led to "could not re-find parent" errors while building a
      GiST index.
      
      We now use a simple hash table to track the parent of every internal page.
      Whenever a page is split, and downlinks are moved from one page to another,
      we update the hash table accordingly. This is also better for performance
      than the old method, as we never need to move right to re-find the parent
      page, which could take a significant amount of time for buffers that were
      created much earlier in the index build.
      d1996ed5
    • Heikki Linnakangas's avatar
      Delete the temporary file used in buffered GiST build, after the build. · be02b168
      Heikki Linnakangas authored
      There were two bugs here: We forgot to call gistFreeBuildBuffers() function
      at the end of build, and we passed interXact == true to BufFileCreateTemp,
      so the file wasn't automatically cleaned up at end-of-transaction either.
      be02b168
  5. May 29, 2012
    • Heikki Linnakangas's avatar
      Fix integer overflow bug in GiST buffering build calculations. · 4bc6fb57
      Heikki Linnakangas authored
      The result of (maintenance_work_mem * 1024) / BLCKSZ doesn't fit in a signed
      32-bit integer, if maintenance_work_mem >= 2GB. Use double instead. And
      while we're at it, write the calculations in an easier to understand form,
      with the intermediary steps written out and commented.
      4bc6fb57
  6. Feb 24, 2012
  7. Feb 08, 2012
  8. Jan 02, 2012
  9. Oct 01, 2011
    • Tom Lane's avatar
      Support GiST index support functions that want to cache data across calls. · d22a09dc
      Tom Lane authored
      pg_trgm was already doing this unofficially, but the implementation hadn't
      been thought through very well and leaked memory.  Restructure the core
      GiST code so that it actually works, and document it.  Ordinarily this
      would have required an extra memory context creation/destruction for each
      GiST index search, but I was able to avoid that in the normal case of a
      non-rescanned search by finessing the handling of the RBTree.  It used to
      have its own context always, but now shares a context with the
      scan-lifespan data structures, unless there is more than one rescan call.
      This should make the added overhead unnoticeable in typical cases.
      d22a09dc
  10. Sep 12, 2011
    • Heikki Linnakangas's avatar
      In the final emptying phase of the new GiST buffering build, set the · 8caf6132
      Heikki Linnakangas authored
      queuedForEmptying flag correctly on buffer when adding it to the queue.
      Also, don't add buffer to the queue if it's there already. These were
      harmless oversights; failing to set the flag just means that a buffer might
      get added to the queue twice if more tuples are added to it (although that
      can't actually happen at this point because all the upper buffers have
      already been emptied), and having the same buffer twice in the emptying
      queue is harmless. But better be tidy.
      8caf6132
  11. Sep 08, 2011
Loading