Revues de code

Correctifs appliqués

Heikki Linnakangas a poussé :

  • Update comments that became out-of-date with the PGXACT struct. When the "hot" members of PGPROC were split off to separate PGXACT structs, many PGPROC fields referred to in comments were moved to PGXACT, but the comments were neglected in the commit. Mostly this is just a search/replace of PGPROC with PGXACT, but the way the dummy PGPROC entries are created for prepared transactions changed more, making some of the comments totally bogus. Noah Misch
  • Remove unnecessary pg_verifymbstr() calls from tsvector/query in functions. The input should've been validated well before it hits the input function. Doing so again is a waste of cycles.
  • Fix bug in to_tsquery(). We were using memcpy() to copy to a possibly overlapping memory region, which is a no-no. Use memmove() instead.
  • Fix bug in freespace calculation in heap_multi_insert(). If the amount of freespace on page was less than the amount reserved by fillfactor, the calculation would underflow. This fixes bug #6643 reported by Tomonari Katsumata.
  • Fix bug in gistRelocateBuildBuffersOnSplit(). 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.

Tom Lane a poussé :

  • Force pgwin32_recv into nonblock mode when called from pgstat.c. This should get rid of the usage of pgwin32_waitforsinglesocket entirely, and perhaps thereby remove the race condition that's evidently still present on some versions of Windows. The previous arrangement was a bit unsafe anyway, since waiting at the recv() would not allow pgstat to notice postmaster death.
  • For testing purposes, reinsert a timeout in pgstat.c's wait call. Test results from buildfarm members mastodon/narwhal (Windows Server 2003) make it look like that platform just plain loses FD_READ events occasionally, and the only reason our previous coding seemed to work was that it timed out every couple of seconds and retried the whole operation. Try to verify this by reinserting a finite timeout into the pgstat loop. This isn't meant to be a permanent patch either, just to confirm or disprove a theory.
  • Assert that WaitLatchOrSocket callers cannot wait only for writability. Since we have chosen to report socket EOF and error conditions via the WL_SOCKET_READABLE flag bit, it's unsafe to wait only for WL_SOCKET_WRITEABLE; the caller would never be notified of the socket condition, and in some of these implementations WaitLatchOrSocket would busy-wait until something else happens. Add this restriction to the API specification, and add Asserts to check that callers don't try to do that. At some point we might want to consider adjusting the API to relax this restriction, but until we have an actual use case for waiting on a write-only socket, it seems premature to design a solution.
  • Put back AC_REQUIRE([AC_STRUCT_TM]). The BSD-ish members of the buildfarm all seem to think removing this was a bad idea. It looks to me like it resulted in omitting the system header inclusion necessary to detect the fields of struct tm correctly.
  • Revert "Add some temporary instrumentation to pgstat.c." This reverts commit 7d88bb73f755f7fb5d847ef2319c21076054fb0e. That instrumentation has served its purpose.
  • In pgstat.c, use a timeout in WaitLatchOrSocket only on Windows. We have no need for a timeout here really, but some broken products from Redmond seem to lose FD_READ events occasionally, and waking up and retrying the recv() is the only known way to work around that. Perhaps somebody will be motivated to figure out a better answer here; but not I.
  • Improve error message for ALTER COLUMN TYPE coercion failure. Per recent discussion, the error message for this was actually a trifle inaccurate, since it said "cannot be cast" which might be incorrect. Adjust that wording, and add a HINT suggesting that a USING clause might be needed.

Peter Eisentraut a poussé :

Michael Meskes a poussé :

Correctifs rejetés (à ce jour)

  • Pas de déception cette semaine :-)

Correctifs en attente

  • Gilles Darold sent in another revision of the patch to add pg_is_in_backup() and pg_backup_start_time().
  • Fujii Masao sent in a patch which moves the existing calls of WalSndWakeup() out of a critical section and adds new call of WalSndWakeup() to XLogBackgroundFlush().
  • Alexander Shulgin sent in another revision of the patch to make libpq understand an RFC compliant URI connection string for PostgreSQL.
  • Kyotaro HORIGUCHI sent in a patch to fix an infelicity in checkpointer.
  • Stephen Frost sent in another revision of a patch to speed up some operations by pre-allocating ListCells.
  • Robert Haas sent in a patch which provides some rough instrumentation for determining where palloc calls are coming from.
  • Peter Eisentraut sent in a patch to add an aclcheck_error_type() function.