Skip to content

fix: preserve file version snapshots during version creation#531

Open
zubeydecivelek wants to merge 1 commit into
CERNDocumentServer:masterfrom
zubeydecivelek:fix-rdm-versioning
Open

fix: preserve file version snapshots during version creation#531
zubeydecivelek wants to merge 1 commit into
CERNDocumentServer:masterfrom
zubeydecivelek:fix-rdm-versioning

Conversation

@zubeydecivelek

Copy link
Copy Markdown
Contributor

In _versions(), when we build cumulative file snapshots, we are assigning the same versioned_files dictionary to every version:

versions[version]["files"] = versioned_files

Because this dictionary keeps getting updated in the next loop iterations, the earlier versions were also reflecting the latest state.

For example, if we have:

  • draft.pdf v1
  • draft.pdf v2

we would expect:

  • record version 1 -> draft.pdf v1
  • record version 2 -> draft.pdf v2

But because all versions shared the same dictionary reference, we are getting:

  • record version 1 -> draft.pdf v2
  • record version 2 -> draft.pdf v2

So we are missing previous versions and always keeping the latest file version in the earlier snapshots too.

this one has easy fix:

versions[version]["files"] = deepcopy(versioned_files)

Second issue: we create the version bucket before checking whether the file should be skipped. For example, if Plot files have versions 3 and 4, but plots are skipped later, we still create record versions 3 and 4. Since no kept files change in those versions, they become duplicate versions.

For example:

  • main.pdf has 2 version
  • plot.png has 4 version

If plots are skipped, we probably only want:

  • record version 1 -> main.pdf v1
  • record version 2 -> main.pdf v2

But currently we can get:

  • record version 1 -> main.pdf v1
  • record version 2 -> main.pdf v2
  • record version 3 -> same as version 2
  • record version 4 -> same as version 2

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.

1 participant