Skip to content

[ZEPPELIN-6595] Derive a reloaded note's leaf name from the note tree - #5498

Open
JangAyeon wants to merge 1 commit into
apache:masterfrom
JangAyeon:ZEPPELIN-6595
Open

JangAyeon wants to merge 1 commit into
apache:masterfrom
JangAyeon:ZEPPELIN-6595

Conversation

@JangAyeon

Copy link
Copy Markdown
Contributor

What is this PR for?

NoteManager.NoteNode.loadAndProcessNote rebuilt a reloaded note's path from the tree for the folder but from the JSON name field for the leaf. A renamed note whose JSON had not been rewritten came back under its old name, which is the only reason moveNote re-saved after a rename (and the source of the ZEPPELIN-5858 race).

This PR takes the leaf from the tree as well (note.setPath(getNotePath())) and removes the rename re-save block in moveNote, together with its disk write and lock nesting.

Trade-off: after a rename, the name field in the on-disk JSON stays behind until the note is next saved. Zeppelin does not read it for location, and exportNote serializes the in-memory note, so exports are unaffected.

What type of PR is it?

Improvement

Todos

  • - Derive the leaf name from the note tree on reload
  • - Remove the rename re-save in moveNote
  • - Add/update tests

What is the Jira issue?

ZEPPELIN-6595

How should this be tested?

  • NoteManagerTest#testReloadAfterRenameDerivesLeafNameFromTree: uses a JSON round-trip repo (like S3/GCS/FileSystem) so a stale name actually surfaces on reload.
  • NoteManagerMoveResaveRaceTest#testRenameDoesNotReloadOrResave: repurposed from the ZEPPELIN-5858 test; asserts moveNote no longer reloads from the repo and still leaves exactly one .zpln file.
  • NotebookTest#testMoveNote: now asserts the file location and the reloaded path/name instead of the JSON name content.

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

NoteNode.loadAndProcessNote took the leaf name from the JSON name field, so a renamed note whose JSON was not rewritten reloaded under its old name. Take the leaf from the tree as well and remove the rename re-save in moveNote, along with its extra disk write and lock nesting.

This branch has not been deployed

No deployments
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