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

Commitb130956

Browse files
committed
Merge branch 'PGPROEE9_6_MULTIMASTER' ofhttps://gitlab.postgrespro.ru/pgpro-dev/postgrespro into PGPROEE9_6_MULTIMASTER
Conflicts:contrib/mmts/tests2/lib/bank_client.py
2 parentsdb73fd8 +73df8e9 commitb130956

File tree

21 files changed

+321
-291
lines changed

21 files changed

+321
-291
lines changed

‎configure

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9898,9 +9898,9 @@ done
98989898
fi
98999899

99009900
if test "$with_icu" = yes ; then
9901-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containingucol_open_58" >&5
9902-
$as_echo_n "checking for library containingucol_open_58... " >&6; }
9903-
if ${ac_cv_search_ucol_open_58+:} false; then :
9901+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containingucol_open" >&5
9902+
$as_echo_n "checking for library containingucol_open... " >&6; }
9903+
if ${ac_cv_search_ucol_open+:} false; then :
99049904
$as_echo_n "(cached) " >&6
99059905
else
99069906
ac_func_search_save_LIBS=$LIBS
@@ -9913,11 +9913,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
99139913
#ifdef __cplusplus
99149914
extern "C"
99159915
#endif
9916-
charucol_open_58 ();
9916+
charucol_open ();
99179917
int
99189918
main ()
99199919
{
9920-
returnucol_open_58 ();
9920+
returnucol_open ();
99219921
;
99229922
return 0;
99239923
}
@@ -9930,25 +9930,25 @@ for ac_lib in '' icui18n icuin; do
99309930
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
99319931
fi
99329932
if ac_fn_c_try_link "$LINENO"; then :
9933-
ac_cv_search_ucol_open_58=$ac_res
9933+
ac_cv_search_ucol_open=$ac_res
99349934
fi
99359935
rm -f core conftest.err conftest.$ac_objext \
99369936
conftest$ac_exeext
9937-
if ${ac_cv_search_ucol_open_58+:} false; then :
9937+
if ${ac_cv_search_ucol_open+:} false; then :
99389938
break
99399939
fi
99409940
done
9941-
if ${ac_cv_search_ucol_open_58+:} false; then :
9941+
if ${ac_cv_search_ucol_open+:} false; then :
99429942

99439943
else
9944-
ac_cv_search_ucol_open_58=no
9944+
ac_cv_search_ucol_open=no
99459945
fi
99469946
rm conftest.$ac_ext
99479947
LIBS=$ac_func_search_save_LIBS
99489948
fi
9949-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ucol_open_58" >&5
9950-
$as_echo "$ac_cv_search_ucol_open_58" >&6; }
9951-
ac_res=$ac_cv_search_ucol_open_58
9949+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ucol_open" >&5
9950+
$as_echo "$ac_cv_search_ucol_open" >&6; }
9951+
ac_res=$ac_cv_search_ucol_open
99529952
if test "$ac_res" != no; then :
99539953
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
99549954

@@ -10959,9 +10959,9 @@ fi
1095910959

1096010960
fi
1096110961

10962-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking forucnv_fromUChars_58 in -licuuc" >&5
10963-
$as_echo_n "checking forucnv_fromUChars_58 in -licuuc... " >&6; }
10964-
if ${ac_cv_lib_icuuc_ucnv_fromUChars_58+:} false; then :
10962+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking forucnv_fromUChars in -licuuc" >&5
10963+
$as_echo_n "checking forucnv_fromUChars in -licuuc... " >&6; }
10964+
if ${ac_cv_lib_icuuc_ucnv_fromUChars+:} false; then :
1096510965
$as_echo_n "(cached) " >&6
1096610966
else
1096710967
ac_check_lib_save_LIBS=$LIBS
@@ -10975,27 +10975,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1097510975
#ifdef __cplusplus
1097610976
extern "C"
1097710977
#endif
10978-
charucnv_fromUChars_58 ();
10978+
charucnv_fromUChars ();
1097910979
int
1098010980
main ()
1098110981
{
10982-
returnucnv_fromUChars_58 ();
10982+
returnucnv_fromUChars ();
1098310983
;
1098410984
return 0;
1098510985
}
1098610986
_ACEOF
1098710987
if ac_fn_c_try_link "$LINENO"; then :
10988-
ac_cv_lib_icuuc_ucnv_fromUChars_58=yes
10988+
ac_cv_lib_icuuc_ucnv_fromUChars=yes
1098910989
else
10990-
ac_cv_lib_icuuc_ucnv_fromUChars_58=no
10990+
ac_cv_lib_icuuc_ucnv_fromUChars=no
1099110991
fi
1099210992
rm -f core conftest.err conftest.$ac_objext \
1099310993
conftest$ac_exeext conftest.$ac_ext
1099410994
LIBS=$ac_check_lib_save_LIBS
1099510995
fi
10996-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_icuuc_ucnv_fromUChars_58" >&5
10997-
$as_echo "$ac_cv_lib_icuuc_ucnv_fromUChars_58" >&6; }
10998-
if test "x$ac_cv_lib_icuuc_ucnv_fromUChars_58" = xyes; then :
10996+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_icuuc_ucnv_fromUChars" >&5
10997+
$as_echo "$ac_cv_lib_icuuc_ucnv_fromUChars" >&6; }
10998+
if test "x$ac_cv_lib_icuuc_ucnv_fromUChars" = xyes; then :
1099910999
cat >>confdefs.h <<_ACEOF
1100011000
#define HAVE_LIBICUUC 1
1100111001
_ACEOF

‎configure.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ if test "$with_openssl" = yes ; then
11621162
fi
11631163

11641164
if test "$with_icu" = yes ; then
1165-
AC_SEARCH_LIBS(ucol_open_58, [icui18n icuin], [], [
1165+
AC_SEARCH_LIBS(ucol_open, [icui18n icuin], [], [
11661166
AC_SEARCH_LIBS(ucol_open_57, [icui18n icuin], [], [
11671167
AC_SEARCH_LIBS(ucol_open_56, [icui18n icuin], [], [
11681168
AC_SEARCH_LIBS(ucol_open_55, [icui18n icuin], [], [
@@ -1197,7 +1197,7 @@ if test "$with_icu" = yes ; then
11971197
])
11981198
])
11991199
])
1200-
AC_CHECK_LIB(icuuc,ucnv_fromUChars_58, [], [
1200+
AC_CHECK_LIB(icuuc,ucnv_fromUChars, [], [
12011201
AC_CHECK_LIB(icuuc, ucnv_fromUChars_57, [], [
12021202
AC_CHECK_LIB(icuuc, ucnv_fromUChars_56, [], [
12031203
AC_CHECK_LIB(icuuc, ucnv_fromUChars_55, [], [

‎contrib/mmts/tests2/lib/bank_client.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,24 @@ def initdb(self):
109109
cur.close()
110110
conn.close()
111111

112+
defis_data_identic(self):
113+
hashes=set()
114+
115+
fordsninself.dsns:
116+
con=psycopg2.connect(dsn)
117+
cur=con.cursor()
118+
cur.execute("""
119+
select
120+
md5('(' || string_agg(uid::text || ', ' || amount::text , '),(') || ')')
121+
from
122+
(select * from bank_test order by uid) t;""")
123+
hashes.add(cur.fetchone()[0])
124+
cur.close()
125+
con.close()
126+
127+
print(hashes)
128+
return (len(hashes)==1)
129+
112130
@asyncio.coroutine
113131
defstatus(self):
114132
whileself.running:
@@ -167,7 +185,7 @@ def exec_tx(self, tx_block, aggname_prefix, conn_i):
167185
# back to event loop and block it
168186
yieldfromasyncio.sleep(0.01)
169187
exceptBaseExceptionase:
170-
print('Catch exception: ',e)
188+
print('Catch exception: ',str(e).strip())
171189
agg.finish_tx(str(e).strip())
172190
# Give evloop some free time.
173191
# In case of continuous excetions we can loop here without returning

‎contrib/mmts/tests2/test_recovery.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def performFailure(self, failure):
6868
classRecoveryTest(unittest.TestCase,TestHelper):
6969

7070
@classmethod
71-
defsetUpClass(self):
71+
defsetUpClass(cls):
7272
subprocess.check_call(['docker-compose','up',
7373
'--force-recreate',
7474
'--build',
@@ -77,17 +77,21 @@ def setUpClass(self):
7777
# XXX: add normal wait here
7878
time.sleep(TEST_SETUP_TIME)
7979

80-
self.client=MtmClient([
80+
cls.client=MtmClient([
8181
"dbname=regression user=postgres host=127.0.0.1 port=15432",
8282
"dbname=regression user=postgres host=127.0.0.1 port=15433",
8383
"dbname=regression user=postgres host=127.0.0.1 port=15434"
8484
],n_accounts=1000)
85-
self.client.bgrun()
85+
cls.client.bgrun()
8686

8787
@classmethod
88-
deftearDownClass(self):
88+
deftearDownClass(cls):
8989
print('tearDown')
90-
self.client.stop()
90+
cls.client.stop()
91+
92+
ifnotcls.client.is_data_identic():
93+
raiseAssertionError('Different data on nodes')
94+
9195
# XXX: check nodes data identity here
9296
# subprocess.check_call(['docker-compose','down'])
9397

‎contrib/pgpro_scheduler/pgpro_scheduler--1.0.sql

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,11 +1056,6 @@ CREATE FUNCTION schedule.cron2jsontext(CSTRING)
10561056
AS'MODULE_PATHNAME','cron_string_to_json_text'
10571057
LANGUAGE C IMMUTABLE;
10581058

1059-
CREATEFUNCTIONtemp_now(timestamp with time zone)
1060-
RETURNStimestamp with time zone
1061-
AS'MODULE_PATHNAME','temp_now'
1062-
LANGUAGE C IMMUTABLE;
1063-
10641059
--------------
10651060
-- TRIGGERS --
10661061
--------------

‎contrib/pgpro_scheduler/src/cron_string.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include<stdarg.h>
55
#include"cron_string.h"
66
#include"postgres.h"
7+
#include"c.h"
78
#include"port.h"
89

910

‎contrib/pgpro_scheduler/src/cron_string.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include<stdlib.h>
66
#include<string.h>
77
#include<stdarg.h>
8+
#include"postgres.h"
9+
#include"port.h"
810

911
externintcps_error;
1012

@@ -41,11 +43,7 @@ typedef struct {
4143
}cron_ent_t;
4244

4345
voiddestroyCronEnt(cron_ent_t*);
44-
void_cps_set_error(intnum,constchar*message, ...)
45-
#ifdef__GNUC__
46-
__attribute__ ((format (gnu_printf,2,3)))
47-
#endif
48-
;;
46+
void_cps_set_error(intnum,constchar*message, ...)pg_attribute_printf(2,3);
4947
char*get_cps_error(void);
5048
int_cps_string_has(char*str,charc);
5149
char*_cps_append_string(char*str,char*to_add);

‎contrib/pgpro_scheduler/src/pgpro_scheduler.c

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@
1414
#include"pg_config.h"
1515
#include"fmgr.h"
1616
#include"pgstat.h"
17-
#include"utils/builtins.h"
1817
#include"executor/spi.h"
1918
#include"tcop/utility.h"
2019
#include"lib/stringinfo.h"
20+
#include"catalog/pg_type.h"
2121
#include"access/xact.h"
2222
#include"utils/snapmgr.h"
2323
#include"utils/datetime.h"
24+
#include"utils/builtins.h"
2425
#include"catalog/pg_db_role_setting.h"
2526
#include"commands/dbcommands.h"
2627

28+
2729
#include"char_array.h"
2830
#include"sched_manager_poll.h"
2931
#include"cron_string.h"
@@ -280,6 +282,7 @@ void parent_scheduler_main(Datum arg)
280282
boolrefresh= false;
281283

282284
init_worker_mem_ctx("Parent scheduler context");
285+
elog(LOG,"Start PostgresPro scheduler.");
283286

284287
/*CurrentResourceOwner = ResourceOwnerCreate(NULL, "pgpro_scheduler");*/
285288
SetConfigOption("application_name","pgp-s supervisor",PGC_USERSET,PGC_S_SESSION);
@@ -381,8 +384,6 @@ pg_scheduler_startup(void)
381384
{
382385
BackgroundWorkerworker;
383386

384-
elog(LOG,"Start PostgresPro scheduler.");
385-
386387
worker.bgw_flags=BGWORKER_SHMEM_ACCESS |
387388
BGWORKER_BACKEND_DATABASE_CONNECTION;
388389
worker.bgw_start_time=BgWorkerStart_ConsistentState;
@@ -483,52 +484,6 @@ void _PG_init(void)
483484
pg_scheduler_startup();
484485
}
485486

486-
PG_FUNCTION_INFO_V1(temp_now);
487-
Datum
488-
temp_now(PG_FUNCTION_ARGS)
489-
{
490-
TimestampTzts;
491-
structpg_tminfo;
492-
structpg_tmcp;
493-
inttz;
494-
fsec_tfsec;
495-
constchar*tzn;
496-
longinttoff=0;
497-
498-
if(!PG_ARGISNULL(0))
499-
{
500-
ts=PG_GETARG_TIMESTAMPTZ(0);
501-
}
502-
else
503-
{
504-
ts=GetCurrentTimestamp();
505-
}
506-
507-
timestamp2tm(ts,&tz,&info,&fsec,&tzn,session_timezone );
508-
info.tm_wday=j2day(date2j(info.tm_year,info.tm_mon,info.tm_mday));
509-
510-
/*elog(NOTICE, "WDAY: %d, MON: %d, MDAY: %d, HOUR: %d, MIN: %d, YEAR: %d (%ld)",
511-
info.tm_wday, info.tm_mon, info.tm_mday, info.tm_hour, info.tm_min,
512-
info.tm_year, info.tm_gmtoff);
513-
elog(NOTICE, "TZP: %d, ZONE: %s", tz, tzn); */
514-
515-
cp.tm_mon=info.tm_mon;
516-
cp.tm_mday=info.tm_mday;
517-
cp.tm_hour=info.tm_hour;
518-
cp.tm_min=info.tm_min;
519-
cp.tm_year=info.tm_year;
520-
cp.tm_sec=info.tm_sec;
521-
522-
toff=DetermineTimeZoneOffset(&cp,session_timezone);
523-
/*elog(NOTICE, "Detect: offset = %ld", toff); */
524-
525-
cp.tm_gmtoff=-toff;
526-
tm2timestamp(&cp,0,&tz,&ts);
527-
528-
529-
PG_RETURN_TIMESTAMPTZ(ts);
530-
}
531-
532487
PG_FUNCTION_INFO_V1(cron_string_to_json_text);
533488
Datum
534489
cron_string_to_json_text(PG_FUNCTION_ARGS)
@@ -567,6 +522,7 @@ cron_string_to_json_text(PG_FUNCTION_ARGS)
567522
elog(ERROR,"unknown error: %d",cps_error);
568523
}
569524
}
525+
PG_RETURN_NULL();
570526
}
571527

572528

‎contrib/pgpro_scheduler/src/scheduler_job.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include<stdarg.h>
88
#include"utils/timestamp.h"
99
#include"memutils.h"
10+
#include"c.h"
11+
#include"port.h"
1012

1113
typedefstruct {
1214
intcron_id;
@@ -30,11 +32,7 @@ typedef struct {
3032
job_t*init_scheduler_job(job_t*j);
3133
job_t*get_expired_jobs(char*nodename,int*n,int*is_error);
3234
job_t*get_jobs_to_do(char*nodename,int*n,int*is_error);
33-
job_t*set_job_error(job_t*j,constchar*fmt, ...)
34-
#ifdef__GNUC__
35-
__attribute__ ((format (gnu_printf,2,3)));
36-
#endif
37-
;
35+
job_t*set_job_error(job_t*j,constchar*fmt, ...)pg_attribute_printf(2,3);
3836
intmove_job_to_log(job_t*j,boolstatus);
3937
voiddestroy_job(job_t*j,intselfdestroy);
4038

‎contrib/sr_plan/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ endif
2323

2424
genparser:
2525
#test -d sr_plan_env ||
26-
python gen_parser.py nodes.h `pg_config --includedir-server`
26+
python gen_parser.py nodes.h `$(PG_CONFIG) --includedir-server`

‎contrib/sr_plan/sr_plan.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ PlannedStmt *sr_planner(Query *parse,
6060
boolfind_ok= false;
6161
LOCKMODEheap_lock=AccessShareLock;
6262
Oidquery_index_rel_oid;
63+
Oidsr_plans_oid;
6364
IndexScanDescquery_index_scan;
6465
ScanKeyDatakey;
6566

@@ -81,11 +82,19 @@ PlannedStmt *sr_planner(Query *parse,
8182
sr_query_walker((Query*)parse,NULL);
8283

8384
sr_plans_table_rv=makeRangeVar("public","sr_plans",-1);
84-
sr_plans_heap=heap_openrv(sr_plans_table_rv,heap_lock);
85+
/* First check existance of "sr_plans" table */
86+
sr_plans_oid=RangeVarGetRelid(sr_plans_table_rv,heap_lock, true);
87+
if (!OidIsValid(sr_plans_oid))
88+
/* Just call standard_planner() if table doesn't exist. */
89+
returnstandard_planner(parse,cursorOptions,boundParams);
90+
91+
/* Table "sr_plans" exists */
92+
sr_plans_heap=heap_open(sr_plans_oid,NoLock);
8593

8694
query_index_rel_oid=DatumGetObjectId(DirectFunctionCall1(to_regclass,PointerGetDatum(cstring_to_text("sr_plans_query_hash_idx"))));
8795
if (query_index_rel_oid==InvalidOid)
8896
{
97+
heap_close(sr_plans_heap,heap_lock);
8998
elog(WARNING,"Not found sr_plans_query_hash_idx index");
9099
returnstandard_planner(parse,cursorOptions,boundParams);
91100
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp