Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new test cannot compile because Mockito static imports are missing, and revision restoration loses secondary-storage fallback and silently succeeds when a revision cannot be loaded.
3 open issues
What changed in this PR
This hotfix prevents copied and restored Zeppelin notes from inheriting scheduled execution settings while preserving unrelated configuration.
Changes:
- Removes schedule, execution identity, roles, and resource-release settings when cloning or restoring notes.
- Refreshes scheduler registration after revision restore and strengthens execution-identity validation.
- Adds regression coverage for cloning, importing, revision restoration, and identity validation.
| File | Description |
|---|---|
zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java |
Tests identity validation and scheduler refresh after restoration. |
zeppelin-server/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java |
Tests removal of scheduling settings during clone, import, and restore. |
zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java |
Validates execution identity and refreshes restored-note scheduling. |
zeppelin-server/src/main/java/org/apache/zeppelin/notebook/Notebook.java |
Clears scheduling configuration before saving copied or restored notes. |
Review effort: Balanced
| when(notebookRepo.isRevisionSupportedInDefaultRepo()).thenReturn(true); | ||
| when(notebookRepo.get("note-id", "/note", "revision-id", subject)) | ||
| .thenReturn(revisionNote); |
| Note note = ((NotebookRepoWithVersionControl) notebookRepo) | ||
| .setNoteRevision(noteId, notePath, revisionId, subject); | ||
| noteManager.saveNote(note); | ||
| .get(noteId, notePath, revisionId, subject); |
| if (note != null) { | ||
| removeCronConfig(note.getConfig()); | ||
| noteManager.saveNote(note, subject); | ||
| } |
Keep revision lookup fallback across configured repositories and report missing revisions before refreshing dependent state.
| throw new IOException( | ||
| "Revision " + revisionId + " of note " + noteId + " not found"); | ||
| } | ||
| schedulerService.refreshCron(noteId); |
There was a problem hiding this comment.
An existing cron job can still run the restored revision even though its cron settings have been cleared. refreshCron() removes the trigger, but it doesn’t cancel a job that Quartz has already dispatched. If that job looks up the note by ID after the restore, CronJob.execute() gets the restored note and calls runAll() as anonymous without checking whether cron is still set.
Could we have CronJob.execute() return early when the current note has no cron expression? A regression test can cover this without relying on timing: invoke the job against a note with no cron setting and verify that runAll() is not called.
| try { | ||
| Note resultNote = notebook.setNoteRevision(noteId, note.getPath(), revisionId, | ||
| context.getAutheInfo()); | ||
| if (resultNote == null) { |
There was a problem hiding this comment.
Non-Blocking: Could we drop this null check? Notebook.setNoteRevision() already throws an IOException when the revision is missing, and the catch block below reports the failure without refreshing the scheduler.
Could we also have testMissingNoteRevisionFailsWithoutRefreshingCron stub that exception instead of returning null? That would keep the existing assertions while exercising the failure path used in production.
|
Thanks for the fixes! LGTM 😄 |


This keeps copied and restored notes from inheriting scheduled execution settings.
The core and quick workflows provide the full validation.