Skip to content

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Sep 11, 2025

Issue

Only changing the permission of the temp storage is not enough after a reboot.

This is a follow-up from #10, which didn't solve the original issue.

Solution

Delete the temp tablespace and recreate it after a reboot.

The test using the VM charm was added at canonical/postgresql-operator#1156.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Copy link

codecov bot commented Sep 11, 2025

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 46.07%. Comparing base (cfb2956) to head (adc214e).
⚠️ Report is 4 commits behind head on 16/edge.

Files with missing lines Patch % Lines
single_kernel_postgresql/utils/postgresql.py 92.85% 0 Missing and 1 partial ⚠️

❌ Your project status has failed because the head coverage (46.07%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           16/edge      #11      +/-   ##
===========================================
+ Coverage    45.45%   46.07%   +0.62%     
===========================================
  Files            4        4              
  Lines          792      803      +11     
  Branches        92       94       +2     
===========================================
+ Hits           360      370      +10     
  Misses         414      414              
- Partials        18       19       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marceloneppel marceloneppel changed the title Recreate temp tablespace on reboot [DPE-7584] Recreate temp tablespace on reboot Sep 11, 2025
@marceloneppel marceloneppel marked this pull request as ready for review September 11, 2025 20:52
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

LGTM in general. One request to avoid data loose by bad luck => someone is fast enough to inject some data into tmp => we drop it thinking it is empty...

):
change_owner(temp_location)
os.chmod(temp_location, POSTGRESQL_STORAGE_PERMISSIONS)
cursor.execute("DROP TABLESPACE IF EXISTS temp;")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we avoid blind DROPing and rename it?
Better safe then sorry.

Copy link
Member Author

@marceloneppel marceloneppel Sep 15, 2025

Choose a reason for hiding this comment

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

Sure. I'll make that change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated on ece989a.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

LGTM, please add INFO message for garbage collection.

cursor.execute("SELECT TRUE FROM pg_tablespace WHERE spcname='temp';")
if cursor.fetchone() is not None:
new_name = (
f"temp_{datetime.now(timezone.utc).strftime('%Y_%m_%d_%H_%M_%S')}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please consider to use temp_20250915223112 format. Unix oldschool story.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated on 8a6a7b7.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@marceloneppel marceloneppel merged commit 3ebd14c into 16/edge Sep 17, 2025
6 of 7 checks passed
@marceloneppel marceloneppel deleted the recreate-temp-tablespace-on-reboot branch September 17, 2025 10:57
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.

3 participants