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

Commit87e9fd5

Browse files
authored
Merge pull request#63 from postgrespro/support_rel14
Support rel14
2 parentsd9fba83 +0e6e6f0 commit87e9fd5

12 files changed

+95
-106
lines changed

‎.travis.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
sudo:required
1+
os:linux
2+
3+
dist:bionic
24

35
language:python
46

@@ -18,14 +20,15 @@ notifications:
1820
on_failure:always
1921

2022
env:
21-
-PYTHON_VERSION=2 PG_VERSION=10
22-
-PYTHON_VERSION=2 PG_VERSION=9.6
23-
-PYTHON_VERSION=2 PG_VERSION=9.5
24-
-PYTHON_VERSION=2 PG_VERSION=9.4
23+
-PYTHON_VERSION=3 PG_VERSION=14
2524
-PYTHON_VERSION=3 PG_VERSION=13
2625
-PYTHON_VERSION=3 PG_VERSION=12
2726
-PYTHON_VERSION=3 PG_VERSION=11
2827
-PYTHON_VERSION=3 PG_VERSION=10
29-
-PYTHON_VERSION=3 PG_VERSION=9.6
30-
-PYTHON_VERSION=3 PG_VERSION=9.5
31-
-PYTHON_VERSION=3 PG_VERSION=9.4
28+
# - PYTHON_VERSION=3 PG_VERSION=9.6
29+
# - PYTHON_VERSION=3 PG_VERSION=9.5
30+
# - PYTHON_VERSION=3 PG_VERSION=9.4
31+
# - PYTHON_VERSION=2 PG_VERSION=10
32+
# - PYTHON_VERSION=2 PG_VERSION=9.6
33+
# - PYTHON_VERSION=2 PG_VERSION=9.5
34+
# - PYTHON_VERSION=2 PG_VERSION=9.4

‎testgres/backup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class NodeBackup(object):
2929
"""
3030
Smart object responsible for backups
3131
"""
32-
3332
@property
3433
deflog_file(self):
3534
returnos.path.join(self.base_dir,BACKUP_LOG_FILE)

‎testgres/cache.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def cached_initdb(data_dir, logfile=None, params=None):
2525
"""
2626
Perform initdb or use cached node files.
2727
"""
28-
2928
defcall_initdb(initdb_dir,log=None):
3029
try:
3130
_params= [get_bin_path("initdb"),"-D",initdb_dir,"-N"]

‎testgres/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class GlobalConfig(object):
4343

4444
_cached_initdb_dir=None
4545
""" underlying class attribute for cached_initdb_dir property """
46-
4746
@property
4847
defcached_initdb_dir(self):
4948
""" path to a temp directory for cached initdb. """

‎testgres/connection.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class NodeConnection(object):
2828
"""
2929
Transaction wrapper returned by Node
3030
"""
31-
3231
def__init__(self,
3332
node,
3433
dbname=None,
@@ -42,12 +41,11 @@ def __init__(self,
4241

4342
self._node=node
4443

45-
self._connection=pglib.connect(
46-
database=dbname,
47-
user=username,
48-
password=password,
49-
host=node.host,
50-
port=node.port)
44+
self._connection=pglib.connect(database=dbname,
45+
user=username,
46+
password=password,
47+
host=node.host,
48+
port=node.port)
5149

5250
self._connection.autocommit=autocommit
5351
self._cursor=self.connection.cursor()

‎testgres/decorators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def method_decorator(decorator):
5050
"""
5151
Convert a function decorator into a method decorator.
5252
"""
53-
5453
def_dec(func):
5554
def_wrapper(self,*args,**kwargs):
5655
@decorator

‎testgres/logger.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class TestgresLogger(threading.Thread):
1010
"""
1111
Helper class to implement reading from log files.
1212
"""
13-
1413
def__init__(self,node_name,log_file_name):
1514
threading.Thread.__init__(self)
1615

‎testgres/node.py

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class ProcessProxy(object):
9191
process: wrapped psutill.Process object
9292
ptype: instance of ProcessType
9393
"""
94-
9594
def__init__(self,process,ptype=None):
9695
self.process=process
9796
self.ptype=ptypeorProcessType.from_process(process)
@@ -196,7 +195,6 @@ def auxiliary_processes(self):
196195
Returns a list of auxiliary processes.
197196
Each process is represented by :class:`.ProcessProxy` object.
198197
"""
199-
200198
defis_aux(process):
201199
returnprocess.ptype!=ProcessType.Unknown
202200

@@ -430,10 +428,9 @@ def init(self, initdb_params=None, **kwargs):
430428
"""
431429

432430
# initialize this PostgreSQL node
433-
cached_initdb(
434-
data_dir=self.data_dir,
435-
logfile=self.utils_log_file,
436-
params=initdb_params)
431+
cached_initdb(data_dir=self.data_dir,
432+
logfile=self.utils_log_file,
433+
params=initdb_params)
437434

438435
# initialize default config files
439436
self.default_conf(**kwargs)
@@ -480,8 +477,8 @@ def default_conf(self,
480477
ifallow_streaming:
481478
# get auth method for host or local users
482479
defget_auth_method(t):
483-
returnnext((s.split()[-1]forsinlines
484-
ifs.startswith(t)),'trust')
480+
returnnext((s.split()[-1]
481+
forsinlinesifs.startswith(t)),'trust')
485482

486483
# get auth methods
487484
auth_local=get_auth_method('local')
@@ -760,12 +757,11 @@ def promote(self, dbname=None, username=None):
760757
ifself._pg_version<'10':
761758
check_query="SELECT pg_is_in_recovery()"
762759

763-
self.poll_query_until(
764-
query=check_query,
765-
expected=False,
766-
dbname=dbname,
767-
username=username,
768-
max_attempts=0)# infinite
760+
self.poll_query_until(query=check_query,
761+
expected=False,
762+
dbname=dbname,
763+
username=username,
764+
max_attempts=0)# infinite
769765

770766
# node becomes master itself
771767
self._master=None
@@ -884,11 +880,10 @@ def psql(self,
884880
psql_params.append(dbname)
885881

886882
# start psql process
887-
process=subprocess.Popen(
888-
psql_params,
889-
stdin=subprocess.PIPE,
890-
stdout=subprocess.PIPE,
891-
stderr=subprocess.PIPE)
883+
process=subprocess.Popen(psql_params,
884+
stdin=subprocess.PIPE,
885+
stdout=subprocess.PIPE,
886+
stderr=subprocess.PIPE)
892887

893888
# wait until it finishes and get stdout and stderr
894889
out,err=process.communicate(input=input)
@@ -1043,11 +1038,10 @@ def poll_query_until(self,
10431038
attempts=0
10441039
whilemax_attempts==0orattempts<max_attempts:
10451040
try:
1046-
res=self.execute(
1047-
dbname=dbname,
1048-
query=query,
1049-
username=username,
1050-
commit=commit)
1041+
res=self.execute(dbname=dbname,
1042+
query=query,
1043+
username=username,
1044+
commit=commit)
10511045

10521046
ifexpectedisNoneandresisNone:
10531047
return# done
@@ -1165,8 +1159,8 @@ def set_synchronous_standbys(self, standbys):
11651159
standbys=First(1,standbys)
11661160
else:
11671161
ifisinstance(standbys,Iterable):
1168-
standbys=u", ".join(
1169-
u"\"{}\"".format(r.name)forrinstandbys)
1162+
standbys=u", ".join(u"\"{}\"".format(r.name)
1163+
forrinstandbys)
11701164
else:
11711165
raiseTestgresException("Feature isn't supported in "
11721166
"Postgres 9.5 and below")
@@ -1195,11 +1189,10 @@ def catchup(self, dbname=None, username=None):
11951189
username=username)[0][0]# yapf: disable
11961190

11971191
# wait until this LSN reaches replica
1198-
self.poll_query_until(
1199-
query=wait_lsn.format(lsn),
1200-
dbname=dbname,
1201-
username=username,
1202-
max_attempts=0)# infinite
1192+
self.poll_query_until(query=wait_lsn.format(lsn),
1193+
dbname=dbname,
1194+
username=username,
1195+
max_attempts=0)# infinite
12031196
exceptExceptionase:
12041197
raise_from(CatchUpException("Failed to catch up",poll_lsn),e)
12051198

@@ -1215,7 +1208,11 @@ def publish(self, name, **kwargs):
12151208
"""
12161209
returnPublication(name=name,node=self,**kwargs)
12171210

1218-
defsubscribe(self,publication,name,dbname=None,username=None,
1211+
defsubscribe(self,
1212+
publication,
1213+
name,
1214+
dbname=None,
1215+
username=None,
12191216
**params):
12201217
"""
12211218
Create subscription for logical replication

‎testgres/pubsub.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ def drop(self, dbname=None, username=None):
7777
"""
7878
Drop publication
7979
"""
80-
self.node.execute(
81-
"drop publication {}".format(self.name),
82-
dbname=dbname,
83-
username=username)
80+
self.node.execute("drop publication {}".format(self.name),
81+
dbname=dbname,
82+
username=username)
8483

8584
defadd_tables(self,tables,dbname=None,username=None):
8685
"""
@@ -94,10 +93,9 @@ def add_tables(self, tables, dbname=None, username=None):
9493
raiseValueError("Tables list is empty")
9594

9695
query="alter publication {} add table {}"
97-
self.node.execute(
98-
query.format(self.name,", ".join(tables)),
99-
dbname=dbnameorself.dbname,
100-
username=usernameorself.username)
96+
self.node.execute(query.format(self.name,", ".join(tables)),
97+
dbname=dbnameorself.dbname,
98+
username=usernameorself.username)
10199

102100

103101
classSubscription(object):
@@ -165,19 +163,17 @@ def refresh(self, copy_data=True, dbname=None, username=None):
165163
Disables the running subscription.
166164
"""
167165
query="alter subscription {} refresh publication with (copy_data={})"
168-
self.node.execute(
169-
query.format(self.name,copy_data),
170-
dbname=dbname,
171-
username=username)
166+
self.node.execute(query.format(self.name,copy_data),
167+
dbname=dbname,
168+
username=username)
172169

173170
defdrop(self,dbname=None,username=None):
174171
"""
175172
Drops subscription
176173
"""
177-
self.node.execute(
178-
"drop subscription {}".format(self.name),
179-
dbname=dbname,
180-
username=username)
174+
self.node.execute("drop subscription {}".format(self.name),
175+
dbname=dbname,
176+
username=username)
181177

182178
defcatchup(self,username=None):
183179
"""
@@ -191,7 +187,9 @@ def catchup(self, username=None):
191187
dbname=None,
192188
username=None)[0][0]# yapf: disable
193189
# create dummy xact, as LR replicates only on commit.
194-
self.pub.node.execute(query="select txid_current()",dbname=None,username=None)
190+
self.pub.node.execute(query="select txid_current()",
191+
dbname=None,
192+
username=None)
195193
query="""
196194
select '{}'::pg_lsn - replay_lsn <= 0
197195
from pg_catalog.pg_stat_replication where application_name = '{}'

‎testgres/standby.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ class First:
1616
standbys (:obj:`list` of :class:`.PostgresNode`): the list of standby
1717
nodes
1818
"""
19-
2019
def__init__(self,sync_num,standbys):
2120
self.sync_num=sync_num
2221
self.standbys=standbys
2322

2423
def__str__(self):
25-
returnu"{} ({})".format(self.sync_num,u", ".join(
26-
u"\"{}\"".format(r.name)forrinself.standbys))
24+
returnu"{} ({})".format(
25+
self.sync_num,
26+
u", ".join(u"\"{}\"".format(r.name)forrinself.standbys))
2727

2828

2929
@six.python_2_unicode_compatible
@@ -39,11 +39,11 @@ class Any:
3939
standbys (:obj:`list` of :class:`.PostgresNode`): the list of standby
4040
nodes
4141
"""
42-
4342
def__init__(self,sync_num,standbys):
4443
self.sync_num=sync_num
4544
self.standbys=standbys
4645

4746
def__str__(self):
48-
returnu"ANY {} ({})".format(self.sync_num,u", ".join(
49-
u"\"{}\"".format(r.name)forrinself.standbys))
47+
returnu"ANY {} ({})".format(
48+
self.sync_num,
49+
u", ".join(u"\"{}\"".format(r.name)forrinself.standbys))

‎testgres/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ def execute_utility(args, logfile=None):
6767
process=subprocess.Popen(
6868
args,# util + params
6969
stdout=buf,
70-
stderr=subprocess.STDOUT
71-
)
70+
stderr=subprocess.STDOUT)
7271
process.communicate()
7372

7473
# get result
@@ -110,8 +109,10 @@ def execute_utility(args, logfile=None):
110109
exit_code=process.returncode
111110
ifexit_code:
112111
message='Utility exited with non-zero code'
113-
raiseExecUtilException(
114-
message=message,command=command,exit_code=exit_code,out=out)
112+
raiseExecUtilException(message=message,
113+
command=command,
114+
exit_code=exit_code,
115+
out=out)
115116

116117
returnout
117118

@@ -150,7 +151,6 @@ def get_pg_config(pg_config_path=None):
150151
Return output of pg_config (provided that it is installed).
151152
NOTE: this fuction caches the result by default (see GlobalConfig).
152153
"""
153-
154154
defcache_pg_config_data(cmd):
155155
# execute pg_config and get the output
156156
out=subprocess.check_output([cmd]).decode('utf-8')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp