Skip to content

K8SPG-834 add test for huge pages#1424

Merged
nmarukovich merged 12 commits intomainfrom
K8SPG-834_add_hp_test
Feb 12, 2026
Merged

K8SPG-834 add test for huge pages#1424
nmarukovich merged 12 commits intomainfrom
K8SPG-834_add_hp_test

Conversation

@nmarukovich
Copy link
Copy Markdown
Contributor

@nmarukovich nmarukovich commented Feb 2, 2026

Due to the high volume of requests, we're unable to provide free service for this account. To continue using the service, please upgarde to a paid plan.

CHANGEDESCRIPTION

Problem:
Short explanation of the problem.
E2e test for huge pages was added.

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

shfmt

[shfmt] reported by reviewdog 🐶

[ $? -eq 0 ] || return 1


[shfmt] reported by reviewdog 🐶

echo "MachineConfig created"
echo "Waiting for worker pool to update (~10 minutes)..."


[shfmt] reported by reviewdog 🐶

kubectl wait --for=condition=Updated mcp/worker --timeout=900s 2>/dev/null || {
echo "Update taking longer than expected"
return 1
}


[shfmt] reported by reviewdog 🐶

echo "Worker pool updated"


[shfmt] reported by reviewdog 🐶

sleep 10
verify_hugepages_on_nodes


[shfmt] reported by reviewdog 🐶

echo "Verifying hugepages on nodes"


[shfmt] reported by reviewdog 🐶

# Get first worker node, fallback to first non-master, fallback to any node
local node_name=$(
kubectl get nodes -l node-role.kubernetes.io/worker -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || \
kubectl get nodes -l '!node-role.kubernetes.io/master,!node-role.kubernetes.io/control-plane' -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || \
kubectl get nodes -o jsonpath='{.items[0].metadata.name}'
)


[shfmt] reported by reviewdog 🐶

if [ -z "${node_name}" ]; then
echo "No nodes found"
return 1
fi


[shfmt] reported by reviewdog 🐶

echo "Checking node: ${node_name}"


[shfmt] reported by reviewdog 🐶

local hugepages_capacity=$(kubectl get node ${node_name} \
-o jsonpath='{.status.capacity.hugepages-2Mi}')


[shfmt] reported by reviewdog 🐶

if [ -n "${hugepages_capacity}" ] && [ "${hugepages_capacity}" != "0" ]; then
echo "Node has hugepages capacity: ${hugepages_capacity}"
return 0
else
echo "No hugepages capacity found on node ${node_name}"
return 1
fi


[shfmt] reported by reviewdog 🐶

local pod_name=$1
local namespace=$2
local container=${3:-postgres}


[shfmt] reported by reviewdog 🐶

echo "Verifying hugepages in pod ${pod_name}"


[shfmt] reported by reviewdog 🐶

# Check /proc/meminfo
local hugepages_total=$(kubectl exec ${pod_name} -n ${namespace} -c ${container} -- \
grep HugePages_Total /proc/meminfo | awk '{print $2}')


[shfmt] reported by reviewdog 🐶

local hugepages_free=$(kubectl exec ${pod_name} -n ${namespace} -c ${container} -- \
grep HugePages_Free /proc/meminfo | awk '{print $2}')


[shfmt] reported by reviewdog 🐶

echo "HugePages_Total: ${hugepages_total}"
echo "HugePages_Free: ${hugepages_free}"


[shfmt] reported by reviewdog 🐶

if [ "${hugepages_total}" -gt 0 ]; then
echo "Hugepages are available in pod"
return 0
else
echo "No hugepages in pod"
return 1
fi


[shfmt] reported by reviewdog 🐶

local cluster_name=$1
local expected_value=${2:-try}


[shfmt] reported by reviewdog 🐶

echo "Verifying PostgreSQL huge_pages setting..."


[shfmt] reported by reviewdog 🐶

local huge_pages=$(run_psql_local \
"SHOW huge_pages;" \
"postgres:$(get_psql_user_pass ${cluster_name}-pguser-postgres)@$(get_psql_user_host ${cluster_name}-pguser-postgres)")


[shfmt] reported by reviewdog 🐶

echo "huge_pages: ${huge_pages}"


[shfmt] reported by reviewdog 🐶

if [[ "${huge_pages}" == *"${expected_value}"* ]]; then
echo "PostgreSQL huge_pages is set to '${expected_value}'"
return 0
else
echo "PostgreSQL huge_pages not set to '${expected_value}' (value: ${huge_pages})"
return 1
fi


[shfmt] reported by reviewdog 🐶

local pod_name=$1
local namespace=$2
local container=${3:-database}


[shfmt] reported by reviewdog 🐶

echo "Checking hugepages usage..."


[shfmt] reported by reviewdog 🐶

kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages /proc/meminfo


[shfmt] reported by reviewdog 🐶

local hugepages_total=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Total /proc/meminfo | awk '{print $2}')


[shfmt] reported by reviewdog 🐶

local hugepages_free=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Free /proc/meminfo | awk '{print $2}')


[shfmt] reported by reviewdog 🐶

local hugepages_used=$((hugepages_total - hugepages_free))


