summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2012-07-13Clean up remaining GIT conflicts due to merge a871778 in Makefile.shlibMichael Paquier
Noticed by Andrew Wong
2012-07-13Change control file of GTM into a text fileMichael Paquier
This includes latest GXID and sequence information. This configuration allows an external operator to modify sequence information with a simple text editor before restarting a GTM. Some functionalities have been added to include sequence name encoding and decoding when interacting with control file. Patch by Andrei Martsinchyk
2012-07-12Clean up whitespaces in XC header files and remove gtm_report_failureMichael Paquier
gtm_report_failure was a function used to allow report of an error between XCM and GTM-Standby. XCM is not supported anymore, in consequence this function becomes useless. It was deactivated by the way.
2012-07-12Refactor COPY command code exclusive to Postgres-XCMichael Paquier
Some functionalities related to relation locator determination depending on the COPY operation done and remote query generation are removed from copy.c to remotecopy.c and added in an XC-only specific file for two reasons: 1) Externalize the process of COPY to allow other modules to use it. 2) Reduce the footprint of XC code in postgres core code. The information of CopyStateData is necessary to generate a complete remote query but this data is private to copy.c, so an intermediate structure is used here to complete the externalization of those functionalities. If in a (distant?) future, CopyStateData is removed outside copy.c, we should use the same data for remotecopy.c, however this is still not the case in Postgres 9.2.
2012-07-12Simplify reconnection protocol of GTM-Proxy to GTMMichael Paquier
With this commit, reconnection of a GTM-Proxy to a GTM instance is controlled only with the interval time between 2 reconnections. While being in reconnection waiting process, it is possible to specify new GTM connection information with gtm_ctl reconnect. In consequence, 5 setting parameters of GTM-Proxy are removed here: - err_wait_count - err_wait_interval - err_wait_idle - gtm_connect_retry_count - gtm_connect_retry_idle Related information and documentation also is removed.
2012-07-12Remove all the trailing whitespaces in XC backend filesMichael Paquier
This includes locator, XC planner, pool, barrier and node manager. This clean-up should have been done long ago...
2012-07-12Remove all the trailing whitespaces in GTM codeMichael Paquier
2012-07-11Refactor functions for management and interpretation of distribution clausesMichael Paquier
This commit externalizes all the features used for the interpretation of SQL clauses TO NODE, TO GROUP and DISTRIBUTE BY. This reduces the footprint of XC code in heap.c. It is important to note here that this code cannot be completely removed from heap.c as there is a necessary dependency regarding system columns that cannot be used as distribution columns for HASH and MODULO tables.
2012-07-11Block GXID generation on standbysMichael Paquier
If a node accidentally connects to the Standby and reconnects to the Master afterwards, it will get an inconsistent GXID value since GTM Master is not aware of GXIDs generated by GTM Standby. Patch by Andrei Martsinchyk
2012-07-11Release GTM thread lock before exitMichael Paquier
This avoid to have another thread waiting for it, as it is possible it waits for it. Patch by Andrei Martsinchyk
2012-07-11Introduce new GTM thread status managing thread backupMichael Paquier
In the case of a GTM standby crash during the initial backup, the master GTM remained locked. The origin of this problem was during GTM backup process, where GTM locks all its threads one by one, performs a backup and then releases everything. This commit adds an additional control layer able to detect the thread status during backup. The new status GTM_THREAD_BACKUP is introduced for this purpose. Once backup is performed, the thread status is changed to GTM_THREAD_RUNNING. Hence, if the handler (GTM) is invoked upon sudden disconnection for backend (here GTM-Standby) disconnect of its connection and it sees that the current thread has status GTM_THREAD_BACKUP it goes ahead and releases the locks. This commit also includes some fixes for whitespaces. Patch by Andrei Martsinchyk
2012-07-11Solve SEGENV for GTM-StandbyMichael Paquier
Wrong variable was referenced when writing terminating null at the end of a string. It caused seg faults, because the referenced variable was not initialized yet. Patch by Andrei Martsinchyk.
2012-07-11Remove duplicate block of code looking in gtm_serialize.cMichael Paquier
It looks like it was accidentally copy/pasted. This has as consequence to write the coordinator name twice when serializing, so the result could not be deserialized properly. Patch by Andrei Martsinchyk
2012-07-11Correct whitespaces, format and message format in gtm_client.cMichael Paquier
This had consequences on the data types of the values sent by GTM which was not matching those GTM Standby was trying to read. Patch by Andrei Martsinchyk
2012-07-11Refactoring of gram.y for distribution clausesMichael Paquier
This refactoring allows the usage of clauses TO NODE, TO GROUP and DISTRIBUTE BY in a more flexible way by decoupling empty extensions. This is particularly useful to plug-in those clauses to other existing SQL of Postgres. A slight grammar modification is being introduced in this commit, which is the addition of brackets when defining a node list. This has consequences on the following queries: - EXECUTE DIRECT - CLEAN CONNECTION - CREATE TABLE (subset of nodes) - CREATE TABLE AS - CREATE NODE GROUP This simple modification allows the use of TO NODE/TO GROUP extensions when they are listed in a list of commands separated by commas. By the way, this modification really lowers the possibility of shift-reduce conflicts in bison when implementing new features in XC using existing clauses.
2012-07-10Remove duplication of functions get_xc_node_name and is_prepared_on_nodeMichael Paquier
Those functions were created in regression tests xc_for_update and xc_prepared_xacts. Now their creation is done in xc_create_function.
2012-07-09Fix for bug 3540784: Incorrect COPY for partially distributed tablesMichael Paquier
When a table was distributed on a portion of nodes. COPY process was not correctly choosing the output node during a COPY TO. This problem has been put into light by a case where table was replicated without using the first datanode of the cluster. It happened that there was the same problem for hash/modulo tables as well. A test case in xc_copy has been added to cover this problem, and a small portion managing COPY TO in execRemote.c has been cleaned.
2012-07-06Remove duplicated define IsLocatorReplicated in locator.hMichael Paquier
2012-07-06Refactor regression tests xc_misc, xc_FQS and xc_FQS_joinMichael Paquier
Those tests are using a similar PL/PGSQL function to create tables with a node list, being transparent on the cluster structure. This function was created 3 times. Now this function is created in another test called xc_create_function launched before all the others. A table name conflict has been resolved in xc_misc to allow this test to run in parallel with the other XC-related tests.
2012-07-04Activate gtm_ctl statusMichael Paquier
gtm_ctl can control the status of a GTM server like pg_ctl does with PostgreSQL instances (in the case of XC Coordinator and Datanode). Noticed by Koichi Suzuki, formatting of status output to get something consistent with pg_ctl and clean up by me.
2012-07-03Correct headers and copyrights in some XC-related .h and .c filesMichael Paquier
Some headers were missing, some did not follow PostgreSQL format.
2012-06-29The function is_foreign_expr() and pgxc_is_query_shippable() were usingAshutosh Bapat
different walkers to checking if an expression or a query respectively, is shippable. The logic to decide whether an expression or query is shippable or not needs to be same except for few differences between shippability of expression and query, arising from the information in both of them. If we want to code a rule for shippability, we need to make it to both of these functions, becoming a maintenance burden. The commit unifies the walkers into one and makes appropriate changes in naming.
2012-06-29Remove not used variable DATA_NODE_FETCH_SIZE in execRemote.cMichael Paquier
2012-06-28Fix for test alter_tableMichael Paquier
This is to realign XC regressions in consequence of merge with commit c1d9579 on PostgreSQL master branch.
2012-06-28Fix for test rowtypesMichael Paquier
This is to realign XC regressions with merge c1d9579.
2012-06-28Fix for test domainMichael Paquier
This is to realign XC regressions with merge c1d9579.
2012-06-28Fix for test foreign_dataMichael Paquier
This is to realign XC regressions with merge c1d9579.
2012-06-28Merge commit 'c1d9579dd8bf3c921ca6bc2b62c40da6d25372e5'Michael Paquier
This merge with PostgreSQL master has been requested by Ashutosh. Commit c1d9579 contains a modification of pull_var_clause allowing to filter aggregate expressions inside Var clauses which is useful for Postgres-XC planner optimizations regarding remote query path determination. At this point, Postgres-XC master is half-way between the intersection of postgres/master&postgres/REL9_1_STABLE and the intersection of postgres/master&postgres/REL9_2_STABLE. The rest of Postgres-XC merge up to the merge-base of postgres/master&postgres/REL9_2_STABLE is planned to be done in a couple of weeks. Until this time it is not planned to release an XC version which is based on a stable branch of Postgres, so it is OK to let XC master code at this point of postgres master. Conflicts: configure configure.in src/Makefile.shlib src/backend/access/heap/heapam.c src/backend/access/index/indexam.c src/backend/access/transam/transam.c src/backend/access/transam/xact.c src/backend/access/transam/xlog.c src/backend/commands/view.c src/backend/executor/execAmi.c src/backend/storage/lmgr/proc.c src/include/catalog/catversion.h src/include/catalog/pg_proc.h src/include/pg_config.h.win32 src/pl/plpgsql/src/plpgsql--1.0.sql src/test/regress/expected/prepared_xacts.out src/test/regress/expected/subselect.out src/test/regress/pg_regress.c src/test/regress/sql/prepared_xacts.sql
2012-06-26Remove useless argument in function DataNodeCopyBegin of execRemote.cMichael Paquier
This function was referencing to a boolean flag as a COPY TO/FROM switch but is not used by code.
2012-06-21Fix for crash at gtm_proxy startup in 32b-linux machinesMichael Paquier
This fix adds an additional boolean flag in GTM-Proxy thread info to make it similar to the one used in GTM. The problem which was happening was that GTM-Proxy tried to use the memory structure of the thread info of GTM. Crash problems are solved but we should find in the future a smarter way to manage GTM and GTM-Proxy memory allocation APIs as they are now strongly dependant on each other and we may find similar issues if some new developments are done on GTM and/or GTM-Proxy. Report from Plexo Rama and patch from Koichi Suzuki.
2012-06-21Push -l option of gtm_ctl to gtmMichael Paquier
This solves 2 problems: - Avoid to have an empty output file when gtm_ctl has a log file defined - Change log file name of GTM according to what is given by gtm_ctl Patch by Michael Meskes
2012-06-21Provide projection capability to the RemoteQuery node.Ashutosh Bapat
In RemoteQuery node we provide base_tlist as the target list representing the data expected from the datanodes. This provides the scan tuple descriptor. The actual targetlist expected from the RemoteQuery node is saved in scan.plan.targetlist like other scan plans. This serves as the projection list. Rest of the logic to link the scan targetlist and project targetlist, to apply quals is built in ExecScan(). Since RemoteQuery nodes have projection capabilities, we don't need Result nodes above RemoteQuery nodes just to perform projection. ExecRemoteQuery() now uses a template similar to ExecSeqScan(). Since ExecRemoteQuery() takes care of the materialization, we don't need Materialize node above RemoteQuery node.
2012-06-18Fix for bug 3535915: INSERT SELECT for partially replicated tablesMichael Paquier
Remote DML planning was not taking into account the node list to be used on a relation when modifying data on it. This has been enlighten by a test case with INSERT SELECT on tables replicated defined on a sub-cluster. For example, in the case of a cluster with 2 Datanodes dn1 and dn2: CREATE TABLE aa1 (a int) DISTRIBUTE BY REPLICATION TO NODE dn1; CREATE TABLE aa2 (a int) DISTRIBUTE BY HASH(a); INSERT INTO aa2 VALUES (1),(2),(3),(4); INSERT INTO aa1 SELECT * FROM aa2; The last INSERT SELECT was inserting data on all the nodes instead of doing it only on Datanode dn1.
2012-06-15Correct ORDER BY query plan in output join.outMichael Paquier
This is an additional fix consequence of commit 9a7d611. It makes the output plan of join.out consistent with join_1.out.
2012-06-15Fix for sequence removal on GTM when related database is droppedMichael Paquier
There was an error on GTM side on when comparing sequence key strings related to key size when sequence drop is based on a sequence key type GTM_SEQ_DB_NAME. Here is an example that was failing: create database test; \c test create sequence toto; \c postgres -- Sequence not dropped on GTM when database is dropped drop database test; create database test; \c test -- error cannot re-create sequence, GTM complains -- because sequence is seen as already created on GTM create sequence toto; Report and test case by Dimitrije Radojevic
2012-06-14The code to reduce to the number of data-nodes based on the quals in the queryAshutosh Bapat
is duplicated in two places. Move this code into a function GetRelationNodesByQuals() to avoid duplication.
2012-06-12Correct grammar of CREATE TABLE and CLEAN CONNECTION in docsMichael Paquier
Some brackets were used on mandatory arguments of some clauses.
2012-06-12Make data ordering consistent in query for test join.sqlMichael Paquier
Regression test join failed on rare occasions depending on the cluster configuration.
2012-06-05Update pg_ctl with correct bug ML and reorganize helpMichael Paquier
The PostgreSQL mailing list for bugs was incorrectly used.
2012-06-05Change mode choice option from -S to -ZMichael Paquier
Documentation was referring to both, as well as initgtm. The option to be used should be -Z to be consistent with pg_ctl when choosing Coordinator or Datanode.
2012-06-02Block node registration for slave nodes and perform register at a stable stateMichael Paquier
Performing node registration on GTM just after postmaster start is dangerous because the master/slave status of the node is unknown. So node registration is done once node has reached a stable state, meaning that Xlog process has confirmed to postmaster that recovery has been completed. Registration is also blocked for slave nodes. A standby node is created from a hot backup of its master so master and its slaves will share the same node name. Two nodes are not authorized to register to GTM with the same node name to avoid identification confusion in the cluster, so it looks normal to let the master and the master only identify itself. A a direct consequence, unregistration too is done only for master node. Synchronous and asynchronous node replication works correctly with this fix, as well as node promotion (Ex: "pg_ctl promote -D $DATA").
2012-05-31Move pgxc_clean and pgxc_ddl to contrib modulesMichael Paquier
Both features are not directly related to the core features, so it is better to move them there. The installation of pgxc_clean can be done with the same way as a normal contrib module. pgxc_ddl is not installed by default, but is kept for future developments. Documentation is moved the same way.
2012-05-30Update code comments: use "Coordinator" and "Datanode" as conventional termsMichael Paquier
This unifies the convention name for Coordinator and Datanode in Postgres-XC with documentation.
2012-05-30Change INSERT tag for remote INSERT queriesMichael Paquier
When an INSERT query was planned using create_remoteinsert_plan, the tag returned to client was "INSERT 1 1", which is incorrect as the first digit should be the newly-insert Oid in case table being inserted uses WITH OIDS. Oids are not consistent among nodes in XC cluster, so set the first digit value to InvalidOid, which is the same way of doing with FQS-ed INSERT queries or INSERT having multiple values.
2012-05-29Reinforce ALTER SEQUENCE handling on GTM for START/RESTARTMichael Paquier
Successive ALTER SEQUENCE with START/RESTART requests was messing the start value of sequences involved. Handling of sequence key string is reinforced to take into account the last "\0" when this data is sent from client. This was causing GTM to deal with sequence names with incorrect last characters, resulting in strange logs. Per report from Hitoshi Hemmi
2012-05-29Fix CREATE EXTENSION in clusterMichael Paquier
Two problems related to EXTENSION creation are fixed here. 1) Queries CREATE/ALTER EXTENSION were not sent to remote nodes. 2) A raw query string directly obtained from the extension script was sent to remote nodes, failing extension creation if more than 2 queries were planned. This process is now controlled at node level and only CREATE/ALTER extension queries are sent to remote nodes. Extension installation works correctly but no checks have been made with modules like dblink, they should however work like in vanilla Postgres...
2012-05-28Fix pgxc_clean crash when no options are specifiedMichael Paquier
Specifying a database or all databases is mandatory. Per report from Hitoshi Hemmi and patch from Koichi Suzuki
2012-05-28Fix a problem with transactions staying open on remote nodesMichael Paquier
The origin of the problem was that BEGIN messages were being sent to remote nodes for all the queries launched in do_query of execRemote.c. However, read-only queries were registered as read connections to remote nodes, meaning that a COMMIT message was not sent in this case. This had as direct consequence to keep transactions open on remote nodes. For example, in such a test case: create table tab(a int, b int); insert into tab values(1,2),(3,4); begin; select * from tab; prepare transaction 'pt2'; select * from tab; The transaction is begun on local Coordinator and remote nodes, but it is not committed on remote nodes. The origin of the problem is that it doesn't make sense to send a BEGIN message to remote nodes when SELECT is launched inside this transaction block, but it needs only to be sent when the first write operation is done. Then, when the second SELECT was launched, the remote Datanodes were complaining that a transaction was already open. This fix has been checked with regressions and DBT-1. It improves the performance output of DBT-1 by 15% for 5 nodes thanks to all the BEGIN messages not sent to remote nodes.
2012-05-28Remove useless query in test xc_miscMichael Paquier
The same kind of query was used twice, for the same results. Moreover, this query was not always giving consistent results depending on cluster configuration used.
2012-05-28Simplify remote node communication at PREPARE phaseMichael Paquier
This commit fixes issue 3528952, which made a Coordinator sending COMMIT messages unnecessarily to remote nodes for read connections. This caused Datanodes to log a lot of warning messages of the type "WARNING: there is no transaction in progress". This issue was reproducible when cluster was under a huge load. Things are simplified in pgxc_node_remote_prepare and this function does not manage anymore with COMMIT messages, what it was not meant to do by the way. The modifications of this commit revert partially things implemented in commit 077b37369a4b26b5aa0db7b23667a1803e2af4de but does not change the process of SELECT FOR UPDATE transactions as connections using such queries are registed as write connections to remote nodes. All the test cases introduced by commits 077b373 and 9e66733 are kept. They pass correctly with this patch, and measurements with DBT-1 are passing correctly.