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

Fix error 'Is another postmaster already running on port XXX'#120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
MetalDream666 merged 1 commit intomasterfromfix-already-used-port-startup-error
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -726,14 +726,30 @@ def start(self, params=[], wait=True):
"start"
] + params # yapf: disable

try:
exit_status, out, error = execute_utility(_params, self.utils_log_file, verbose=True)
if error and 'does not exist' in error:
raise Exception
except Exception as e:
msg = 'Cannot start node'
files = self._collect_special_files()
raise_from(StartNodeException(msg, files), e)
startup_retries = 5
while True:
try:
exit_status, out, error = execute_utility(_params, self.utils_log_file, verbose=True)
if error and 'does not exist' in error:
raise Exception
except Exception as e:
files = self._collect_special_files()
if any(len(file) > 1 and 'Is another postmaster already '
'running on port' in file[1].decode() for
file in files):
print("Detected an issue with connecting to port {0}. "
"Trying another port after a 5-second sleep...".format(self.port))
self.port = reserve_port()
options = {}
options['port'] = str(self.port)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

flake8 упал

  • flake8 .
    ./build/lib/testgres/node.py:737:21: F821 undefined name 'options'
    ./build/lib/testgres/node.py:738:40: F821 undefined name 'options'
    ./testgres/node.py:737:21: F821 undefined name 'options'
    ./testgres/node.py:738:40: F821 undefined name 'options'

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Переделала, тесты прошли

self.set_auto_conf(options)
startup_retries -= 1
time.sleep(5)
continue

msg = 'Cannot start node'
raise_from(StartNodeException(msg, files), e)
break
self._maybe_start_logger()
self.is_started = True
return self
Expand Down
8 changes: 8 additions & 0 deletionstests/test_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1033,6 +1033,14 @@ def test_parse_pg_version(self):
# Macos
assert parse_pg_version("postgres (PostgreSQL) 14.9 (Homebrew)") == "14.9"

def test_the_same_port(self):
with get_new_node() as node:
node.init().start()

with get_new_node() as node2:
node2.port = node.port
node2.init().start()


if __name__ == '__main__':
if os.environ.get('ALT_CONFIG'):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp