Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1dc7b7f

Browse files
committed
Merge branch 'PGPROEE9_6' into PGPROEE9_6_RDMA
2 parents4021726 +30dc23f commit1dc7b7f

File tree

3 files changed

+43
-30
lines changed

3 files changed

+43
-30
lines changed

‎.ci/build_and_test_world

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/sh
2-
2+
if [-z"$TCLCONFIG" ];then
3+
[-x /usr/lib/tcl8.5/tclConfig.sh ]&& TCLCONFIG=/usr/lib/tcl8.5
4+
[-x /usr/lib/tcl8.6/tclConfig.sh ]&& TCLCONFIG=/usr/lib/tcl8.6
5+
fi
6+
[-n"$TCLCONFIG" ]&&export TCLCONFIG
7+
echo TCLCONFIG=${TCLCONFIG}
38
#
49
# script which exececutes all the build stages. If script executed with
510
# no arguments and something fails, every bit of logs, stack traces and

‎contrib/mmts/multimaster--1.0.sql

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ CREATE TABLE IF NOT EXISTS mtm.local_tables(rel_schema text, rel_name text, prim
8787
CREATE OR REPLACEFUNCTIONmtm.alter_sequences() RETURNSbooleanAS
8888
$$
8989
DECLARE
90-
seq_classpg_class%rowtype;
90+
seq_classrecord;
9191
seq_tuple record;
9292
node_idint;
9393
max_nodesint;
@@ -97,25 +97,20 @@ BEGIN
9797
select current_setting('multimaster.max_nodes') into max_nodes;
9898
select id,"allNodes" into node_idfrommtm.get_cluster_state();
9999
FOR seq_classIN
100-
SELECT*FROM pg_classWHEREpg_class.relkind='S'
100+
SELECT'"'||ns.nspname||'"."'||seq.relname||'"'as seqnameFROMpg_namespace ns,pg_classseqWHEREseq.relkind='S'andseq.relnamespace=ns.oid
101101
LOOP
102-
BEGIN
103-
EXECUTE'select * from'||seq_class.relname||';' INTO seq_tuple;
102+
EXECUTE'select * from'||seq_class.seqname INTO seq_tuple;
104103
IFseq_tuple.increment_by!= max_nodes THEN
105104
altered := true;
106105
RAISE NOTICE'Altering step for sequence % to %.',seq_tuple.sequence_name, max_nodes;
107-
EXECUTE'ALTER SEQUENCE'||seq_class.relname||' INCREMENT BY'|| max_nodes||';';
106+
EXECUTE'ALTER SEQUENCE'||seq_class.seqname||' INCREMENT BY'|| max_nodes||';';
108107
END IF;
109108
IF (seq_tuple.last_value % max_nodes)!= node_id THEN
110109
altered := true;
111110
new_start := (seq_tuple.last_value/ max_nodes+1)*max_nodes+ node_id;
112111
RAISE NOTICE'Altering start for sequence % to %.',seq_tuple.sequence_name, new_start;
113-
EXECUTE'ALTER SEQUENCE'||seq_class.relname||' RESTART WITH'|| new_start||';';
112+
EXECUTE'ALTER SEQUENCE'||seq_class.seqname||' RESTART WITH'|| new_start||';';
114113
END IF;
115-
EXCEPTION
116-
WHEN OTHERS THEN
117-
RAISE NOTICE'Failed to alter sequence %s',seq_class.relname;
118-
END;
119114
END LOOP;
120115
IF altered= false THEN
121116
RAISE NOTICE'All found sequnces have proper params.';
@@ -125,4 +120,4 @@ END
125120
$$
126121
LANGUAGE plpgsql;
127122

128-
selectmtm.alter_sequences();
123+
--select mtm.alter_sequences();

‎contrib/mmts/multimaster.c

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include"access/htup_details.h"
6363
#include"catalog/indexing.h"
6464
#include"catalog/namespace.h"
65+
#include"catalog/pg_constraint_fn.h"
6566
#include"pglogical_output/hooks.h"
6667
#include"parser/analyze.h"
6768
#include"parser/parse_relation.h"
@@ -2144,7 +2145,9 @@ static void
21442145
MtmLockCluster(void)
21452146
{
21462147
timestamp_tdelay=MIN_WAIT_TIMEOUT;
2147-
Assert(!MtmClusterLocked);
2148+
if (MtmClusterLocked) {
2149+
MtmUnlockCluster();
2150+
}
21482151
MtmLock(LW_EXCLUSIVE);
21492152
if (BIT_CHECK(Mtm->originLockNodeMask,MtmNodeId-1)) {
21502153
elog(ERROR,"There is already pending exclusive lock");
@@ -4890,8 +4893,8 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
48904893
boolskipCommand= false;
48914894
boolexecuted= false;
48924895

4893-
MTM_LOG3("%d: Process utility statement tag=%d, context=%d, issubtrans=%d, query=%s",
4894-
MyProcPid,nodeTag(parsetree),context,IsSubTransaction(),queryString);
4896+
MTM_LOG2("%d: Process utility statement tag=%d, context=%d, issubtrans=%d, creating_extension=%d, query=%s",
4897+
MyProcPid,nodeTag(parsetree),context,IsSubTransaction(),creating_extension,queryString);
48954898
switch (nodeTag(parsetree))
48964899
{
48974900
caseT_TransactionStmt:
@@ -5144,24 +5147,14 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
51445147
break;
51455148
}
51465149

5147-
/* XXX: dirty. Clear on new tx */
5148-
/* Some "black magic here":( We want to avoid redundant execution of utility statement by ProcessUtilitySlow (which is done with PROCESS_UTILITY_SUBCOMMAND).
5149-
* But if we allow only PROCESS_UTILITY_TOPLEVEL context, then we will not replicated DDL inside dynamic queries in plpgsql functions (see https://jira.postgrespro.ru/browse/CORE-526).
5150-
* If we disable only PROCESS_UTILITY_SUBCOMMAND, then we will get problems with "create extension" which is executed also in PROCESS_UTILITY_QUERY context.
5151-
* So workaround at this moment is to treat extension as special case.
5152-
* TODO: try to find right solution and rewrite this dummy check.
5153-
*/
5154-
if (!skipCommand&& (context==PROCESS_UTILITY_TOPLEVEL|| (context==PROCESS_UTILITY_QUERY&& !creating_extension)||MtmUtilityProcessedInXid!=GetCurrentTransactionId()))
5155-
MtmUtilityProcessedInXid=InvalidTransactionId;
5156-
5157-
if (!skipCommand&& !MtmTx.isReplicated&& (MtmUtilityProcessedInXid==InvalidTransactionId)) {
5150+
if (!skipCommand&& !MtmTx.isReplicated&& (context==PROCESS_UTILITY_TOPLEVEL||MtmUtilityProcessedInXid!=GetCurrentTransactionId()))
5151+
{
51585152
MtmUtilityProcessedInXid=GetCurrentTransactionId();
5159-
5160-
if (context==PROCESS_UTILITY_TOPLEVEL)
5153+
if (context==PROCESS_UTILITY_TOPLEVEL) {
51615154
MtmProcessDDLCommand(queryString, true);
5162-
else
5155+
}else {
51635156
MtmProcessDDLCommand(ActivePortal->sourceText, true);
5164-
5157+
}
51655158
executed= true;
51665159
}
51675160

@@ -5191,6 +5184,26 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
51915184
{
51925185
MtmFinishDDLCommand();
51935186
}
5187+
if (nodeTag(parsetree)==T_CreateStmt)
5188+
{
5189+
CreateStmt*create= (CreateStmt*)parsetree;
5190+
Oidrelid=RangeVarGetRelid(create->relation,NoLock, true);
5191+
if (relid!=InvalidOid) {
5192+
Oidconstraint_oid;
5193+
Bitmapset*pk=get_primary_key_attnos(relid, true,&constraint_oid);
5194+
if (pk==NULL&& !MtmVolksWagenMode) {
5195+
elog(WARNING,
5196+
MtmIgnoreTablesWithoutPk
5197+
?"Table %s.%s without primary will not be replicated"
5198+
:"Updates and deletes of table %s.%s without primary will not be replicated",
5199+
create->relation->schemaname ?create->relation->schemaname :"public",
5200+
create->relation->relname);
5201+
}
5202+
}
5203+
}
5204+
if (context==PROCESS_UTILITY_TOPLEVEL) {
5205+
MtmUtilityProcessedInXid=InvalidTransactionId;
5206+
}
51945207
}
51955208

51965209
staticvoid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp