Skip to content

Props: only save hop-config.json when a GUI property changes, fixes #9837 - #9882

Open
vbhanuchander-lang wants to merge 1 commit into
apache:mainfrom
vbhanuchander-lang:issue-9837-skip-unchanged-gui-property-saves
Open

vbhanuchander-lang wants to merge 1 commit into
apache:mainfrom
vbhanuchander-lang:issue-9837-skip-unchanged-gui-property-saves

Conversation

@vbhanuchander-lang

Copy link
Copy Markdown
Contributor

Fixes #9837.

The data loss in #9837 (the rename deleting hop-config.json first) is already fixed on main by #9800, which replaces the file atomically with retries. This PR handles the other part of the report: Hop GUI writes the whole file about ten times on every start, which gives a virus scanner or indexer that many chances to hold it open.

  • Props.setProperty skips the save when the value is already stored. PropsUi.setDefault sets the fonts, icon size, line width and max undo on every start, nearly always to the values already there.
  • Props.containsKey looked at the top level of the configuration, while setProperty stores GUI properties in their own section, so it never found a key. Props.setDefault therefore rewrote WorkflowDialogStyle on every start, the key in the issue's stack trace, and overwrote any stored value. It now looks where setProperty stores. setDefault is its only caller.

New PropsTest (core) counts saves with a stub serializer: an unchanged value is not saved, containsKey finds a stored GUI property, and a stored WorkflowDialogStyle is kept. All 3 fail without the change. The core *Props*/*Config*/*RegionalSettings* tests (38) pass, and checkstyle and spotless are clean.

…pache#9837

Every Hop GUI start wrote the whole configuration file once for each
default PropsUi sets, about ten times, nearly always with values that
were already stored. Props.setProperty now skips the save when the
value is unchanged.

Props.containsKey looked for the key at the top level of the
configuration, while setProperty stores GUI properties under their own
section, so it never found one. Props.setDefault therefore rewrote
WorkflowDialogStyle on every start, overwriting a stored value. It now
looks where setProperty stores.
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.

[Bug]: hop-config.json can be lost on Windows: save leaves only hop-config.json.new when the rename fails

1 participant