Git Product home page Git Product logo

pg_paxos's Introduction

pg_paxos

This PostgreSQL extension provides a basic implementation of the Paxos algorithm in PL/pgSQL and basic table replication through Paxos.

Warning: pg_paxos is in an early stage, consider it experimental.

pg_paxos can be used to replicate a table across multiple PostgreSQL servers. Every INSERT/UPDATE/DELETE on a replicated table is logged through Paxos. When a query is performed on the table, pg_paxos first ensures that all preceding queries in the Multi-Paxos log have been applied, providing strong consistency. By using the Paxos algorithm, pg_paxos is also robust to failure of a minority of nodes (read: servers), e.g. 2 out of 5.

The Paxos Algorithm

paxos(k,v) is a function that returns the same value on all nodes in a group for a certain key (k), and the value is one of the inputs (v). For example, a node might call paxos('leader','primary = node-a') to assign a permanent group leader. paxos(k,v) first picks a proposal number n (usually 0) and then tries to get a value accepted by a majority of nodes in 2 phases:

  1. a) ask a majority of nodes to reject proposals for key k with a number smaller than n (or equal with lower node id), and return any previously accepted value and its proposal number
    b) if a value was already accepted by one or more nodes, then v takes on the value with the highest proposal number
  2. ask responders from phase 1 to accept proposal n with value v for key k

If in either phase the proposer cannot get confirmation from the majority, either due to failure or due to a rejection based on the proposal number, then it restarts with n = the highest proposal number in responses + 1, until a proposal succeeds in which case the function returns v.

  • 1a. ensures that the proposer has exclusive access among the majority, it's basically a lock with preemption
  • 1b. ensures that a value is never changed once the majority accepts a value, since the proposer cannot get a new majority without at least one node having the existing value
    1. achieves consensus if the majority lock has not been preempted, which implies that any other proposal still needs to complete 1a for at least one node in the majority and will thus see the value in 1b

Any subsequent proposal will use the same value in phase 2, and therefore paxos always returns the same value on all nodes.

Multi-Paxos

Once a majority accepts a value, it can never be changed. However, Paxos can be used to implement a distributed log by using the index (round) in the log as a key. The log can be used to replicate a sequence of writes to a common, initial state. This technique is typically referred to as Multi-Paxos.

To append a new write to the log, a node needs to reach consensus on its write in a given round and apply all preceding writes. This may require several attempts if other nodes are trying to reach consensus on the same round. Heavily simplified, writing to the Multi-Paxos log might look as follows:

round = last_applied_round+1

while((c = paxos(round,v)) != v) 
    execute(c)
    last_applied_round = round
    round++

To perform a consistent read, a node needs to confirm the highest accepted round number in the group and execute all items in the log up to that round number. Some rounds may have been abandoned before consensus was reached, in which case the reader can force consensus by proposing a value that does not change the state.

round = last_applied_round+1
max_round_num = max_accepted_round()

while(round <= max_round_num)
    execute(paxos(round,''))
    last_applied_round = round
    round++

While the examples above are heavily simplified, pg_paxos follows the same general approach, using SQL queries as log items.

Installation

The easiest way to install pg_paxos is to build the sources from GitHub.

git clone https://github.com/citusdata/pg_paxos.git
cd pg_paxos
PATH=/usr/local/pgsql/bin/:$PATH make
sudo PATH=/usr/local/pgsql/bin/:$PATH make install

pg_paxos requires the dblink extension that you'll find in the contrib directory of PostgreSQL to be installed. After installing both extensions run:

-- run via psql on each node:
CREATE EXTENSION dblink;
CREATE EXTENSION pg_paxos;

To do table replication, pg_paxos uses PostgreSQL's executor hooks to log SQL queries performed by the user in the Paxos log. To activate executor hooks, add pg_paxos to the shared_preload_libraries in postgresql.conf and restart postgres. It is also advisable to specify a unique node_id, which is needed to guarantee consistency in certain scenarios.

# in postgresql.conf
shared_preload_libraries = 'pg_paxos'
pg_paxos.node_id = '<some-unique-name>'

Setting up Table Replication

pg_paxos allows you to replicate a table across a group of servers. When a table is marked as replicated, pg_paxos intercepts all SQL queries on that table via the executor hooks and appends them to the Multi-Paxos log. Before a query is performed, preceding SQL queries in the log are executed to bring the table up-to-date. From the perspective of the user, the table always appears consistent, even though the physical representation of the table on disk may be behind at the start of the read.

To set up Paxos group with a replicated table, first create the table on all the nodes:

CREATE TABLE coordinates (
    x int,
    y int
);

Then, on one of the nodes, call paxos_create_group to create a named Paxos group with the node itself (defined as a connection string using its external address) as its sole member, and call paxos_replicate_table to replicate a table within a group:

SELECT paxos_create_group('mokka', 'host=10.0.0.1');
SELECT paxos_replicate_table('mokka', 'coordinates');

To add another node (e.g. 10.0.0.49), connect to it and call paxos_join_group using the name of the group, the connection string of an existing node, and the connection string of the node itself:

SELECT paxos_join_group('mokka', 'host=10.0.0.1', 'host=10.0.0.49');

If you want to replicate an additional table after forming the group, then run paxos_replicate_table on all the nodes.

An example of how pg_paxos replicates the metadata:

[marco@marco-desktop pg_paxos]$ psql
psql (9.5.1)
Type "help" for help.

postgres=# INSERT INTO coordinates VALUES (1,1);
INSERT 0 1
postgres=# INSERT INTO coordinates VALUES (2,2);
INSERT 0 1
postgres=# SELECT * FROM coordinates ;
 x | y
---+---
 1 | 1
 2 | 2
(2 rows)

postgres=# \q
[marco@marco-desktop pg_paxos]$ psql -p 9700
psql (9.4.4)
Type "help" for help.

postgres=# SELECT * FROM coordinates ;
DEBUG:  Executing: INSERT INTO coordinates VALUES (1,1);
CONTEXT:  SQL statement "SELECT paxos_apply_log($1,$2,$3)"
DEBUG:  Executing: INSERT INTO coordinates VALUES (2,2);
CONTEXT:  SQL statement "SELECT paxos_apply_log($1,$2,$3)"
 x | y
---+---
 1 | 1
 2 | 2
(2 rows)

postgres=# UPDATE coordinates SET x = x * 10;
UPDATE 2
postgres=# \q
[marco@marco-desktop pg_paxos]$ psql -p 9701
psql (9.4.4)
Type "help" for help.

postgres=# SELECT * FROM coordinates ;
DEBUG:  Executing: INSERT INTO coordinates VALUES (1,1);
CONTEXT:  SQL statement "SELECT paxos_apply_log($1,$2,$3)"
DEBUG:  Executing: INSERT INTO coordinates VALUES (2,2);
CONTEXT:  SQL statement "SELECT paxos_apply_log($1,$2,$3)"
DEBUG:  Executing: UPDATE coordinates SET x = x * 10;
CONTEXT:  SQL statement "SELECT paxos_apply_log($1,$2,$3)"
 x  | y
----+---
 10 | 1
 20 | 2
(2 rows)

By default, pg_paxos asks other nodes for the highest accepted round number in the log before every read. It then applies the SQL queries in the log up to and including the highest accepted round number, which ensures strong consistency. In some cases, low read latencies may be preferable to strong consistency. The pg_paxos.consistency_model setting can be changed to 'optimistic', in which case the node assumes it has already learned about preceding writes. The optimistic consistency model provides read-your-writes consistency in the absence of failure, but may return older results when failures occur.

The consistency model can be changed in the session:

SET pg_paxos.consistency_model TO 'optimistic';

To switch back to strong consistency:

SET pg_paxos.consistency_model TO 'strong';

Internal Table Replication functions

The following functions are called automatically when using table replications when a query is performed. We show how to call them explicitly to clarify the internals of pg_paxos.

The paxos_apply_and_append function (called on writes) appends a SQL query to the log after ensuring that all queries that will preceed it in the log have been executed.

SELECT * FROM paxos_apply_and_append(
                current_proposer_id := 'node-a/1251',
                current_group_id := 'ha_postgres',
                proposed_value := 'INSERT INTO coordinates VALUES (3,3)');

The paxos_apply_log function (called on SELECT) executes all SQL queries in the log for a given group that have not yet been executed up to and including round number max_round_num.

SELECT * FROM paxos_apply_log(
                current_proposer_id := 'node-a/1252',
                current_group_id := 'ha_postgres',
                max_round_num := 3);

The paxos_max_group_round function queries a majority of hosts for their highest accepted round number. The round number returned by paxos_max_group_round will be greater or equal to any round on which there is consensus (a majority has accepted) at the start of the call to paxos_max_group_round. Therefore, a node is guaranteed to see any preceding write if it applies the log up to that round number.

SELECT * FROM paxos_max_group_round(
                current_group_id := 'ha_postgres');

Using Paxos functions directly

You can also implement an arbitrary distributed log using pg_paxos by calling the paxos functions directly. The following query appends value 'primary = node-a' to the Multi-Paxos log for the group ha_postgres:

SELECT * FROM paxos_append(
                current_proposer_id := 'node-a/1253',
                current_group_id := 'ha_postgres',
                proposed_value := 'primary = node-a');

current_proposer_id is a value that should be unique across the cluster for the given group and round. This is mainly used to determine which proposal was accepted when two proposers propose the same value.

The latest value in the Multi-Paxos log can be retrieved using:

SELECT * FROM paxos(
                current_proposer_id := 'node-a/1254',
                current_group_id := 'ha_postgres',
                current_round_num := paxos_max_group_round('ha_postgres'));

Copyright © 2016 Citus Data, Inc.

pg_paxos's People

Contributors

marcocitus avatar marcoslot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pg_paxos's Issues

Replicating a table after all nodes have joined

What I was trying to do is this:

  • Created a group and didn't yet replicate a table
  • Joined server 2 to the group
  • Went back to server 1 and replicated a table
  • Back to server 2, created the same table and inserted a row in it
  • Back at server 1 looking for the row - don't find it
  • Perhaps failed to get the sequence right; tried using a different group (making sure to replicate the table before joining server 2)
  • Could create the new group but couldn't replicate table because:
ERROR:  duplicate key value violates unique constraint "replicated_tables_pkey"

How to go about replicating a table after all nodes have joined?

By the way, I didn't find the tear-down/drop counterpart of paxos_create_group(). Is that a TODO?

bug in paxos(text, text, bigint, text) function?

periodically see this error:

consumer_node_1.rb:19:in `exec': ERROR:  column "proposal_num" does not exist (PG::UndefinedColumn)
LINE 1: SELECT greatest(max(proposal_num), current_proposal_num) + 1
                            ^
QUERY:  SELECT greatest(max(proposal_num), current_proposal_num) + 1
                                         FROM accept_responses
CONTEXT:  PL/pgSQL function paxos(text,text,bigint,text) line 177 at SQL statement
SQL statement "SELECT * FROM paxos(
                    current_proposer_id,
                    current_group_id,
                    current_round_num,
                    proposed_value)"
PL/pgSQL function paxos_apply_and_append(text,text,text) line 18 at SQL statement
SQL statement "SELECT paxos_apply_and_append($1,$2,$3)"
    from consumer_node_1.rb:19:in `execute_job'
    from consumer_node_1.rb:52:in `<main>'

My guess is that https://github.com/citusdata/pg_paxos/blob/master/sql/pg_paxos.sql#L454 should be:
SELECT greatest(max(**min_**proposal_num), current_proposal_num) + 1

cannot use CTEs in core query

with update_some_other_foo as(
  insert into rep_table values(10,1) returning x
)
update rep_table
set y = 10
from update_some_other_foo
where rep_table.x = update_some_other_foo.x;
ERROR:  relation "(null)" is not managed by pg_paxos

pg_paxos at database level

Hi,

I followed th README tutorial and everything works great.
but once I did the same of other databases it fails when I wanted other nodes to join th group
so I did as superadmin on all nodes user once everything was installed on the main node
psql -d myDB
SELECT paxos_join_group('mokka', 'host=10.0.0.1', 'host=10.0.0.49');
but
ERROR: connection "paxos_join_group" not available
CONTEXT: SQL statement "SELECT dblink_disconnect('paxos_join_group')"
PL/pgSQL function paxos_join_group(text,text,text) line 92 at PERFORM

thanks for your advice

INSERT RETURNING does not return results

E-mail from Sri with steps to reproduce.

On 5 Mar 2016 4:22 pm, "Srivaths" [email protected] wrote:

Got a new problem here:

$ psql
psql (9.4.4)
Type "help" for help.

srangarajan=# select * from barr;
 id | x | y 
----+---+---
  1 | 1 | 2
(1 row)

srangarajan=# insert into barr(x,y) values (1,2) returning x;
--
(1 row)

INSERT 0 1
srangarajan=# \d barr
                         Table "public.barr"
 Column |  Type   |                     Modifiers                     
--------+---------+---------------------------------------------------
 id     | integer | not null default nextval('barr_id_seq'::regclass)
 x      | integer | 
 y      | integer |

srangarajan=# insert into bar(x,y) values (1,2) returning x;
--
(1 row)

INSERT 0 1
srangarajan=# \d bar
      Table "public.bar"
 Column |  Type   | Modifiers 
--------+---------+-----------
 x      | integer | 
 y      | integer | 

Basically pg_paxos seems to be eating up the returning value. It doesn't seem to matter if the value being returned was from an auto-incremented field or a normal field, and it also doesn't seem to matter if the table itself had an auto-incrementing column on it or not.

license

What is the license for this extension? I see LGPL3 in the metadata.json, is that authoritative?

Crash in transaction abort state

Just ran into this:

postgres=# INSERT INTO coordinates VALUES (1, 2);
ERROR:  paxos commands cannot run inside a transaction block
STATEMENT:  INSERT INTO coordinates VALUES (1, 2);
ERROR:  paxos commands cannot run inside a transaction block
postgres=# ROLLBACK;
TRAP: FailedAssertion("!(IsTransactionState())", File: "relcache.c", Line: 1737)
LOG:  server process (PID 11317) was terminated by signal 6: Aborted
DETAIL:  Failed process was running: ROLLBACK;
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

Leaves the following back-trace:

#0  0x0000003969632625 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x0000003969633e05 in abort () at abort.c:92
#2  0x000000000092d47e in ExceptionalCondition (conditionName=0xb31d96 "!(IsTransactionState())", errorType=0xb319e0 "FailedAssertion", 
    fileName=0xb31944 "relcache.c", lineNumber=1737) at assert.c:54
#3  0x000000000091ae1e in RelationIdGetRelation (relationId=3079) at relcache.c:1737
#4  0x00000000004b678c in relation_open (relationId=3079, lockmode=1) at heapam.c:1063
#5  0x00000000004b6af8 in heap_open (relationId=3079, lockmode=1) at heapam.c:1238
#6  0x0000000000603c2d in get_extension_oid (extname=0x7fe999001b21 "pg_paxos", missing_ok=1 '\001') at extension.c:127
#7  0x00007fe998fec475 in IsPgPaxosActive () at src/pg_paxos.c:268
#8  0x00007fe998fed193 in PgPaxosProcessUtility (parsetree=0x23c2b80, queryString=0x23c2198 "ROLLBACK;", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, 
    dest=0x23c2f08, completionTag=0x7fff5a34d430 "") at src/pg_paxos.c:780
#9  0x00000000007ef9a2 in ProcessUtility (parsetree=0x23c2b80, queryString=0x23c2198 "ROLLBACK;", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, dest=0x23c2f08, 
    completionTag=0x7fff5a34d430 "") at utility.c:330
#10 0x00000000007eea8e in PortalRunUtility (portal=0x23f4998, utilityStmt=0x23c2b80, isTopLevel=1 '\001', dest=0x23c2f08, completionTag=0x7fff5a34d430 "")
    at pquery.c:1183
#11 0x00000000007eec6a in PortalRunMulti (portal=0x23f4998, isTopLevel=1 '\001', dest=0x23c2f08, altdest=0x23c2f08, completionTag=0x7fff5a34d430 "")
    at pquery.c:1314
#12 0x00000000007ee1da in PortalRun (portal=0x23f4998, count=9223372036854775807, isTopLevel=1 '\001', dest=0x23c2f08, altdest=0x23c2f08, 
    completionTag=0x7fff5a34d430 "") at pquery.c:812
#13 0x00000000007e83a4 in exec_simple_query (query_string=0x23c2198 "ROLLBACK;") at postgres.c:1104
#14 0x00000000007ec436 in PostgresMain (argc=1, argv=0x2352580, dbname=0x23523e0 "postgres", username=0x23523c0 "amit") at postgres.c:4030
#15 0x000000000076ac8c in BackendRun (port=0x2371c90) at postmaster.c:4239
#16 0x000000000076a3f7 in BackendStartup (port=0x2371c90) at postmaster.c:3913
#17 0x0000000000766ba8 in ServerLoop () at postmaster.c:1684
#18 0x000000000076626c in PostmasterMain (argc=3, argv=0x2351590) at postmaster.c:1292
#19 0x00000000006be4c6 in main (argc=3, argv=0x2351590) at main.c:228

cannot use views

CREATE TABLE jobs(job_id SERIAL PRIMARY KEY, key_to_be_incremented INTEGER NOT NULL, being_worked_on_by TEXT, completed BOOLEAN DEFAULT FALSE , created_at TIMESTAMP, updated_at TIMESTAMP);
CREATE VIEW queued_jobs AS SELECT job_id, created_at, updated_at FROM jobs WHERE being_worked_on_by IS NULL AND completed IS NOT TRUE;

srangarajan=# select * from queued_jobs;
ERROR:  relation "(null)" is not managed by pg_paxos

use of function only updates node where function is called

functions don t work

As you can see, simple table with an insert function. Only applies the function to the node I called the function from. Also, it doesn't matter if the other node has the function or not. I understand this might be because of no support for distributed transactions and that functions are inherently transactional but there is no warning or error message for the same.

Installation with Postgres 9.6 does not readily work

I tried installing the pg_paxos extension from the latest code on top of postgres 9.6 on ubuntu 16.04. My make and make install of pg_paxos happen without problems. However, when I try to create the pg_paxos extension using the psql command "CREATE EXTENSION ps_paxos", I keep getting an error -- ERROR: could not access file "$libdir/pg_paxos": No such file or directory. Am I missing some steps (I am new to PG) or does the README not mention some obvious steps?

connection "paxos_join_group" not available

I'm receiving the following error trying to setup pg_paxos on postgres 9.5.5. This is on a second node I'm trying to add to the group. Looks like this was filed before (#13) but that issue was closed without comment.

postgres=# select paxos_join_group('group0', 'host=10.10.1.1', 'host=10.10.1.2');
ERROR:  connection "paxos_join_group" not available
CONTEXT:  SQL statement "SELECT dblink_disconnect('paxos_join_group')"
PL/pgSQL function paxos_join_group(text,text,text) line 92 at PERFORM

compile failed

Fedora 29 gcc 8.3.1

[root@node177 pg_paxos]# make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -fPIC -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter -Iinclude -I/usr/local/pgsql/include -I. -I./ -I/usr/local/pgsql/include/server -I/usr/local/pgsql/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o src/pg_paxos.o src/pg_paxos.c -MMD -MP -MF .deps/pg_paxos.Po
src/pg_paxos.c: In function ‘_PG_init’:
src/pg_paxos.c:138:22: error: assignment to ‘ProcessUtility_hook_type’ {aka ‘void (*)(struct PlannedStmt *, const char *, enum , struct ParamListInfoData *, struct QueryEnvironment *, struct _DestReceiver *, char )’} from incompatible pointer type ‘void ()(Node *, const char *, ProcessUtilityContext, struct ParamListInfoData *, DestReceiver *, char )’ {aka ‘void ()(struct Node *, const char *, enum , struct ParamListInfoData *, struct _DestReceiver *, char *)’} [-Werror=incompatible-pointer-types]
ProcessUtility_hook = PgPaxosProcessUtility;
^
In file included from /usr/local/pgsql/include/server/nodes/pg_list.h:40,
from /usr/local/pgsql/include/server/access/tupdesc.h:19,
from /usr/local/pgsql/include/server/funcapi.h:21,
from src/pg_paxos.c:17:
src/pg_paxos.c: In function ‘PgPaxosPlanner’:
/usr/local/pgsql/include/server/nodes/nodes.h:628:27: error: implicit declaration of function ‘typeof’; did you mean ‘pg_typeof’? [-Werror=implicit-function-declaration]
#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))
^~~~~~
src/pg_paxos.c:206:23: note: in expansion of macro ‘copyObject’
Query *paxosQuery = copyObject(query);
^~~~~~~~~~
/usr/local/pgsql/include/server/nodes/nodes.h:628:40: error: expected ‘)’ before ‘copyObjectImpl’
#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))
~ ^~~~~~~~~~~~~~
src/pg_paxos.c:206:23: note: in expansion of macro ‘copyObject’
Query *paxosQuery = copyObject(query);
^~~~~~~~~~
/usr/local/pgsql/include/server/nodes/nodes.h:628:25: error: initialization of ‘Query *’ {aka ‘struct Query *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))
^
src/pg_paxos.c:206:23: note: in expansion of macro ‘copyObject’
Query *paxosQuery = copyObject(query);
^~~~~~~~~~
src/pg_paxos.c: In function ‘PgPaxosExecutorStart’:
src/pg_paxos.c:554:3: error: implicit declaration of function ‘PreventTransactionChain’; did you mean ‘PreventInTransactionBlock’? [-Werror=implicit-function-declaration]
PreventTransactionChain(isTopLevel, "paxos commands");
^~~~~~~~~~~~~~~~~~~~~~~
PreventInTransactionBlock
src/pg_paxos.c:573:42: error: passing argument 1 of ‘pg_analyze_and_rewrite’ from incompatible pointer type [-Werror=incompatible-pointer-types]
queryTreeList = pg_analyze_and_rewrite(parseTreeNode, paxosQueryString, NULL, 0);
^~~~~~~~~~~~~
In file included from /usr/local/pgsql/include/server/tcop/utility.h:17,
from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/tcopprot.h:51:14: note: expected ‘RawStmt *’ {aka ‘struct RawStmt *’} but argument is of type ‘Node *’ {aka ‘struct Node *’}
extern List *pg_analyze_and_rewrite(RawStmt *parsetree,
^~~~~~~~~~~~~~~~~~~~~~
src/pg_paxos.c:573:19: error: too few arguments to function ‘pg_analyze_and_rewrite’
queryTreeList = pg_analyze_and_rewrite(parseTreeNode, paxosQueryString, NULL, 0);
^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/pgsql/include/server/tcop/utility.h:17,
from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/tcopprot.h:51:14: note: declared here
extern List *pg_analyze_and_rewrite(RawStmt *parsetree,
^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/pgsql/include/server/nodes/pg_list.h:40,
from /usr/local/pgsql/include/server/access/tupdesc.h:19,
from /usr/local/pgsql/include/server/funcapi.h:21,
from src/pg_paxos.c:17:
src/pg_paxos.c: In function ‘PgPaxosProcessUtility’:
/usr/local/pgsql/include/server/nodes/nodes.h:628:40: error: expected ‘)’ before ‘copyObjectImpl’
#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))
~ ^~~~~~~~~~~~~~
src/pg_paxos.c:826:21: note: in expansion of macro ‘copyObject’
Node *rawQuery = copyObject(copyStatement->query);
^~~~~~~~~~
/usr/local/pgsql/include/server/nodes/nodes.h:628:25: error: initialization of ‘Node *’ {aka ‘struct Node *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
#define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj))
^
src/pg_paxos.c:826:21: note: in expansion of macro ‘copyObject’
Node *rawQuery = copyObject(copyStatement->query);
^~~~~~~~~~
src/pg_paxos.c:841:46: error: passing argument 1 of ‘pg_analyze_and_rewrite’ from incompatible pointer type [-Werror=incompatible-pointer-types]
List *queryList = pg_analyze_and_rewrite(rawQuery, queryString,
^~~~~~~~
In file included from /usr/local/pgsql/include/server/tcop/utility.h:17,
from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/tcopprot.h:51:14: note: expected ‘RawStmt *’ {aka ‘struct RawStmt *’} but argument is of type ‘Node *’ {aka ‘struct Node *’}
extern List *pg_analyze_and_rewrite(RawStmt *parsetree,
^~~~~~~~~~~~~~~~~~~~~~
src/pg_paxos.c:841:23: error: too few arguments to function ‘pg_analyze_and_rewrite’
List *queryList = pg_analyze_and_rewrite(rawQuery, queryString,
^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/pgsql/include/server/tcop/utility.h:17,
from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/tcopprot.h:51:14: note: declared here
extern List *pg_analyze_and_rewrite(RawStmt *parsetree,
^~~~~~~~~~~~~~~~~~~~~~
src/pg_paxos.c:864:30: error: passing argument 1 of ‘PreviousProcessUtilityHook’ from incompatible pointer type [-Werror=incompatible-pointer-types]
PreviousProcessUtilityHook(parsetree, queryString, context,
^~~~~~~~~
src/pg_paxos.c:864:30: note: expected ‘PlannedStmt *’ {aka ‘struct PlannedStmt *’} but argument is of type ‘Node *’ {aka ‘struct Node *’}
src/pg_paxos.c:865:20: error: passing argument 5 of ‘PreviousProcessUtilityHook’ from incompatible pointer type [-Werror=incompatible-pointer-types]
params, dest, completionTag);
^~~~
src/pg_paxos.c:865:20: note: expected ‘QueryEnvironment *’ {aka ‘struct QueryEnvironment *’} but argument is of type ‘DestReceiver *’ {aka ‘struct _DestReceiver *’}
src/pg_paxos.c:865:26: error: passing argument 6 of ‘PreviousProcessUtilityHook’ from incompatible pointer type [-Werror=incompatible-pointer-types]
params, dest, completionTag);
^~~~~~~~~~~~~
src/pg_paxos.c:865:26: note: expected ‘DestReceiver *’ {aka ‘struct _DestReceiver *’} but argument is of type ‘char *’
src/pg_paxos.c:864:3: error: too few arguments to function ‘PreviousProcessUtilityHook’
PreviousProcessUtilityHook(parsetree, queryString, context,
^~~~~~~~~~~~~~~~~~~~~~~~~~
src/pg_paxos.c:869:27: error: passing argument 1 of ‘standard_ProcessUtility’ from incompatible pointer type [-Werror=incompatible-pointer-types]
standard_ProcessUtility(parsetree, queryString, context,
^~~~~~~~~
In file included from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/utility.h:40:50: note: expected ‘PlannedStmt *’ {aka ‘struct PlannedStmt *’} but argument is of type ‘Node *’ {aka ‘struct Node *’}
extern void standard_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
~~~~~~~~~~~~~^~~~~
src/pg_paxos.c:870:17: error: passing argument 5 of ‘standard_ProcessUtility’ from incompatible pointer type [-Werror=incompatible-pointer-types]
params, dest, completionTag);
^~~~
In file included from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/utility.h:42:25: note: expected ‘QueryEnvironment *’ {aka ‘struct QueryEnvironment *’} but argument is of type ‘DestReceiver *’ {aka ‘struct _DestReceiver *’}
QueryEnvironment *queryEnv,
~~~~~~~~~~~~~~~~~~^~~~~~~~
src/pg_paxos.c:870:23: error: passing argument 6 of ‘standard_ProcessUtility’ from incompatible pointer type [-Werror=incompatible-pointer-types]
params, dest, completionTag);
^~~~~~~~~~~~~
In file included from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/utility.h:43:21: note: expected ‘DestReceiver *’ {aka ‘struct _DestReceiver *’} but argument is of type ‘char *’
DestReceiver *dest, char *completionTag);
~~~~~~~~~~~~~~^~~~
src/pg_paxos.c:869:3: error: too few arguments to function ‘standard_ProcessUtility’
standard_ProcessUtility(parsetree, queryString, context,
^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/pg_paxos.c:48:
/usr/local/pgsql/include/server/tcop/utility.h:40:13: note: declared here
extern void standard_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [/usr/local/pgsql/lib/pgxs/src/makefiles/../../src/Makefile.global:899: src/pg_paxos.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.