Skip to content
Snippets Groups Projects
  1. Dec 22, 2014
  2. May 06, 2014
    • Bruce Momjian's avatar
      pgindent run for 9.4 · 0a783200
      Bruce Momjian authored
      This includes removing tabs after periods in C comments, which was
      applied to back branches, so this change should not effect backpatching.
      0a783200
  3. Jan 07, 2014
  4. May 29, 2013
  5. Mar 22, 2013
    • Simon Riggs's avatar
      Allow I/O reliability checks using 16-bit checksums · 96ef3b8f
      Simon Riggs authored
      Checksums are set immediately prior to flush out of shared buffers
      and checked when pages are read in again. Hint bit setting will
      require full page write when block is dirtied, which causes various
      infrastructure changes. Extensive comments, docs and README.
      
      WARNING message thrown if checksum fails on non-all zeroes page;
      ERROR thrown but can be disabled with ignore_checksum_failure = on.
      
      Feature enabled by an initdb option, since transition from option off
      to option on is long and complex and has not yet been implemented.
      Default is not to use checksums.
      
      Checksum used is WAL CRC-32 truncated to 16-bits.
      
      Simon Riggs, Jeff Davis, Greg Smith
      Wide input and assistance from many community members. Thank you.
      96ef3b8f
  6. Jan 17, 2013
    • Heikki Linnakangas's avatar
      Make GiST indexes on-disk compatible with 9.2 again. · 9ee4d06f
      Heikki Linnakangas authored
      The patch that turned XLogRecPtr into a uint64 inadvertently changed the
      on-disk format of GiST indexes, because the NSN field in the GiST page
      opaque is an XLogRecPtr. That breaks pg_upgrade. Revert the format of that
      field back to the two-field struct that XLogRecPtr was before. This is the
      same we did to LSNs in the page header to avoid changing on-disk format.
      
      Bump catversion, as this invalidates any existing GiST indexes built on
      9.3devel.
      9ee4d06f
  7. Jan 01, 2013
  8. Dec 28, 2012
    • Alvaro Herrera's avatar
      Remove obsolete XLogRecPtr macros · 5ab3af46
      Alvaro Herrera authored
      This gets rid of XLByteLT, XLByteLE, XLByteEQ and XLByteAdvance.
      These were useful for brevity when XLogRecPtrs were split in
      xlogid/xrecoff; but now that they are simple uint64's, they are just
      clutter.  The only downside to making this change would be ease of
      backporting patches, but that has been negated by other substantive
      changes to the involved code anyway.  The clarity of simpler expressions
      makes the change worthwhile.
      
      Most of the changes are mechanical, but in a couple of places, the patch
      author chose to invert the operator sense, making the code flow more
      logical (and more in line with preceding comments).
      
      Author: Andres Freund
      Eyeballed by Dimitri Fontaine and Alvaro Herrera
      5ab3af46
  9. Jul 16, 2012
    • Peter Eisentraut's avatar
      Remove unreachable code · dd16f948
      Peter Eisentraut authored
      The Solaris Studio compiler warns about these instances, unlike more
      mainstream compilers such as gcc.  But manual inspection showed that
      the code is clearly not reachable, and we hope no worthy compiler will
      complain about removing this code.
      dd16f948
  10. May 02, 2012
  11. Jan 02, 2012
  12. 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
  13. Sep 01, 2011
  14. Jul 04, 2011
  15. May 19, 2011
  16. Apr 13, 2011
    • Tom Lane's avatar
      Pass collations to functions in FunctionCallInfoData, not FmgrInfo. · d64713df
      Tom Lane authored
      Since collation is effectively an argument, not a property of the function,
      FmgrInfo is really the wrong place for it; and this becomes critical in
      cases where a cached FmgrInfo is used for varying purposes that might need
      different collation settings.  Fix by passing it in FunctionCallInfoData
      instead.  In particular this allows a clean fix for bug #5970 (record_cmp
      not working).  This requires touching a bit more code than the original
      method, but nobody ever thought that collations would not be an invasive
      patch...
      d64713df
  17. Apr 10, 2011
  18. Jan 01, 2011
  19. Dec 23, 2010
    • Heikki Linnakangas's avatar
      Rewrite the GiST insertion logic so that we don't need the post-recovery · 9de3aa65
      Heikki Linnakangas authored
      cleanup stage to finish incomplete inserts or splits anymore. There was two
      reasons for the cleanup step:
      
      1. When a new tuple was inserted to a leaf page, the downlink in the parent
      needed to be updated to contain (ie. to be consistent with) the new key.
      Updating the parent in turn might require recursively updating the parent of
      the parent. We now handle that by updating the parent while traversing down
      the tree, so that when we insert the leaf tuple, all the parents are already
      consistent with the new key, and the tree is consistent at every step.
      
      2. When a page is split, we need to insert the downlink for the new right
      page(s), and update the downlink for the original page to not include keys
      that moved to the right page(s). We now handle that by setting a new flag,
      F_FOLLOW_RIGHT, on the non-rightmost pages in the split. When that flag is
      set, scans always follow the rightlink, regardless of the NSN mechanism used
      to detect concurrent page splits. That way the tree is consistent right after
      split, even though the downlink is still missing. This is very similar to the
      way B-tree splits are handled. When the downlink is inserted in the parent,
      the flag is cleared. To keep the insertion algorithm simple, when an
      insertion sees an incomplete split, indicated by the F_FOLLOW_RIGHT flag, it
      finishes the split before doing anything else.
      
      These changes allow removing the whole "invalid tuple" mechanism, but I
      retained the scan code to still follow invalid tuples correctly. While we
      don't create any such tuples anymore, we want to handle them gracefully in
      case you pg_upgrade a GiST index that has them. If we encounter any on an
      insert, though, we just throw an error saying that you need to REINDEX.
      
      The issue that got me into doing this is that if you did a checkpoint while
      an insert or split was in progress, and the checkpoint finishes quickly so
      that there is no WAL record related to the insert between RedoRecPtr and the
      checkpoint record, recovery from that checkpoint would not know to finish
      the incomplete insert. IOW, we have the same issue we solved with the
      rm_safe_restartpoint mechanism during normal operation too. It's highly
      unlikely to happen in practice, and this fix is far too large to backpatch,
      so we're just going to live with in previous versions, but this refactoring
      fixes it going forward.
      
      With this patch, you don't get the annoying
      'index "FOO" needs VACUUM or REINDEX to finish crash recovery' notices
      anymore if you crash at an unfortunate moment.
      9de3aa65
  20. Dec 04, 2010
    • Tom Lane's avatar
      Fix two small bugs in new gistget.c logic. · d1f5a92e
      Tom Lane authored
      1. Complain, rather than silently doing nothing, if an "invalid" tuple
      is found on a leaf page.  Per off-list discussion with Heikki.
      
      2. Fix oversight in code that removes a GISTSearchItem from the search
      queue: we have to reset lastHeap if this was the last heap item in the
      parent GISTSearchTreeItem.  Otherwise subsequent additions will do the
      wrong thing.  This was probably masked in early testing because in typical
      cases the parent item would now be completely empty and would be deleted on
      next call.  You'd need a queued non-leaf page at exactly the same distance
      as a heap tuple to expose the bug.
      d1f5a92e
    • Tom Lane's avatar
      Put back gistgettuple's check for backwards scan request. · 04910a3a
      Tom Lane authored
      On reflection it's a bad idea for the KNNGIST patch to have removed that.
      We don't want it silently returning incorrect answers.
      04910a3a
    • Tom Lane's avatar
      KNNGIST, otherwise known as order-by-operator support for GIST. · 55450687
      Tom Lane authored
      This commit represents a rather heavily editorialized version of
      Teodor's builtin_knngist_itself-0.8.2 and builtin_knngist_proc-0.8.1
      patches.  I redid the opclass API to add a separate Distance method
      instead of turning the Consistent method into an illogical mess,
      fixed some bit-rot in the rbtree interfaces, and generally worked over
      the code style and comments.
      
      There's still no non-code documentation to speak of, but I'll work on
      that separately.  Some contrib-module changes are also yet to come
      (right now, point <-> point is the only KNN-ified operator).
      
      Teodor Sigaev and Tom Lane
      55450687
  21. Sep 20, 2010
  22. Feb 26, 2010
  23. Jan 02, 2010
  24. Jan 01, 2010
    • Tom Lane's avatar
      Support "x IS NOT NULL" clauses as indexscan conditions. This turns out · 29c4ad98
      Tom Lane authored
      to be just a minor extension of the previous patch that made "x IS NULL"
      indexable, because we can treat the IS NOT NULL condition as if it were
      "x < NULL" or "x > NULL" (depending on the index's NULLS FIRST/LAST option),
      just like IS NULL is treated like "x = NULL".  Aside from any possible
      usefulness in its own right, this is an important improvement for
      index-optimized MAX/MIN aggregates: it is now reliably possible to get
      a column's min or max value cheaply, even when there are a lot of nulls
      cluttering the interesting end of the index.
      29c4ad98
  25. Oct 09, 2009
    • Tom Lane's avatar
      Remove very ancient tuple-counting infrastructure (IncrRetrieved() and · c970292a
      Tom Lane authored
      friends).  This code has all been ifdef'd out for many years, and doesn't
      seem to have any prospect of becoming any more useful in the future.
      EXPLAIN ANALYZE is what people use in practice, and I think if we did want
      process-wide counters we'd be more likely to put in dtrace events for that
      than try to resurrect this code.  Get rid of it so as to have one less detail
      to worry about while refactoring execMain.c.
      c970292a
  26. Jun 11, 2009
  27. Jan 01, 2009
  28. Oct 22, 2008
  29. Oct 20, 2008
  30. Oct 17, 2008
    • Teodor Sigaev's avatar
      During repeated rescan of GiST index it's possible that scan key · beeb3562
      Teodor Sigaev authored
      is NULL but SK_SEARCHNULL is not set. Add checking IS NULL of keys
      to set during key initialization. If key is NULL and SK_SEARCHNULL is not
      set then nothnig can be satisfied.
      With assert-enabled compilation that causes coredump.
      
      Bug was introduced in 8.3 by support of IS NULL index scan.
      beeb3562
  31. Aug 23, 2008
  32. Jun 19, 2008
  33. May 12, 2008
    • Alvaro Herrera's avatar
      Restructure some header files a bit, in particular heapam.h, by removing some · f8c4d7db
      Alvaro Herrera authored
      unnecessary #include lines in it.  Also, move some tuple routine prototypes and
      macros to htup.h, which allows removal of heapam.h inclusion from some .c
      files.
      
      For this to work, a new header file access/sysattr.h needed to be created,
      initially containing attribute numbers of system columns, for pg_dump usage.
      
      While at it, make contrib ltree, intarray and hstore header files more
      consistent with our header style.
      f8c4d7db
  34. Apr 14, 2008
    • Tom Lane's avatar
      Push index operator lossiness determination down to GIST/GIN opclass · 9b5c8d45
      Tom Lane authored
      "consistent" functions, and remove pg_amop.opreqcheck, as per recent
      discussion.  The main immediate benefit of this is that we no longer need
      8.3's ugly hack of requiring @@@ rather than @@ to test weight-using tsquery
      searches on GIN indexes.  In future it should be possible to optimize some
      other queries better than is done now, by detecting at runtime whether the
      index match is exact or not.
      
      Tom Lane, after an idea of Heikki's, and with some help from Teodor.
      9b5c8d45
  35. Apr 13, 2008
    • Tom Lane's avatar
      Phase 2 of project to make index operator lossiness be determined at runtime · 24558da1
      Tom Lane authored
      instead of plan time.  Extend the amgettuple API so that the index AM returns
      a boolean indicating whether the indexquals need to be rechecked, and make
      that rechecking happen in nodeIndexscan.c (currently the only place where
      it's expected to be needed; other callers of index_getnext are just erroring
      out for now).  For the moment, GIN and GIST have stub logic that just always
      sets the recheck flag to TRUE --- I'm hoping to get Teodor to handle pushing
      that control down to the opclass consistent() functions.  The planner no
      longer pays any attention to amopreqcheck, and that catalog column will go
      away in due course.
      24558da1
  36. Apr 11, 2008
    • Tom Lane's avatar
      Replace "amgetmulti" AM functions with "amgetbitmap", in which the whole · 4e82a954
      Tom Lane authored
      indexscan always occurs in one call, and the results are returned in a
      TIDBitmap instead of a limited-size array of TIDs.  This should improve
      speed a little by reducing AM entry/exit overhead, and it is necessary
      infrastructure if we are ever to support bitmap indexes.
      
      In an only slightly related change, add support for TIDBitmaps to preserve
      (somewhat lossily) the knowledge that particular TIDs reported by an index
      need to have their quals rechecked when the heap is visited.  This facility
      is not really used yet; we'll need to extend the forced-recheck feature to
      plain indexscans before it's useful, and that hasn't been coded yet.
      The intent is to use it to clean up 8.3's horrid @@@ kluge for text search
      with weighted queries.  There might be other uses in future, but that one
      alone is sufficient reason.
      
      Heikki Linnakangas, with some adjustments by me.
      4e82a954
  37. Jan 01, 2008
Loading