X Tutup
Skip to content

Fix expiry process for version meta data files#40325

Merged
JammingBen merged 1 commit intorelease-10.11.0from
fix-current-version-expiry
Aug 31, 2022
Merged

Fix expiry process for version meta data files#40325
JammingBen merged 1 commit intorelease-10.11.0from
fix-current-version-expiry

Conversation

@JammingBen
Copy link
Contributor

@JammingBen JammingBen commented Aug 31, 2022

Description

This fixes the massive amount of error logs being produced during this.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

@JammingBen JammingBen self-assigned this Aug 31, 2022
@JammingBen JammingBen force-pushed the fix-current-version-expiry branch from 93be780 to bfaffb0 Compare August 31, 2022 08:11
@JammingBen JammingBen changed the title Prevent expiry for the current version meta data file Prevent expiry for version meta data files Aug 31, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

66.7% 66.7% Coverage
0.0% 0.0% Duplication

@JammingBen JammingBen marked this pull request as ready for review August 31, 2022 08:37
@jvillafanez
Copy link
Member

If I understand correctly, you're skipping the metadata files while getting the versions, but I assume that the metadata will be removed when the version is also removed.
Basically, what we want is to prevent the removal of the metadata if the version is still present. Just to ensure we don't keep files dangling around

@JammingBen
Copy link
Contributor Author

JammingBen commented Aug 31, 2022

If I understand correctly, you're skipping the metadata files while getting the versions, but I assume that the metadata will be removed when the version is also removed.

Exactly, sorry, the title is a bit misleading. Version meta files get removed eventually if the corresponding versions get removed.

Edit: Changed the title to be a little less misleading.

@JammingBen JammingBen changed the title Prevent expiry for version meta data files Fix expiry process for version meta data files Aug 31, 2022
$files = $view->getDirectoryContent($dir);
foreach ($files as $file) {
$filePath = $dir . '/' . $file->getName();
$isMetaFile = \substr($filePath, -\strlen(MetaStorage::VERSION_FILE_EXT)) === MetaStorage::VERSION_FILE_EXT;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should work, even when the real file is something.json. I tried by creating f.json and editing it a few times. In data/username/files_versions I get:

$ ls -l f*
-rw-rw-r-- 1 phil phil 60 Aug 31 15:12 f.json.current.json
-rw-rw-r-- 1 phil phil 12 Aug 31 15:11 f.json.v1661938001
-rw-rw-r-- 1 phil phil 60 Aug 31 15:11 f.json.v1661938001.json
-rw-rw-r-- 1 phil phil 13 Aug 31 15:12 f.json.v1661938002
-rw-rw-r-- 1 phil phil 60 Aug 31 15:11 f.json.v1661938002.json

The real files end up called f.json.vnnnnnnnnnn and so their file names do not end in .json - good.

@phil-davis
Copy link
Contributor

@jnweiger - should we switch this over to be PR to release-10.11.0 or merge this and cherry-pick to the release branch?

@jnweiger
Copy link
Contributor

One-flow says master first, but the simpler process is release branch first, I am fine with both.

@JammingBen JammingBen changed the base branch from master to release-10.11.0 August 31, 2022 12:57
@JammingBen
Copy link
Contributor Author

Then let's do it the easy way and merge it into release-10.11.0 :)

@JammingBen JammingBen merged commit 38aae3e into release-10.11.0 Aug 31, 2022
@delete-merged-branch delete-merged-branch bot deleted the fix-current-version-expiry branch August 31, 2022 12:58
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.

4 participants

X Tutup