Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
maintenance
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0abe80fa
authored
May 21, 2023
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Memahami mirror status versi 9.1
1 parent
b70ab6ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
CHANGES.txt
maintenance/__init__.py
mirror_status/structure.py
CHANGES.txt
View file @
0abe80f
0.8.1 21-5-2023
---------------
- Memahami mirror status versi 9.1
0.8 16-5-2023
-------------
- Pemahaman konfigurasi mirror yang lebih baik
...
...
maintenance/__init__.py
View file @
0abe80f
...
...
@@ -112,6 +112,18 @@ def pg_port(conf_file):
def
is_mirror
(
pg_conf
):
r
=
Reader
(
pg_conf
)
if
'include_dir'
in
r
:
# Versi 12 - 15
conf_dir
=
os
.
path
.
split
(
pg_conf
)[
0
]
mirror_conf
=
os
.
path
.
join
(
conf_dir
,
r
[
'include_dir'
],
'recovery.conf'
)
if
os
.
path
.
exists
(
mirror_conf
):
return
True
# Versi 9.1 - 11
mirror_conf
=
os
.
path
.
join
(
r
[
'data_directory'
],
'recovery.conf'
)
if
os
.
path
.
exists
(
mirror_conf
):
return
True
if
'primary_conninfo'
in
r
:
return
True
port
=
r
[
'port'
]
# Versi 11 - 15
cmd_psql
=
f
'psql -p {port} -c "SHOW primary_conninfo"'
...
...
@@ -124,17 +136,6 @@ def is_mirror(pg_conf):
s
=
out
.
decode
(
'utf-8'
)
if
s
:
return
True
if
'include_dir'
in
r
:
# Versi 12 - 15
conf_dir
=
os
.
path
.
split
(
pg_conf
)[
0
]
mirror_conf
=
os
.
path
.
join
(
conf_dir
,
r
[
'include_dir'
],
'recovery.conf'
)
if
os
.
path
.
exists
(
mirror_conf
):
return
True
# Versi 9.1 - 11
mirror_conf
=
os
.
path
.
join
(
r
[
'data_directory'
],
'recovery.conf'
)
if
os
.
path
.
exists
(
mirror_conf
):
return
True
return
'recovery_target_timeline'
in
r
def
is_db_exists
(
version
,
port
,
db_name
):
...
...
mirror_status/structure.py
View file @
0abe80f
RE_PREFIX
=
r'([\d]*)-([\d]*)-([\d]*) ([\d]*):([\d]*):([\d]*).([\d]*) '
\
r'([A-Z]*) .([\d]*). '
# 2023-05-21 09:56:50.553 WIB [2429] LOG: streaming replication successfully
# connected to primary
# 2022-01-03 07:04:42.728 WIB [1268975] LOG: started streaming WAL from
# primary at 3/B6000000 on timeline 1
# 2023-05-09 07:29:49.335 WIB [3811560] DETAIL: Last completed transaction was
# at log time 2023-05-09 07:28:19.547035+07.
RE_OK
=
RE_PREFIX
+
'(LOG: started streaming WAL|DETAIL: Last completed)'
RE_OK
=
RE_PREFIX
+
'(LOG: streaming replication successfully|'
\
'LOG: started streaming WAL|DETAIL: Last completed)'
# 2022-01-03 07:04:10.757 WIB [1258171] FATAL: terminating walreceiver due to
# timeout
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment