postgres-xl.git
9 years agofix type mismatch in slot_deform_datarow (void* vs. Datum)
Tomas Vondra [Tue, 23 Aug 2016 08:39:02 +0000 (10:39 +0200)]
fix type mismatch in slot_deform_datarow (void* vs. Datum)

The pfree() expects void*, but was getting pointer packed as a Datum.
So instead use 'val' with the Datum converted as a pointer, and also
ditch the pointless null check (we're doing memcpy from the pointer
so we'd get segfault anyway).

9 years agoinitialize saved_gxid and saved_global_gxid in GTM_RestoreTxnInfo
Tomas Vondra [Tue, 23 Aug 2016 08:26:36 +0000 (10:26 +0200)]
initialize saved_gxid and saved_global_gxid in GTM_RestoreTxnInfo

Without the control file (ctlf==NULL), the two gxid variables were
not initialized. Set them both to InvalidGlobalTransactionId.

9 years agoreduce the size of shippability API
Tomas Vondra [Mon, 22 Aug 2016 21:47:49 +0000 (23:47 +0200)]
reduce the size of shippability API

A significant part of the shippability API defined in pgxcship.h was
actually used only from within pgxcship.c, so make as many functions
static (instead of extern) as possible:

- pgxc_is_func_shippable
- pgxc_find_dist_equijoin_qual
- pgxc_merge_exec_nodes
- pgxc_query_has_distcolgrouping

This also shown that two functions are indeed unused:

- pgxc_check_index_shippability
- pgxc_check_fk_shippability

so remove them entirely.

9 years agoremove unused shippability definitions from planner.h
Tomas Vondra [Mon, 22 Aug 2016 21:38:31 +0000 (23:38 +0200)]
remove unused shippability definitions from planner.h

The ShippabilityStat type and shippability walker/test functions are not
really needed outside pgxcship.c.

9 years agoremove unused GUC options - strict_statement_checking and enforce_two_phase_commit
Tomas Vondra [Mon, 22 Aug 2016 22:05:24 +0000 (00:05 +0200)]
remove unused GUC options - strict_statement_checking and enforce_two_phase_commit

These two options were ineffective - defined and listed in the sample
configuration file, but attached to unreferenced variables.

9 years agofix transposed parameters when calling memset in gtm_utils.c
Tomas Vondra [Mon, 22 Aug 2016 22:09:37 +0000 (00:09 +0200)]
fix transposed parameters when calling memset in gtm_utils.c

The intent of the memset() call apparently was to zaro the memory,
but as the third parameter was 0 by mistake, it failed to do so.

9 years agoDraft release notes for Postgres-XL 9.5r1.3 release
Pavan Deolasee [Tue, 16 Aug 2016 05:05:07 +0000 (10:35 +0530)]
Draft release notes for Postgres-XL 9.5r1.3 release

9 years agoMake adjustments to the expected output of 'brin' test case
Pavan Deolasee [Tue, 16 Aug 2016 04:06:46 +0000 (09:36 +0530)]
Make adjustments to the expected output of 'brin' test case

9 years agoMake sure ON COMMIT actions are invoked only when transaction is still valid
Pavan Deolasee [Tue, 16 Aug 2016 04:01:29 +0000 (09:31 +0530)]
Make sure ON COMMIT actions are invoked only when transaction is still valid

Per report by Agoston David

9 years agoCorrect aggregation function for "money" data type.
Pavan Deolasee [Fri, 12 Aug 2016 09:49:46 +0000 (15:19 +0530)]
Correct aggregation function for "money" data type.

Per report by Sergio Hernández Martínez

9 years agoDisallow FOR UPDATE/SHARE for queries using SQL JOIN syntax.
Pavan Deolasee [Fri, 12 Aug 2016 09:32:29 +0000 (15:02 +0530)]
Disallow FOR UPDATE/SHARE for queries using SQL JOIN syntax.

Shaun Thomas had reported the original and our last attempt to block FOR
UPDATE/SHARE when invoked on more than one table wasn't enough. Hopefully
this takes care of all such occurances of the query. But we now allow FOR
UPDATE/SHARE if all tables involved in the query are replicated tables

9 years agoQuote default_transaction_isolation parameter while sending down to the remote
Pavan Deolasee [Thu, 11 Aug 2016 04:28:12 +0000 (09:58 +0530)]
Quote default_transaction_isolation parameter while sending down to the remote
nodes

Per report by Arun T K

9 years agoHonour WITH NO DATA clause of CREATE TABLE AS
Pavan Deolasee [Thu, 11 Aug 2016 03:45:36 +0000 (09:15 +0530)]
Honour WITH NO DATA clause of CREATE TABLE AS

9 years agoReport execution stats for each step of redistribution and also call
Pavan Deolasee [Fri, 5 Aug 2016 05:37:07 +0000 (11:07 +0530)]
Report execution stats for each step of redistribution and also call
tuplestore_end() at the end instead of just tuplestore_clear() which neither
frees up resources nor prints the stats

9 years agoEnsure that the statistics about all-visible pages in fetched from remote
Pavan Deolasee [Tue, 2 Aug 2016 03:20:38 +0000 (08:50 +0530)]
Ensure that the statistics about all-visible pages in fetched from remote
datanodes and updated at the coordinator for better planning.

We seemed to have missed fetching relallvisible all along and that can lead to
some bad planning at the coordinator. In particular, it may not use Index Only
scans where its possible. This is a long standing bug, but some other stats
collection (such as 8ca720f90f7) bug might have masked this problem until now.

Per report by Sergio Hernández Martínez, with investigation and patch by me.

9 years agoAdd test case for Issue #57
Pallavi Sontakke [Thu, 28 Jul 2016 07:59:48 +0000 (13:29 +0530)]
Add test case for Issue #57
When distribution column is changed for a table, we don't check for dependecies such as UNIQUE indexes

9 years agoAdd test case for Issue #27
Pallavi Sontakke [Thu, 28 Jul 2016 06:23:10 +0000 (11:53 +0530)]
Add test case for Issue #27
Distribution column can be dropped for MODULO distribution tables.

9 years agoAdd test case for Issue #6
Pallavi Sontakke [Thu, 28 Jul 2016 05:14:32 +0000 (10:44 +0530)]
Add test case for Issue #6
REFRESH MATERIALISED VIEW CONCURRENTLY gives error

9 years agoCorrect target release date for 9.5r1.2 release
Pavan Deolasee [Wed, 27 Jul 2016 08:11:48 +0000 (13:41 +0530)]
Correct target release date for 9.5r1.2 release

9 years agoAdd test case for Issue #74
Pallavi Sontakke [Wed, 27 Jul 2016 09:51:39 +0000 (15:21 +0530)]
Add test case for Issue #74
SQL error codes are not correctly sent back to
the client when dealing with error on COPY protocol

9 years agoAdd test case for Issue #70
Pallavi Sontakke [Wed, 27 Jul 2016 05:59:25 +0000 (11:29 +0530)]
Add test case for Issue #70
Role concurrently dropped error

9 years agoAdd test case for Issue #43
Pallavi Sontakke [Tue, 26 Jul 2016 11:34:58 +0000 (17:04 +0530)]
Add test case for Issue #43
Parallel analyze causes Unexpected response from the Datanodes

9 years agoAdd test case for Issue #13
Pallavi Sontakke [Tue, 26 Jul 2016 10:01:24 +0000 (15:31 +0530)]
Add test case for Issue #13
INSERT query with SELECT part using joins on OID fails to insert all rows correctly

9 years agoAdd test case for Issue #9
Pallavi Sontakke [Tue, 26 Jul 2016 07:02:20 +0000 (12:32 +0530)]
Add test case for Issue #9
Fails to see DDL's effect inside a function

9 years agoAdd test case for Issue #4
Pallavi Sontakke [Mon, 25 Jul 2016 11:46:41 +0000 (17:16 +0530)]
Add test case for Issue #4
Tableoid to relation name mapping broken

9 years agoExplicitly track if a subplan has been executed and a valid value is computed
Pavan Deolasee [Wed, 20 Jul 2016 10:06:14 +0000 (15:36 +0530)]
Explicitly track if a subplan has been executed and a valid value is computed
or not.

This works around a problem noted in issue #102, but not a full solution to the
problem. It seems there are places where InitPlan is attached to a node which
will be executed on the remote node. Even so coordinator tries to find push a
PARAM_EXEC parameter value for a remote subplan and fails because the value is
not and will never be computed on the coordinator. We for now send NULL value
for such cases to avoid a server crash

9 years agoCorrect stable function in test
Pallavi Sontakke [Wed, 20 Jul 2016 09:42:04 +0000 (15:12 +0530)]
Correct stable function in test

9 years agoAdd an alternate expected output file for "inherit" test case to address
Pavan Deolasee [Wed, 20 Jul 2016 07:42:14 +0000 (13:12 +0530)]
Add an alternate expected output file for "inherit" test case to address
occasional plan change

9 years agoDo not print node names in EXPLAIN output of a query in "rules" test since that
Pavan Deolasee [Wed, 20 Jul 2016 07:30:34 +0000 (13:00 +0530)]
Do not print node names in EXPLAIN output of a query in "rules" test since that
may cause non deterministic output

9 years agoWrite release notes for upcoming Postgres-XL 9.5r1.2 release
Pavan Deolasee [Wed, 20 Jul 2016 06:50:32 +0000 (12:20 +0530)]
Write release notes for upcoming Postgres-XL 9.5r1.2 release

9 years agoLoad balance remote subplan execution by choosing a node randomly instead of
Pavan Deolasee [Tue, 19 Jul 2016 12:10:20 +0000 (17:40 +0530)]
Load balance remote subplan execution by choosing a node randomly instead of
always picking up the first node.

When planner has a choice of executing a subplan on any of the remote nodes,
it always used to execute the subplan on the first node. That can cause
excessive load/number of connections on that node. This patch fixes that by
choosing a node randomly from the list of available nodes

9 years agoModify expected output of tests due to recent changes
Pallavi Sontakke [Wed, 20 Jul 2016 06:46:14 +0000 (12:16 +0530)]
Modify expected output of tests due to recent changes

9 years agoAdd test case for Issue #93
Pallavi Sontakke [Tue, 19 Jul 2016 12:00:21 +0000 (17:30 +0530)]
Add test case for Issue #93

9 years agoUse 2^32 modulo computation to convert signed integer to unsigned value since
Pavan Deolasee [Tue, 19 Jul 2016 10:51:27 +0000 (16:21 +0530)]
Use 2^32 modulo computation to convert signed integer to unsigned value since
abs() may give a different result.

This makes the redistribution code in sync with the way hash modulo is computed
elsewhere in the code

9 years agoAdd test case for Issue #91
Pallavi Sontakke [Tue, 19 Jul 2016 10:49:43 +0000 (16:19 +0530)]
Add test case for Issue #91

9 years agoAdd test case for Issue #88
Pallavi Sontakke [Tue, 19 Jul 2016 09:54:19 +0000 (15:24 +0530)]
Add test case for Issue #88

9 years agoAdd test case for Issue #87
Pallavi Sontakke [Tue, 19 Jul 2016 08:35:21 +0000 (14:05 +0530)]
Add test case for Issue #87

9 years agoAdd test case for Issue #7
Pallavi Sontakke [Tue, 19 Jul 2016 05:32:40 +0000 (11:02 +0530)]
Add test case for Issue #7

9 years agoAdd test case for Issue #5
Pallavi Sontakke [Tue, 19 Jul 2016 05:17:49 +0000 (10:47 +0530)]
Add test case for Issue #5

9 years agoAdd test case for Issue #81
Pallavi Sontakke [Fri, 15 Jul 2016 12:32:46 +0000 (18:02 +0530)]
Add test case for Issue #81

Create empty cluster and add nodes multiple times
to reproduce the issue. This issue occurs intermittently.

9 years agoAdd test case for Issue #16
Pallavi Sontakke [Fri, 15 Jul 2016 10:48:39 +0000 (16:18 +0530)]
Add test case for Issue #16

9 years agoAdd test case for SQLsmith Issue #102
Pallavi Sontakke [Fri, 15 Jul 2016 05:05:51 +0000 (10:35 +0530)]
Add test case for SQLsmith Issue #102

9 years agoDo not FQS EXECUTE DIRECT statements.
Pavan Deolasee [Tue, 12 Jul 2016 09:07:22 +0000 (14:37 +0530)]
Do not FQS EXECUTE DIRECT statements.

Executor is not prepared to handle that and its not necessary since EXECUTE
DIRECT implies direct execution on the target node anyways

9 years agoBlock FOR SHARE/UPDATE for queries involving joins
Pavan Deolasee [Tue, 12 Jul 2016 07:03:23 +0000 (12:33 +0530)]
Block FOR SHARE/UPDATE for queries involving joins

Per report from Shaun Thomas, we don't yet support row locking when query has a
join between tables. While it may sometimes give an error, worse it may
silently lock wrong rows leading to application logic failures. The feature is
currently blocked until we have bandwidth to diagnose further and come up with
a proper fix.

Also update reqression tests to include offending tests and update expected
output now that such queries throw errors

9 years agoCorrect expected behaior of test.
Pallavi Sontakke [Mon, 11 Jul 2016 09:48:14 +0000 (15:18 +0530)]
Correct expected behaior of test.

Test reproduces Issue #84 on crash recovery
and prepared transactions.

9 years agoChange several asserts checking for aggregate context to errors
Pavan Deolasee [Mon, 11 Jul 2016 08:29:50 +0000 (13:59 +0530)]
Change several asserts checking for aggregate context to errors

This should address the crash in assert-enabled build reported by Pallavi
Sontakke. SQLSmith tries to call various functions from system catalogs and
functions should be prepared to handle such calls.

9 years agoAdd a test case demonstrating an extremely slow join in XL, especially with the
Pavan Deolasee [Fri, 8 Jul 2016 05:29:53 +0000 (10:59 +0530)]
Add a test case demonstrating an extremely slow join in XL, especially with the
inner side of a join doing repeated remote subquery scans

9 years agoNever ever use an invalid XID, if we fail to connect to the GTM
Pavan Deolasee [Thu, 7 Jul 2016 11:26:20 +0000 (16:56 +0530)]
Never ever use an invalid XID, if we fail to connect to the GTM

The code before this commit would happily proceed further if GTM becomes dead
or unreachable. This may result in random problems since rest of the code is
not prepared to deal with that situation (as seen from the crash in TAP tests).
It seems far safer to just throw an error in such case.

TAP test and report by Pallavi Sontakke

9 years agoUse GTM_Sequence type to hold value of a sequence on GTM
Pavan Deolasee [Wed, 6 Jul 2016 18:14:05 +0000 (23:44 +0530)]
Use GTM_Sequence type to hold value of a sequence on GTM

We were incorrectly using "int" at couple of places which is not wide enough to
store 64-bit sequence values.

Per report by Helmi Ahmad

9 years agoReturn pointer to the buffer used to store various fields values, so that
Pavan Deolasee [Wed, 6 Jul 2016 10:21:44 +0000 (15:51 +0530)]
Return pointer to the buffer used to store various fields values, so that
caller can free up the memory when done with it.

This fixes a memory like while running ALTER TABLE DISTRIBUTE BY

9 years agoAdd a missing parenthesis, lack of which might throw surprises
Pavan Deolasee [Wed, 6 Jul 2016 10:20:21 +0000 (15:50 +0530)]
Add a missing parenthesis, lack of which might throw surprises

9 years agoDon't wait indefinitely while trying to abort a transaction on the remote node.
Pavan Deolasee [Wed, 6 Jul 2016 09:46:47 +0000 (15:16 +0530)]
Don't wait indefinitely while trying to abort a transaction on the remote node.

Treat this more as a work-around until we investigate the reasons for remote
nodes not honouring query cancellation for some complicated queries, requiring
nested remote subquery plans

9 years agoAvoid pushing down evaluation of VALUES clause to a datanode for replicated
Pavan Deolasee [Tue, 21 Jun 2016 12:56:34 +0000 (18:26 +0530)]
Avoid pushing down evaluation of VALUES clause to a datanode for replicated
tables, unless it contains volatile function(s)

9 years agoWarn about missing relations only if they are not views since views are not
Pavan Deolasee [Tue, 21 Jun 2016 08:06:49 +0000 (13:36 +0530)]
Warn about missing relations only if they are not views since views are not
created on datanodes anyways

This relates to the earlier commit

9 years agoAdd a warning when a node fails to find OID for the given relation.
Pavan Deolasee [Tue, 21 Jun 2016 05:47:23 +0000 (11:17 +0530)]
Add a warning when a node fails to find OID for the given relation.

Regression shows a bunch of warnings which should be fixed over due course

9 years agoHandle ON COMMIT properly on the datanodes by not looking at
Pavan Deolasee [Mon, 20 Jun 2016 12:10:50 +0000 (17:40 +0530)]
Handle ON COMMIT properly on the datanodes by not looking at
MyXactAccessedTempRel which is set up differently in XL

We can't rely on MyXactAccessedTempRel because it gets set only when local
buffers are used for a relation. In XL, even temp tables use shared buffers
when used in a global session. Skipping checking for this local flag won't be
too bad from performance perspective.

9 years agoAdd TAP test for crash recovery Issue #84
Pallavi Sontakke [Mon, 20 Jun 2016 11:53:31 +0000 (17:23 +0530)]
Add TAP test for crash recovery Issue #84

Test crash recovery when prepared transactions are being created in
the background. Tests #84.

9 years agoAdd test for complex-update issue #38
Pallavi Sontakke [Fri, 17 Jun 2016 09:09:21 +0000 (14:39 +0530)]
Add test for complex-update issue #38

9 years agoSeparate out INSENSITIVE cursor Issue ( #34)
Pallavi Sontakke [Thu, 16 Jun 2016 12:12:03 +0000 (17:42 +0530)]
Separate out INSENSITIVE cursor Issue ( #34)

Move issue in xl_known_bugs to track it separately.

9 years agoSeparate out LATERAL Issue #73 into xl_known_bugs
Pallavi Sontakke [Thu, 16 Jun 2016 08:53:47 +0000 (14:23 +0530)]
Separate out LATERAL Issue #73 into xl_known_bugs

9 years agoCorrect expected output for a test
Pallavi Sontakke [Wed, 15 Jun 2016 10:03:49 +0000 (15:33 +0530)]
Correct expected output for a test

Modify expected output for 'ON COMMIT DELETE ROWS' clause.

9 years agoRemove an unintentional "set -x" command slipped in the previous commit
Pavan Deolasee [Tue, 14 Jun 2016 08:38:58 +0000 (14:08 +0530)]
Remove an unintentional "set -x" command slipped in the previous commit

9 years agoEnsure "init all" (and other init commands too) does not remove existing data
Pavan Deolasee [Tue, 14 Jun 2016 06:22:13 +0000 (11:52 +0530)]
Ensure "init all" (and other init commands too) does not remove existing data
directories unless "force" option is used

We'd tried to fix this earlier, but looks like double quote is not getting
passed to the shell correctly. Instead use a single quote.

Report by Pallavi Sontakke during QA testing.

9 years agoShow originating coordinator name:pid and remote node name:pid in the ps output
Pavan Deolasee [Fri, 10 Jun 2016 13:09:05 +0000 (18:39 +0530)]
Show originating coordinator name:pid and remote node name:pid in the ps output
while running REMOTE SUBPLAN

This should help administrator to quickly find the originating session and
remote session, which can be immensely useful for debugging

9 years agoDo not reset stats on the coordinator upon create of a new index or cluster.
Pavan Deolasee [Wed, 25 May 2016 13:36:51 +0000 (19:06 +0530)]
Do not reset stats on the coordinator upon create of a new index or cluster.

The stats on the coordinator has no meaning for distributed tables unless
they are built using remote stats. Also make sure coordinator's view of
updated/deleted/inserted tuples is executed when fast query shipping is used

9 years agoLog more information about connection error for ease in debugging
Pavan Deolasee [Mon, 23 May 2016 10:05:11 +0000 (15:35 +0530)]
Log more information about connection error for ease in debugging

9 years agoRevert "It may happen that we try to read the status of a transaction"
Pavan Deolasee [Thu, 12 May 2016 08:14:27 +0000 (13:44 +0530)]
Revert "It may happen that we try to read the status of a transaction"

This reverts commit d3356cd451664f3585706f0ae817e0037814ec6e.

Other bug fixes in this area has now fixed the underlying problem and hence we
don't need this change.

9 years agoUpdate release notes for XL release r1.1
Pavan Deolasee [Thu, 12 May 2016 08:12:20 +0000 (13:42 +0530)]
Update release notes for XL release r1.1

9 years agoInitialise a variable as reported by valgrind
Pavan Deolasee [Tue, 10 May 2016 05:18:15 +0000 (10:48 +0530)]
Initialise a variable as reported by valgrind

9 years agoAdd a mechanism to selectively refresh pooler information when only connection
Pavan Deolasee [Mon, 9 May 2016 08:39:21 +0000 (14:09 +0530)]
Add a mechanism to selectively refresh pooler information when only connection
options, such as hostname/port changes for a node

This allows us to retain connections to all other nodes in the cluster and just
recreate connections to the node whose connection information is changed. This
will be especially handy while dealing with datanode/coordinator failover

9 years agoRemove some references to person names from the docs
Pavan Deolasee [Mon, 9 May 2016 05:20:32 +0000 (10:50 +0530)]
Remove some references to person names from the docs

9 years agoAvoid protocol breakage when pooler fails to open connection to one or more
Pavan Deolasee [Mon, 9 May 2016 05:11:49 +0000 (10:41 +0530)]
Avoid protocol breakage when pooler fails to open connection to one or more
nodes.

While the pooler sends both fds as well pids, the client was bailing out early
if it can't find required number of fds, thus causing protocol breakdown

Per report by Zhang Eamon

9 years agoProperly deallocate prepared statements on the remote node when user makes such
Pavan Deolasee [Sun, 8 May 2016 09:14:41 +0000 (14:44 +0530)]
Properly deallocate prepared statements on the remote node when user makes such
request

Per report by Vamshi Reddy

9 years agoFix a memory leak in GTM proxy
Pavan Deolasee [Fri, 6 May 2016 12:36:37 +0000 (18:06 +0530)]
Fix a memory leak in GTM proxy

When two lists are concatnated, we might leak header of the second list since
only the list cells are concatnated. We must be careful not to free the list if
list_concat returned the to-be-concatnated list as-is.

9 years agoHonour shared queue refcount while deciding to remove it from hash table when
Pavan Deolasee [Thu, 5 May 2016 10:02:08 +0000 (15:32 +0530)]
Honour shared queue refcount while deciding to remove it from hash table when
producer unbinds

It's possible that another execution of the portal may start just while we are
unbinding. Hence premature removal of the shared queue should be avoided.

9 years agoMake minimum values of shared_queues and shared_queue_size GUC parameters
Pavan Deolasee [Thu, 5 May 2016 09:55:39 +0000 (15:25 +0530)]
Make minimum values of shared_queues and shared_queue_size GUC parameters
dependent on other settings

shared_queue_size is dependent on the number of datanodes in the cluster since
each datanode may attach itself as a consumer of the shared queue. So the
shared_queue_size now signifies per-datanode value and the actual value used
will be (max_datanodes * shared_queue_size). Existing users should modify their
settings after taking this into consideration.

Similarly, shared_queues highly depends on the number of concurrent queries. We
now conservatively set this to at least 1/4th of max_connections or user
specified value, whichever is higher.

9 years agoAdd a ref count mechanism to deal with situations where a Shared Queue is
Pavan Deolasee [Thu, 5 May 2016 05:32:04 +0000 (11:02 +0530)]
Add a ref count mechanism to deal with situations where a Shared Queue is
acquired but never bound by any of the node, thus causing leakage

To be honest, this area requires further work. The way things are currently
setup, producer and consumers all bind to a shared queue, but only producer
eventually unbinds. The implementation has logic to wait out for consumers
before destroying a shared queue. While this is okay, a more defined entry and
exit points are required for producer and consumers.

The code also today relies on timeouts to handle the case where a consumer
never binds to a shared queue, thus causing large delays. These delays are more
prominent for very short queries.

9 years agoCorrect shared memory size calculation for Shared Queue hashtable.
Pavan Deolasee [Thu, 5 May 2016 03:48:34 +0000 (09:18 +0530)]
Correct shared memory size calculation for Shared Queue hashtable.

9 years agoExtend CLog, Subtrans log and CommitTsLog appropriately when an XID is received
Pavan Deolasee [Wed, 4 May 2016 18:36:26 +0000 (00:06 +0530)]
Extend CLog, Subtrans log and CommitTsLog appropriately when an XID is received
from a remote node

9 years agoFix a nasty bug that was zeroing out clog and subtrans pages, thus causing
Pavan Deolasee [Wed, 4 May 2016 12:17:02 +0000 (17:47 +0530)]
Fix a nasty bug that was zeroing out clog and subtrans pages, thus causing
various sorts of data corruptions.

The bug dates back to the XC days, but probably became prominent in XL because
of certain recent changes. In XC/XL, a node may not see all the XIDs and hence
clog/subtrans log must be extended whenever a new XID crosses the previously
seen page boundary. We do this by comparing the pageno where the new XID maps
with the latest_page_no as stored in the shared SLRU data structure. But to
handle XID wrap-arounds, we added a check for difference in number of pages to
be less than CLOG_WRAP_CHECK_DELTA, which was incorrectly defined as
(2^30 / CLOG_XACTS_PER_PAGE). Note that "^" is a logical XOR operator in C and
hence this was returned a very small number of 28, thus causing incorrect
zeroing of pages if ExtendCLOG is called with an XID which is older than what
28 clog pages can hold. All such transactions would suddenly be marked as
aborted, resulting in removal of perfectly valid tuples.

This patch fixes the mess by just relying on built-in routines for checking
XID wrap-arounds.

I also found another issue while working on this. We must not only zero the
page at hand, but also all intermediate pages because we won't this opportunity
later if an intermediate XID is seen.

In our test setup, this seems to help some of the recent reports of data
corruption, including "missing attributes" errors.

9 years agoIt may happen that we try to read the status of a transaction
Mason Sharp [Mon, 2 May 2016 18:44:53 +0000 (14:44 -0400)]
It may happen that we try to read the status of a transaction
in clog before the page has been committed.

There are places in the code that try to extend clog,
but here we simply just do one retry if it looks like
we failed to read the desired page.

9 years agoUpdate release notes and also correct product name to Postgres-XL 9.5r1
Pavan Deolasee [Fri, 15 Apr 2016 04:40:35 +0000 (10:10 +0530)]
Update release notes and also correct product name to Postgres-XL 9.5r1

9 years agoFix yet another memory leak in the shared queue producer path.
Pavan Deolasee [Thu, 14 Apr 2016 09:19:35 +0000 (14:49 +0530)]
Fix yet another memory leak in the shared queue producer path.

9 years agoFix another memory leak in executor.
Pavan Deolasee [Thu, 14 Apr 2016 09:00:05 +0000 (14:30 +0530)]
Fix another memory leak in executor.

9 years agoPlug a memory leak that might help OOM situations in ALTER TABLE .. ADD NODE
Pavan Deolasee [Thu, 14 Apr 2016 07:15:18 +0000 (12:45 +0530)]
Plug a memory leak that might help OOM situations in ALTER TABLE .. ADD NODE
case

Report by Florian Iragne

9 years agoTest no more uses 'start' command for gtm slave
Pallavi Sontakke [Wed, 13 Apr 2016 09:36:51 +0000 (15:06 +0530)]
Test no more uses 'start' command for gtm slave

'pgxc_ctl start' command is no more needed to start
gtm slave, with recent code changes.

9 years agoDon't use special marker "none" while updating max_wal_senders in
Pavan Deolasee [Wed, 13 Apr 2016 06:29:56 +0000 (11:59 +0530)]
Don't use special marker "none" while updating max_wal_senders in
postgresql.conf via pgxc_ctl.

Instead use "0" if the variable is not set or set to "none"

9 years agoMake 'help add' more explanatory
Pallavi Sontakke [Wed, 13 Apr 2016 05:38:46 +0000 (11:08 +0530)]
Make 'help add' more explanatory

Help user to supply 'slave_name' in
'pgxc_ctl add gtm slave', different from others
where original node name is expected.

Fixes #85

9 years agoAvoid removing directories for some pgxc_ctl calls, just as an added protection
Pavan Deolasee [Tue, 12 Apr 2016 15:43:22 +0000 (21:13 +0530)]
Avoid removing directories for some pgxc_ctl calls, just as an added protection
if user makes a mistake

9 years agoCheck for 'status' and not return value of waitpid() function
Pavan Deolasee [Tue, 12 Apr 2016 12:53:52 +0000 (18:23 +0530)]
Check for 'status' and not return value of waitpid() function

9 years agoSuppress the message hinting to start coordinator/datanode/gtm server at the
Pavan Deolasee [Tue, 12 Apr 2016 11:03:51 +0000 (16:33 +0530)]
Suppress the message hinting to start coordinator/datanode/gtm server at the
end of initdb/initgtm when the commands are run via pgxc_ctl

This can be confusing to the user. We use an environment varibale
PGXC_CTL_SILENT to silence the message instead of adding a new option.

9 years agoAdd check against accidental start of GTM with an XID lower than what it's
Pavan Deolasee [Tue, 12 Apr 2016 10:45:49 +0000 (16:15 +0530)]
Add check against accidental start of GTM with an XID lower than what it's
saved in its control file.

User must now explicitly specify -f option to forcefully start GTM with the
given value. This should protect users from incorrect usage of the -x option
(like we saw in a recent bug report)

9 years agoFix a typo in the log message during datanode failover
Pavan Deolasee [Tue, 12 Apr 2016 10:12:04 +0000 (15:42 +0530)]
Fix a typo in the log message during datanode failover

9 years agoReduce log level for a message during initdb
Pavan Deolasee [Tue, 12 Apr 2016 10:09:46 +0000 (15:39 +0530)]
Reduce log level for a message during initdb

9 years agoAdd an alternate expected file for aggregates test on sunos
Pavan Deolasee [Mon, 11 Apr 2016 05:49:06 +0000 (11:19 +0530)]
Add an alternate expected file for aggregates test on sunos

Patch by Patrick Sodré

9 years agoMake changes and bug fixes to let compilation and regression run on smartos
Pavan Deolasee [Mon, 11 Apr 2016 05:14:59 +0000 (10:44 +0530)]
Make changes and bug fixes to let compilation and regression run on smartos

We don't yet officially support the platform, given very little testing done so
far on this platform. But we don't stop others to doing it either. So
committing these changes upstream.

Reports, investigation and patches by Patrick Sodré.

9 years agoDo not add a spurious ';' when not cleaning WAL directory for a datanode
Pavan Deolasee [Sun, 10 Apr 2016 04:46:27 +0000 (10:16 +0530)]
Do not add a spurious ';' when not cleaning WAL directory for a datanode

9 years agoTest: Change command to start GTM standby.
Pallavi Sontakke [Thu, 7 Apr 2016 10:35:09 +0000 (16:05 +0530)]
Test: Change command to start GTM standby.

Use temporary PGXC_CTL_HOME for test.

9 years agoAdd test for GTM standby
Pallavi Sontakke [Wed, 6 Apr 2016 06:43:43 +0000 (12:13 +0530)]
Add test for GTM standby

9 years agoModify tests
Pallavi Sontakke [Fri, 1 Apr 2016 11:28:38 +0000 (16:58 +0530)]
Modify tests

Remove cluster-cleanup at start.
Extract PGXC_CTL_HOME from ENV.