[shfmt] reported by reviewdog 🐶

echo ""
echo "HugePages usage:"
echo " Total: ${hugepages_total}"
echo " Used: ${hugepages_used}"


[shfmt] reported by reviewdog 🐶

if [ "${hugepages_used}" -gt 0 ]; then
echo "PostgreSQL is using hugepages"
return 0
else
echo "Hugepages available but NOT being used by PostgreSQL"
return 1
fi
}

@nmarukovich nmarukovich changed the title K8SPG-740 add test for huge pages K8SPG-834 add test for huge pages Feb 2, 2026
Copy link
Copy Markdown
Contributor

@egegunes egegunes left a comment

Choose a reason for hiding this comment

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

@nmarukovich could you please apply shfmt suggestions? it's too hard to review right now.

@nmarukovich
Copy link
Copy Markdown
Contributor Author

@nmarukovich could you please apply shfmt suggestions? it's too hard to review right now.

yes, sure

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment thread e2e-tests/functions
Comment thread e2e-tests/functions Outdated
}

enable_hugepages_eks() {
local hugepage_count=$1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is not used

@nmarukovich nmarukovich requested a review from egegunes February 4, 2026 19:53
egegunes
egegunes previously approved these changes Feb 5, 2026
Comment thread e2e-tests/functions Outdated

echo "Updating node pool with hugepages configuration..."

if gcloud container node-pools update ${node_pool} \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we need to move it in Jenkins pipeline level

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ye, I thought the same, just did it.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

shfmt

[shfmt] reported by reviewdog 🐶

local hugepages_free=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Free /proc/meminfo | awk '{print $2}')


[shfmt] reported by reviewdog 🐶

local hugepages_used=$((hugepages_total - hugepages_free))


[shfmt] reported by reviewdog 🐶

echo ""
echo "HugePages usage:"
echo " Total: ${hugepages_total}"
echo " Used: ${hugepages_used}"


[shfmt] reported by reviewdog 🐶

if [ "${hugepages_used}" -gt 0 ]; then
echo "PostgreSQL is using hugepages"
return 0
else
echo "Hugepages available but NOT being used by PostgreSQL"
return 1
fi
}

Comment thread e2e-tests/functions
}

enable_hugepages_gke() {
local hugepage_count=$1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
local hugepage_count=$1
local hugepage_count=$1

Comment thread e2e-tests/functions
Comment on lines +1324 to +1325
echo "Hugepages configuration is now handled during cluster creation"
echo "Skipping runtime configuration for GKE"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
echo "Hugepages configuration is now handled during cluster creation"
echo "Skipping runtime configuration for GKE"
echo "Hugepages configuration is now handled during cluster creation"
echo "Skipping runtime configuration for GKE"

Comment thread e2e-tests/functions
Comment on lines +1327 to +1328
echo "Verifying hugepages configuration..."
local node_name=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
echo "Verifying hugepages configuration..."
local node_name=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
echo "Verifying hugepages configuration..."
local node_name=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')

Comment thread e2e-tests/functions
Comment on lines +1330 to +1336
if kubectl get node ${node_name} -o jsonpath='{.status.allocatable.hugepages-2Mi}' | grep -q '[0-9]'; then
echo "✓ Hugepages are already configured on nodes"
return 0
else
echo "✗ Warning: Hugepages not found in node allocatable resources"
return 1
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
if kubectl get node ${node_name} -o jsonpath='{.status.allocatable.hugepages-2Mi}' | grep -q '[0-9]'; then
echo "✓ Hugepages are already configured on nodes"
return 0
else
echo "✗ Warning: Hugepages not found in node allocatable resources"
return 1
fi
if kubectl get node ${node_name} -o jsonpath='{.status.allocatable.hugepages-2Mi}' | grep -q '[0-9]'; then
echo "✓ Hugepages are already configured on nodes"
return 0
else
echo "✗ Warning: Hugepages not found in node allocatable resources"
return 1
fi

Comment thread e2e-tests/functions
path: /etc/sysctl.d/99-hugepages.conf
EOF

[ $? -eq 0 ] || return 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
[ $? -eq 0 ] || return 1
[ $? -eq 0 ] || return 1

Comment thread e2e-tests/functions
Comment on lines +1587 to +1593
if [[ "${huge_pages}" == *"${expected_value}"* ]]; then
echo "PostgreSQL huge_pages is set to '${expected_value}'"
return 0
else
echo "PostgreSQL huge_pages not set to '${expected_value}' (value: ${huge_pages})"
return 1
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
if [[ "${huge_pages}" == *"${expected_value}"* ]]; then
echo "PostgreSQL huge_pages is set to '${expected_value}'"
return 0
else
echo "PostgreSQL huge_pages not set to '${expected_value}' (value: ${huge_pages})"
return 1
fi
if [[ ${huge_pages} == *"${expected_value}"* ]]; then
echo "PostgreSQL huge_pages is set to '${expected_value}'"
return 0
else
echo "PostgreSQL huge_pages not set to '${expected_value}' (value: ${huge_pages})"
return 1
fi

Comment thread e2e-tests/functions
Comment on lines +1597 to +1599
local pod_name=$1
local namespace=$2
local container=${3:-database}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
local pod_name=$1
local namespace=$2
local container=${3:-database}
local pod_name=$1
local namespace=$2
local container=${3:-database}

Comment thread e2e-tests/functions
local namespace=$2
local container=${3:-database}

echo "Checking hugepages usage..."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
echo "Checking hugepages usage..."
echo "Checking hugepages usage..."

Comment thread e2e-tests/functions
Comment on lines +1603 to +1604
kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages /proc/meminfo
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages /proc/meminfo
kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages /proc/meminfo

Comment thread e2e-tests/functions
Comment on lines +1606 to +1607
local hugepages_total=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Total /proc/meminfo | awk '{print $2}')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
local hugepages_total=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Total /proc/meminfo | awk '{print $2}')
local hugepages_total=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Total /proc/meminfo | awk '{print $2}')

Comment thread e2e-tests/functions
Comment on lines +1609 to +1610
local hugepages_free=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Free /proc/meminfo | awk '{print $2}')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
local hugepages_free=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Free /proc/meminfo | awk '{print $2}')
local hugepages_free=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Free /proc/meminfo | awk '{print $2}')

Comment thread e2e-tests/functions
local hugepages_free=$(kubectl -n ${namespace} exec ${pod_name} -c ${container} -- \
grep HugePages_Free /proc/meminfo | awk '{print $2}')

local hugepages_used=$((hugepages_total - hugepages_free))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
local hugepages_used=$((hugepages_total - hugepages_free))
local hugepages_used=$((hugepages_total - hugepages_free))

Comment thread e2e-tests/functions
Comment on lines +1614 to +1617
echo ""
echo "HugePages usage:"
echo " Total: ${hugepages_total}"
echo " Used: ${hugepages_used}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
echo ""
echo "HugePages usage:"
echo " Total: ${hugepages_total}"
echo " Used: ${hugepages_used}"
echo ""
echo "HugePages usage:"
echo " Total: ${hugepages_total}"
echo " Used: ${hugepages_used}"

Comment thread e2e-tests/functions
Comment on lines +1619 to 1626
if [ "${hugepages_used}" -gt 0 ]; then
echo "PostgreSQL is using hugepages"
return 0
else
echo "Hugepages available but NOT being used by PostgreSQL"
return 1
fi
} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[shfmt] reported by reviewdog 🐶

Suggested change
if [ "${hugepages_used}" -gt 0 ]; then
echo "PostgreSQL is using hugepages"
return 0
else
echo "Hugepages available but NOT being used by PostgreSQL"
return 1
fi
}
if [ "${hugepages_used}" -gt 0 ]; then
echo "PostgreSQL is using hugepages"
return 0
else
echo "Hugepages available but NOT being used by PostgreSQL"
return 1
fi
}

@nmarukovich nmarukovich requested a review from hors February 11, 2026 08:01
@nmarukovich nmarukovich requested a review from egegunes February 11, 2026 11:22
hors
hors previously approved these changes Feb 11, 2026
Comment thread Jenkinsfile
--monitoring=NONE \
--logging=NONE \
--no-enable-managed-prometheus \
--system-config-from-file=${WORKSPACE}/hugepages-config-${CLUSTER_SUFFIX}.yaml \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@nmarukovich please make sure that this will be added for all needed jobs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you mean in jenkins? Percona-Lab/jenkins-pipelines#3785 we already have PR

@JNKPercona
Copy link
Copy Markdown
Collaborator

Test Name Result Time
backup-enable-disable passed 00:00:00
builtin-extensions passed 00:00:00
custom-envs passed 00:00:00
custom-extensions passed 00:00:00
custom-tls passed 00:00:00
database-init-sql passed 00:00:00
demand-backup passed 00:00:00
finalizers passed 00:00:00
init-deploy passed 00:00:00
huge-pages passed 00:00:00
monitoring passed 00:00:00
monitoring-pmm3 passed 00:00:00
one-pod passed 00:00:00
operator-self-healing passed 00:08:57
pitr passed 00:00:00
scaling passed 00:00:00
scheduled-backup passed 00:00:00
self-healing passed 00:00:00
sidecars passed 00:00:00
standby-pgbackrest passed 00:00:00
standby-streaming passed 00:00:00
start-from-backup passed 00:00:00
tablespaces passed 00:00:00
telemetry-transfer passed 00:00:00
upgrade-consistency passed 00:00:00
upgrade-minor passed 00:00:00
users passed 00:00:00
Summary Value
Tests Run 27/27
Job Duration 00:24:32
Total Test Time 00:08:57

commit: 72f165f
image: perconalab/percona-postgresql-operator:PR-1424-72f165fa6

Copy link
Copy Markdown
Member

@mayankshah1607 mayankshah1607 left a comment

Choose a reason for hiding this comment

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

LGTM, but please check the formatting

@nmarukovich nmarukovich merged commit 5eed221 into main Feb 12, 2026
16 checks passed
@nmarukovich nmarukovich deleted the K8SPG-834_add_hp_test branch February 12, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants