Skip to content

fix: migrate affected datasets where size numberOfFiles packedSize and numberOfFilesArchived were overwritten #1854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

martin-trajanovski
Copy link
Collaborator

@martin-trajanovski martin-trajanovski commented Apr 24, 2025

Description

This PR aims to provide a migration script for datasets properties that were overwritten by a bug that was found and fixed in the code.

Motivation

size, numberOfFiles, packedSize and numberOfFilesArchived were all overwritten by a bug in the code and those needed to be fixed.

Fixes

Changes:

  • Added new mongo migration script

Tests included

  • Included for each change/fix?
  • Passing?

Documentation

  • swagger documentation updated (required for API changes)
  • official documentation updated

official documentation info

@martin-trajanovski martin-trajanovski marked this pull request as ready for review April 24, 2025 10:28
@martin-trajanovski martin-trajanovski added bug Something isn't working DCS DAPHNE Contribution to SciCat labels Apr 24, 2025
0,
);

const datasetSizeSum = origDatablockSizeSum + datablockSizeSum;
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure that this is the way that it is calculated?
I think that the dataset total size is the sum of the size of the files listed in the origDatablock

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you see this line for example on the creation of origDatablock: https://github.com/SciCatProject/scicat-backend-next/blob/master/src/datasets/datasets.controller.ts#L1945
Or this line in the update: https://github.com/SciCatProject/scicat-backend-next/blob/master/src/datasets/datasets.controller.ts#L2101
We can see that the size it is used and not the sum of the files listed.

Comment on lines +74 to +75
const datasetNumberOfFilesSum =
origDatablockNumberOfFilesSum + datablockNumberOfFilesSum;
Copy link
Member

Choose a reason for hiding this comment

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

This should include only the origdatablock number of files

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we check the datasets controller you can see that even in the createDatablock endpoint we have the numberOfFiles updated. https://github.com/SciCatProject/scicat-backend-next/blob/master/src/datasets/datasets.controller.ts#L2230

Copy link
Member

@Junjiequan Junjiequan left a comment

Choose a reason for hiding this comment

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

looks fine to me

@martin-trajanovski
Copy link
Collaborator Author

@nitrosx let me know what are your final thoughts about this one. As I know you left some comments before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DCS DAPHNE Contribution to SciCat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants