Skip to content

Commit 3e5bdac

Browse files
Arushi-07copybara-github
authored andcommitted
Logging postgresql status after restart
PiperOrigin-RevId: 716313976
1 parent af0d381 commit 3e5bdac

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

perfkitbenchmarker/linux_packages/postgresql16.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,12 @@ def ConfigureAndRestart(vm, run_uri, buffer_size):
247247
)
248248
vm.RemoteCommand('cat /proc/meminfo | grep -i "^hugepage"')
249249
vm.RemoteCommand('sudo cat /proc/sys/vm/hugetlb_shm_group')
250+
postgres_service_name = GetOSDependentDefaults(vm.OS_TYPE)[
251+
'postgres_service_name'
252+
]
250253
vm.RemoteCommand(
251254
'sudo systemctl set-property'
252-
f' {GetOSDependentDefaults(vm.OS_TYPE)["postgres_service_name"]}.service'
255+
f' {postgres_service_name}.service'
253256
f' MemoryMax={SHARED_BUFFERS_CONF[buffer_size_key]["max_memory"]}'
254257
)
255258
if IsUbuntu(vm):
@@ -258,9 +261,12 @@ def ConfigureAndRestart(vm, run_uri, buffer_size):
258261
f' {GetOSDependentDefaults(vm.OS_TYPE)["postgres_template_service_name"]}.service'
259262
f' MemoryMax={SHARED_BUFFERS_CONF[buffer_size_key]["max_memory"]}'
260263
)
264+
postgres_service_name = GetOSDependentDefaults(
265+
vm.OS_TYPE
266+
)['postgres_template_service_name']
261267
vm.RemoteCommand('sudo sync; echo 3 | sudo tee /proc/sys/vm/drop_caches')
262268
vm.RemoteCommand(
263-
f'cat /etc/systemd/system.control/{GetOSDependentDefaults(vm.OS_TYPE)["postgres_service_name"]}.service.d/50-MemoryMax.conf'
269+
f'cat /etc/systemd/system.control/{postgres_service_name}.service.d/50-MemoryMax.conf'
264270
)
265271
vm.RemoteCommand(
266272
'sudo su - postgres -c "openssl req -new -x509 -days 365 -nodes -text'
@@ -272,6 +278,7 @@ def ConfigureAndRestart(vm, run_uri, buffer_size):
272278
'sudo systemctl restart'
273279
f' {GetOSDependentDefaults(vm.OS_TYPE)["postgres_service_name"]}'
274280
)
281+
vm.RemoteCommand(f'sudo systemctl status {postgres_service_name}')
275282
vm.RemoteCommand(
276283
f'sudo su - postgres -c "psql -a -f {database_queries_path}"'
277284
)

0 commit comments

Comments
 (0)