1. 31 8月, 2012 2 次提交
    • T
      Improve coding of gistchoose and gistRelocateBuildBuffersOnSplit. · e5db11c5
      Tom Lane 提交于
      This is mostly cosmetic, but it does eliminate a speculative portability
      issue.  The previous coding ignored the fact that sum_grow could easily
      overflow (in fact, it could be summing multiple IEEE float infinities).
      On a platform where that didn't guarantee to produce a positive result,
      the code would misbehave.  In any case, it was less than readable.
      e5db11c5
    • R
      Fix logic bug in gistchoose and gistRelocateBuildBuffersOnSplit. · c8ba697a
      Robert Haas 提交于
      Every time the best-tuple-found-so-far changes, we need to reset all
      the penalty values in which_grow[] to the penalties for the new best
      tuple.  The old code failed to do this, resulting in inferior index
      quality.
      
      The original patch from Alexander Korotkov was just two lines; I took
      the liberty of fleshing that out by adding a bunch of comments that I
      hope will make this logic easier for others to understand than it was
      for me.
      c8ba697a
  2. 11 6月, 2012 1 次提交
  3. 30 5月, 2012 2 次提交
    • H
      Change the way parent pages are tracked during buffered GiST build. · d1996ed5
      Heikki Linnakangas 提交于
      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
    • H
      Delete the temporary file used in buffered GiST build, after the build. · be02b168
      Heikki Linnakangas 提交于
      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
  4. 19 5月, 2012 1 次提交
    • H
      Fix bug in gistRelocateBuildBuffersOnSplit(). · 1d27dcf5
      Heikki Linnakangas 提交于
      When we create a temporary copy of the old node buffer, in stack, we mustn't
      leak that into any of the long-lived data structures. Before this patch,
      when we called gistPopItupFromNodeBuffer(), it got added to the array of
      "loaded buffers". After gistRelocateBuildBuffersOnSplit() exits, the
      pointer added to the loaded buffers array points to garbage. Often that goes
      unnotied, because when we go through the array of loaded buffers to unload
      them, buffers with a NULL pageBuffer are ignored, which can often happen by
      accident even if the pointer points to garbage.
      
      This patch fixes that by marking the temporary copy in stack explicitly as
      temporary, and refrain from adding buffers marked as temporary to the array
      of loaded buffers.
      
      While we're at it, initialize nodeBuffer->pageBlocknum to InvalidBlockNumber
      and improve comments a bit. This isn't strictly necessary, but makes
      debugging easier.
      1d27dcf5
  5. 02 3月, 2012 1 次提交
    • H
      When a GiST page is split during index build, it might not have a buffer. · 2502f459
      Heikki Linnakangas 提交于
      Previously it was thought that it's impossible as the code stands, because
      insertions create buffers as tuples are cascaded downwards, and index
      split also creaters buffers eagerly for all halves. But the example from
      Jay Levitt demonstrates that it can happen, when the root page is split.
      It's in fact OK if the buffer doesn't exist, so we just need to remove the
      sanity check. In fact, we've been discussing the possibility of destroying
      empty buffers to conserve memory, which would render the sanity check
      completely useless anyway.
      
      Fix by Alexander Korotkov
      2502f459
  6. 02 1月, 2012 1 次提交
  7. 08 9月, 2011 1 次提交
    • H
      Buffering GiST index build algorithm. · 5edb24a8
      Heikki Linnakangas 提交于
      When building a GiST index that doesn't fit in cache, buffers are attached
      to some internal nodes in the index. This speeds up the build by avoiding
      random I/O that would otherwise be needed to traverse all the way down the
      tree to the find right leaf page for tuple.
      
      Alexander Korotkov
      5edb24a8