1. 07 4月, 2007 1 次提交
  2. 06 4月, 2007 1 次提交
    • T
      Support varlena fields with single-byte headers and unaligned storage. · 3e23b68d
      Tom Lane 提交于
      This commit breaks any code that assumes that the mere act of forming a tuple
      (without writing it to disk) does not "toast" any fields.  While all available
      regression tests pass, I'm not totally sure that we've fixed every nook and
      cranny, especially in contrib.
      
      Greg Stark with some help from Tom Lane
      3e23b68d
  3. 03 4月, 2007 1 次提交
    • T
      Decouple the values of TOAST_TUPLE_THRESHOLD and TOAST_MAX_CHUNK_SIZE. · b3005276
      Tom Lane 提交于
      Add the latter to the values checked in pg_control, since it can't be changed
      without invalidating toast table content.  This commit in itself shouldn't
      change any behavior, but it lays some necessary groundwork for experimentation
      with these toast-control numbers.
      
      Note: while TOAST_TUPLE_THRESHOLD can now be changed without initdb, some
      thought still needs to be given to needs_toast_table() in toasting.c before
      unleashing random changes.
      b3005276
  4. 02 4月, 2007 1 次提交
  5. 29 3月, 2007 1 次提交
  6. 13 3月, 2007 1 次提交
    • T
      First phase of plan-invalidation project: create a plan cache management · b9527e98
      Tom Lane 提交于
      module and teach PREPARE and protocol-level prepared statements to use it.
      In service of this, rearrange utility-statement processing so that parse
      analysis does not assume table schemas can't change before execution for
      utility statements (necessary because we don't attempt to re-acquire locks
      for utility statements when reusing a stored plan).  This requires some
      refactoring of the ProcessUtility API, but it ends up cleaner anyway,
      for instance we can get rid of the QueryContext global.
      
      Still to do: fix up SPI and related code to use the plan cache; I'm tempted to
      try to make SQL functions use it too.  Also, there are at least some aspects
      of system state that we want to ensure remain the same during a replan as in
      the original processing; search_path certainly ought to behave that way for
      instance, and perhaps there are others.
      b9527e98
  7. 04 3月, 2007 1 次提交
  8. 28 2月, 2007 1 次提交
    • T
      Replace direct assignments to VARATT_SIZEP(x) with SET_VARSIZE(x, len). · 234a02b2
      Tom Lane 提交于
      Get rid of VARATT_SIZE and VARATT_DATA, which were simply redundant with
      VARSIZE and VARDATA, and as a consequence almost no code was using the
      longer names.  Rename the length fields of struct varlena and various
      derived structures to catch anyplace that was accessing them directly;
      and clean up various places so caught.  In itself this patch doesn't
      change any behavior at all, but it is necessary infrastructure if we hope
      to play any games with the representation of varlena headers.
      Greg Stark and Tom Lane
      234a02b2
  9. 14 2月, 2007 1 次提交
  10. 09 2月, 2007 1 次提交
    • T
      Combine cmin and cmax fields of HeapTupleHeaders into a single field, by · c3983003
      Tom Lane 提交于
      keeping private state in each backend that has inserted and deleted the same
      tuple during its current top-level transaction.  This is sufficient since
      there is no need to be able to determine the cmin/cmax from any other
      transaction.  This gets us back down to 23-byte headers, removing a penalty
      paid in 8.0 to support subtransactions.  Patch by Heikki Linnakangas, with
      minor revisions by moi, following a design hashed out awhile back on the
      pghackers list.
      c3983003
  11. 08 2月, 2007 1 次提交
    • B
      Reduce WAL activity for page splits: · b79575ce
      Bruce Momjian 提交于
      > Currently, an index split writes all the data on the split page to
      > WAL. That's a lot of WAL traffic. The tuples that are copied to the
      > right page need to be WAL logged, but the tuples that stay on the
      > original page don't.
      
      Heikki Linnakangas
      b79575ce
  12. 05 2月, 2007 2 次提交
    • T
      Rename MaxTupleSize to MaxHeapTupleSize to clarify that it's not meant to · 23c4978e
      Tom Lane 提交于
      describe the maximum size of index tuples (which is typically AM-dependent
      anyway); and consequently remove the bogus deduction for "special space"
      that was built into it.
      
      Adjust TOAST_TUPLE_THRESHOLD and TOAST_MAX_CHUNK_SIZE to avoid wasting two
      bytes per toast chunk, and to ensure that the calculation correctly tracks any
      future changes in page header size.  The computation had been inaccurate in a
      way that didn't cause any harm except space wastage, but future changes could
      have broken it more drastically.
      
      Fix the calculation of BTMaxItemSize, which was formerly computed as 1 byte
      more than it could safely be.  This didn't cause any harm in practice because
      it's only compared against maxalign'd lengths, but future changes in the size
      of page headers or btree special space could have exposed the problem.
      
      initdb forced because of change in TOAST_MAX_CHUNK_SIZE, which alters the
      storage of toast tables.
      23c4978e
    • T
      Don't MAXALIGN in the checks to decide whether a tuple is over TOAST's · a2e092e1
      Tom Lane 提交于
      threshold for tuple length.  On 4-byte-MAXALIGN machines, the toast code
      creates tuples that have t_len exactly TOAST_TUPLE_THRESHOLD ... but this
      number is not itself maxaligned, so if heap_insert maxaligns t_len before
      comparing to TOAST_TUPLE_THRESHOLD, it'll uselessly recurse back to
      tuptoaster.c, wasting cycles.  (It turns out that this does not happen on
      8-byte-MAXALIGN machines, because for them the outer MAXALIGN in the
      TOAST_MAX_CHUNK_SIZE macro reduces TOAST_MAX_CHUNK_SIZE so that toast tuples
      will be less than TOAST_TUPLE_THRESHOLD in size.  That MAXALIGN is really
      incorrect, but we can't remove it now, see below.)  There isn't any particular
      value in maxaligning before comparing to the thresholds, so just don't do
      that, which saves a small number of cycles in itself.
      
      These numbers should be rejiggered to minimize wasted space on toast-relation
      pages, but we can't do that in the back branches because changing
      TOAST_MAX_CHUNK_SIZE would force an initdb (by changing the contents of toast
      tables).  We can move the toast decision thresholds a bit, though, which is
      what this patch effectively does.
      
      Thanks to Pavan Deolasee for discovering the unintended recursion.
      
      Back-patch into 8.2, but not further, pending more testing.  (HEAD is about
      to get a further patch modifying the thresholds, so it won't help much
      for testing this form of the patch.)
      a2e092e1
  13. 31 1月, 2007 1 次提交
  14. 30 1月, 2007 1 次提交
  15. 25 1月, 2007 1 次提交
  16. 21 1月, 2007 1 次提交
  17. 10 1月, 2007 1 次提交
  18. 09 1月, 2007 1 次提交
    • T
      Support ORDER BY ... NULLS FIRST/LAST, and add ASC/DESC/NULLS FIRST/NULLS LAST · 44317582
      Tom Lane 提交于
      per-column options for btree indexes.  The planner's support for this is still
      pretty rudimentary; it does not yet know how to plan mergejoins with
      nondefault ordering options.  The documentation is pretty rudimentary, too.
      I'll work on improving that stuff later.
      
      Note incompatible change from prior behavior: ORDER BY ... USING will now be
      rejected if the operator is not a less-than or greater-than member of some
      btree opclass.  This prevents less-than-sane behavior if an operator that
      doesn't actually define a proper sort ordering is selected.
      44317582
  19. 06 1月, 2007 1 次提交
  20. 18 11月, 2006 1 次提交
    • T
      Repair two related errors in heap_lock_tuple: it was failing to recognize · 4f335a3d
      Tom Lane 提交于
      cases where we already hold the desired lock "indirectly", either via
      membership in a MultiXact or because the lock was originally taken by a
      different subtransaction of the current transaction.  These cases must be
      accounted for to avoid needless deadlocks and/or inappropriate replacement of
      an exclusive lock with a shared lock.  Per report from Clarence Gardner and
      subsequent investigation.
      4f335a3d
  21. 06 11月, 2006 1 次提交
    • T
      Fix recently-understood problems with handling of XID freezing, particularly · 48188e16
      Tom Lane 提交于
      in PITR scenarios.  We now WAL-log the replacement of old XIDs with
      FrozenTransactionId, so that such replacement is guaranteed to propagate to
      PITR slave databases.  Also, rather than relying on hint-bit updates to be
      preserved, pg_clog is not truncated until all instances of an XID are known to
      have been replaced by FrozenTransactionId.  Add new GUC variables and
      pg_autovacuum columns to allow management of the freezing policy, so that
      users can trade off the size of pg_clog against the amount of freezing work
      done.  Revise the already-existing code that forces autovacuum of tables
      approaching the wraparound point to make it more bulletproof; also, revise the
      autovacuum logic so that anti-wraparound vacuuming is done per-table rather
      than per-database.  initdb forced because of changes in pg_class, pg_database,
      and pg_autovacuum catalogs.  Heikki Linnakangas, Simon Riggs, and Tom Lane.
      48188e16
  22. 02 11月, 2006 1 次提交
    • T
      Fix "failed to re-find parent key" btree VACUUM failure by revising page · 70ce5c90
      Tom Lane 提交于
      deletion code to avoid the case where an upper-level btree page remains "half
      dead" for a significant period of time, and to block insertions into a key
      range that is in process of being re-assigned to the right sibling of the
      deleted page's parent.  This prevents the scenario reported by Ed L. wherein
      index keys could become out-of-order in the grandparent index level.
      
      Since this is a moderately invasive fix, I'm applying it only to HEAD.
      The bug exists back to 7.4, but the back branches will get a different patch.
      70ce5c90
  23. 06 10月, 2006 1 次提交
  24. 04 10月, 2006 1 次提交
  25. 11 9月, 2006 1 次提交
  26. 10 9月, 2006 1 次提交
    • T
      Rename contains/contained-by operators to @> and <@, per discussion that · ba920e1c
      Tom Lane 提交于
      agreed these symbols are less easily confused.  I made new pg_operator
      entries (with new OIDs) for the old names, so as to provide backward
      compatibility while making it pretty easy to remove the old names in
      some future release cycle.  This commit only touches the core datatypes,
      contrib will be fixed separately.
      ba920e1c
  27. 24 8月, 2006 1 次提交
  28. 22 8月, 2006 1 次提交
    • T
      Make the server track an 'XID epoch', that is, maintain higher-order bits · 35af5422
      Tom Lane 提交于
      of the transaction ID counter.  Nothing is done with the epoch except to
      store it in checkpoint records, but this provides a foundation with which
      add-on code can pretend that XIDs never wrap around.  This is a severely
      trimmed and rewritten version of the xxid patch submitted by Marko Kreen.
      Per discussion, the epoch counter seems the only part of xxid that really
      needs to be in the core server.
      35af5422
  29. 19 8月, 2006 1 次提交
  30. 18 8月, 2006 1 次提交
    • T
      Implement archive_timeout feature to force xlog file switches to occur no more · e8ea9e95
      Tom Lane 提交于
      than N seconds apart.  This allows a simple, if not very high performance,
      means of guaranteeing that a PITR archive is no more than N seconds behind
      real time.  Also make pg_current_xlog_location return the WAL Write pointer,
      add pg_current_xlog_insert_location to return the Insert pointer, and fix
      pg_xlogfile_name_offset to return its results as a two-element record instead
      of a smashed-together string, as per recent discussion.
      
      Simon Riggs
      e8ea9e95
  31. 08 8月, 2006 1 次提交
    • T
      Make recovery from WAL be restartable, by executing a checkpoint-like · e0028369
      Tom Lane 提交于
      operation every so often.  This improves the usefulness of PITR log
      shipping for hot standby: formerly, if the standby server crashed, it
      was necessary to restart it from the last base backup and replay all
      the WAL since then.  Now it will only need to reread about the same
      amount of WAL as the master server would.  The behavior might also
      come in handy during a long PITR replay sequence.  Simon Riggs,
      with some editorialization by Tom Lane.
      e0028369
  32. 06 8月, 2006 1 次提交
    • T
      Add support for forcing a switch to a new xlog file; cause such a switch · 704ddaaa
      Tom Lane 提交于
      to happen automatically during pg_stop_backup().  Add some functions for
      interrogating the current xlog insertion point and for easily extracting
      WAL filenames from the hex WAL locations displayed by pg_stop_backup
      and friends.  Simon Riggs with some editorialization by Tom Lane.
      704ddaaa
  33. 01 8月, 2006 1 次提交
    • T
      Change the relation_open protocol so that we obtain lock on a relation · 09d3670d
      Tom Lane 提交于
      (table or index) before trying to open its relcache entry.  This fixes
      race conditions in which someone else commits a change to the relation's
      catalog entries while we are in process of doing relcache load.  Problems
      of that ilk have been reported sporadically for years, but it was not
      really practical to fix until recently --- for instance, the recent
      addition of WAL-log support for in-place updates helped.
      
      Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
      concurrent update.
      09d3670d
  34. 26 7月, 2006 1 次提交
    • T
      Modify btree to delete known-dead index entries without an actual VACUUM. · e6284649
      Tom Lane 提交于
      When we are about to split an index page to do an insertion, first look
      to see if any entries marked LP_DELETE exist on the page, and if so remove
      them to try to make enough space for the desired insert.  This should reduce
      index bloat in heavily-updated tables, although of course you still need
      VACUUM eventually to clean up the heap.
      
      Junji Teramoto
      e6284649
  35. 14 7月, 2006 3 次提交
  36. 12 7月, 2006 2 次提交