Skip to content
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

Refine BackupManager #9054

Merged
merged 29 commits into from
Aug 15, 2022
Merged

Refine BackupManager #9054

merged 29 commits into from
Aug 15, 2022

Conversation

koppor
Copy link
Member

@koppor koppor commented Aug 13, 2022

Alleviates https://discourse.jabref.org/t/no-content-in-table-after-blue-screen/3479

  • We call backup files .bak and temporary writing files now .sav.
  • JabRef keeps 10 older versions of a .bib file in the user data dir (instead of a single .sav (now: .bak) file in the directory of the .bib file)
  • In case a backup is found, the filename of the backup is shown.

grafik


koppor and others added 4 commits August 13, 2022 23:19
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Co-authored-by: Christoph <siedlerkiller@gmail.com>
@koppor koppor requested a review from calixtus August 13, 2022 22:05
@koppor
Copy link
Member Author

koppor commented Aug 13, 2022

Follow-up: #2961 (comment)

@ThiloteE ThiloteE added this to the v5.8 milestone Aug 13, 2022
Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

looks good to me.
Is the backupmanager running in a seperate thread?

@calixtus
Copy link
Member

Is #8750 superceded by this PR?

@koppor
Copy link
Member Author

koppor commented Aug 14, 2022

Is #8750 superceded by this PR?

No, it is not. This PR is an extract of #8750 to keep things going and to enable easier reviewing.

@koppor
Copy link
Member Author

koppor commented Aug 14, 2022

Ideas (if they are quick to implement)

  • Introduce needsBackup flat
  • Listen to database changes. If a change occurred, set needsBackup flag to true.
  • In performBackup: If needsBackup is true, really perform backup. If not, no action

In this way, we only create backups if necessary.

I am not sure, however, if we the current change infrastructure trigger changes in all changes (e.g., change of encoding, change of groups, add a BibTeX string). At the event bus, I was pretty sure. Does anyone know about the new infrastructure?

@Siedlerchr
Copy link
Member

Siedlerchr commented Aug 14, 2022

We still have the EventBus in place... But I would stick with creating backups always

@koppor koppor marked this pull request as draft August 14, 2022 22:32
@koppor
Copy link
Member Author

koppor commented Aug 14, 2022

Converted to draft, since I have to investigate the creation of BackupManger in the two cases i) restore at JabRef start and ii) file opening. Before the PR, the BackupManager was started and afterwards (!) it was checked if the backup file differed from the current file. Here, that lead to 0 byte backup files.

@koppor
Copy link
Member Author

koppor commented Aug 15, 2022

Refs #8298 (comment): Partially fixes the issue regarding openDatabses(), because (at least) the already opened database use the same code. The behavior for databases passed by the command line is not changed, because this is too difficult for now (the user could trigger and import, opening a bib file, etc. One would need to distinguish that).

@koppor koppor marked this pull request as ready for review August 15, 2022 12:28
calixtus and others added 2 commits August 15, 2022 20:08
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com>
Co-authored-by: Houssem Nasri <housi.housi2015@gmail.com>
Co-authored-by: Benedikt Tutzer <btut@users.noreply.github.com>
@Siedlerchr Siedlerchr merged commit f7648e8 into main Aug 15, 2022
@Siedlerchr Siedlerchr deleted the ten-saves-for-backup-manager branch August 15, 2022 20:38
Siedlerchr added a commit that referenced this pull request Aug 21, 2022
* upstream/main:
  Restructure development documation (#9058)
  Refine BackupManager (#9054)
  No need for "synchronized" at autosave, because there is a throttler (#9060)
  Reenable CiteSeerTest (#9062)
  Bump mockito-core from 4.6.1 to 4.7.0 (#9061)
  Squashed 'buildres/csl/csl-styles/' changes from c750b6e..b9302fd (#9059)
@koppor koppor restored the ten-saves-for-backup-manager branch September 4, 2022 13:57
@koppor koppor deleted the ten-saves-for-backup-manager branch December 18, 2022 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants