Skip to content

Commit

Permalink
[PLAT-15952] cgroup values not getting updated on resize
Browse files Browse the repository at this point in the history
Summary:
we all assumed this was checked once for the whole block. But, it is checked before ansible executes
every task in the block.
What this means is we do the first set_fact that will set systemd_dir to /etc/systemd/system. Now that
it is set, we drop out of the rest of the block because the where clause is no longer true

we now will always try to set systemd_dir, like other playbooks

Test Plan:
did a resize with cgroup size change. Validated correct cgroup service file gets updated, along with
the related sysfs cgroup file.

Reviewers: daniel, nbhatia, dnolan, svarshney, tsinghania

Reviewed By: svarshney, tsinghania

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D39682
  • Loading branch information
shubin-yb committed Nov 4, 2024
1 parent 57694bc commit 04420ca
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions managed/devops/roles/setup-cgroup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
stat:
path: "{{ yb_home_dir | default('/home/yugabyte') }}/.config/systemd/user/"
register: systemd_user
- name: Print systemd_user
debug:
var: systemd_user

- block:
- set_fact:
systemd_dir: "/etc/systemd/system"
- set_fact:
systemd_dir: "{{ yb_home_dir | default('/home/yugabyte') }}/.config/systemd/user"
when: systemd_user.stat.exists
when: systemd_dir is undefined

- name: check for cgconfig service
ansible.builtin.shell:
Expand Down Expand Up @@ -76,7 +78,7 @@
owner: "{{ user_name }}"
group: "{{ user_name }}"
mode: 0644
- name: Run Cgroup oneshot service
- name: Run Cgroup oneshot service user systemd
become: true
become_user: "{{ user_name }}"
ansible.builtin.systemd:
Expand All @@ -85,6 +87,16 @@
name: yb-ysql-cgroup
state: started
enabled: true
when: systemd_user.stat.exists
- name: Run Cgroup oneshot service root systemd
become: true
become_user: "{{ user_name }}"
ansible.builtin.systemd:
daemon_reload: yes
name: yb-ysql-cgroup
state: started
enabled: true
when: not systemd_user.stat.exists

when: systemd_option and pg_max_mem_mb > 0 and ansible_distribution_major_version == "9"

Expand Down

0 comments on commit 04420ca

Please sign in to comment.