postgresql/src/include/catalog
Alvaro Herrera 94a8b45feb Fix BRIN to use SnapshotAny during summarization
For correctness of summarization results, it is critical that the
snapshot used during the summarization scan is able to see all tuples
that are live to all transactions -- including tuples inserted or
deleted by in-progress transactions.  Otherwise, it would be possible
for a transaction to insert a tuple, then idle for a long time while a
concurrent transaction executes summarization of the range: this would
result in the inserted value not being considered in the summary.
Previously we were trying to use a MVCC snapshot in conjunction with
adding a "placeholder" tuple in the index: the snapshot would see all
committed tuples, and the placeholder tuple would catch insertions by
any new inserters.  The hole is that prior insertions by transactions
that are still in progress by the time the MVCC snapshot was taken were
ignored.

Kevin Grittner reported this as a bogus error message during vacuum with
default transaction isolation mode set to repeatable read (because the
error report mentioned a function name not being invoked during), but
the problem is larger than that.

To fix, tweak IndexBuildHeapRangeScan to have a new mode that behaves
the way we need using SnapshotAny visibility rules.  This change
simplifies the BRIN code a bit, mainly by removing large comments that
were mistaken.  Instead, rely on the SnapshotAny semantics to provide
what it needs.  (The business about a placeholder tuple needs to remain:
that covers the case that a transaction inserts a a tuple in a page that
summarization already scanned.)

Discussion: https://www.postgresql.org/message-id/20150731175700.GX2441@postgresql.org

In passing, remove a couple of unused declarations from brin.h and
reword a comment to be proper English.  This part submitted by Kevin
Grittner.

Backpatch to 9.5, where BRIN was introduced.
2015-08-05 16:20:50 -03:00
..
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
binary_upgrade.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
catversion.h Plug RLS related information leak in pg_stats view. 2015-07-28 13:21:37 -07:00
dependency.h Create a pg_shdepend entry for each role in TO clause of policies. 2015-07-28 16:01:56 -07:00
duplicate_oids pgindent run for 9.4 2014-05-06 12:12:18 -04:00
genbki.h Allow forcing nullness of columns during bootstrap. 2015-02-21 22:31:54 +01:00
heap.h Return ObjectAddress in many ALTER TABLE sub-routines 2015-03-25 17:17:56 -03:00
index.h Fix BRIN to use SnapshotAny during summarization 2015-08-05 16:20:50 -03:00
indexing.h Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
namespace.h Create an infrastructure for parallel computation in PostgreSQL. 2015-04-30 15:02:14 -04:00
objectaccess.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
objectaddress.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
opfam_internal.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_aggregate.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_am.h Add BRIN infrastructure for "inclusion" opclasses 2015-05-15 18:05:22 -03:00
pg_amop.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_amproc.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_attrdef.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_attribute.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_auth_members.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_authid.h Remove rolcatupdate 2015-03-06 23:42:38 -05:00
pg_cast.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_class.h Fix typo in comment. 2015-06-10 15:26:02 +09:00
pg_collation.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_collation_fn.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_constraint.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_control.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_conversion.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_conversion_fn.h Change many routines to return ObjectAddress rather than OID 2015-03-03 14:10:50 -03:00
pg_database.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_db_role_setting.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_default_acl.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_depend.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_description.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_enum.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_event_trigger.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_extension.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_foreign_data_wrapper.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_foreign_server.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_foreign_table.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_index.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_inherits.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_inherits_fn.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_language.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_largeobject.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_largeobject_metadata.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_namespace.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_opclass.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_operator.h Rename jsonb - text[] operator to #- to avoid ambiguity. 2015-06-11 10:06:58 -04:00
pg_opfamily.h Add BRIN infrastructure for "inclusion" opclasses 2015-05-15 18:05:22 -03:00
pg_pltemplate.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_policy.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_proc.h Fix volatility marking of commit timestamp functions 2015-07-30 15:19:49 -03:00
pg_proc_fn.h Add transforms feature 2015-04-26 10:33:14 -04:00
pg_range.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_replication_origin.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_rewrite.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_seclabel.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_shdepend.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_shdescription.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_shseclabel.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_statistic.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_tablespace.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_transform.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_trigger.h pgindent run for 9.5 2015-05-23 21:35:49 -04:00
pg_ts_config.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_ts_config_map.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_ts_dict.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_ts_parser.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_ts_template.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
pg_type.h Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
pg_type_fn.h Change many routines to return ObjectAddress rather than OID 2015-03-03 14:10:50 -03:00
pg_user_mapping.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
storage.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
storage_xlog.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
toasting.h Add TOAST table to pg_shseclabel for long label use 2015-03-21 22:14:49 -04:00
unused_oids Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00