[ZEPPELIN-5989] Resolve a local notebook dir as a file path instead of parsing it as a URI - #5518
Open
dev-donghwan wants to merge 1 commit into
Open
dev-donghwan wants to merge 1 commit into
dev-donghwan wants to merge 1 commit into
Conversation
…f parsing it as a URI
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
VFSNotebookRepo.setNotebookDirectory()parses the notebook dir withnew URI()unless it is a Windows absolute path likeC:\.... A local path is not a URI and can contain characters that a URI does not allow:./+\+notebook, so the server fails to start withURISyntaxException: Illegal character in path at index 2: ./\notebook./home/me/My Notebooks, fails the same way.The issue suggests joining the dir with
Paths.get, but on Windows that gives.\notebook, whichnew URI()rejects too.This PR:
new File(getAbsoluteDir(path)).toURI(), and parses only a dir with a scheme as a URI. The branch that handled a URI without a scheme is removed, since that case no longer reaches it.rootNotebookFolderas a decoded path for a local dir. It was the root's URI withfile:///replaced, so it kept%20for a space.list()strips it from note file names that are decoded since ZEPPELIN-6202, which would shift note paths by two characters per space, andGitNotebookRepoopens the repository atrootNotebookFolder/.git, which would be a different directory.list()now resolves the root by its URI instead of by this path. A dir with another scheme keeps its current value.For a local dir without such characters, both values are the same as before.
I could not run it on Windows. On other systems the same code path is reached with a space, and Commons VFS treats a backslash in the file URI as a separator. It would help if someone on Windows could start the server from this branch without a configuration file, which is how the issue reproduces it.
What type of PR is it?
Bug Fix
What is the Jira issue?
How should this be tested?
VFSNotebookRepoTest.testNotebookDirWithCharactersThatAUriDoesNotAllowuses a dir with a space and one with a backslash, saves and lists a note, and checks its path.GitNotebookRepoTest.notebookDirWithSpacechecks that.gitis created in the dir with a space and that a checkpoint is recorded.Without the first change both tests fail with the
URISyntaxExceptionabove; without the second the path and.gitchecks fail.Run locally:
VFSNotebookRepoTest(8),GitNotebookRepoTest(12),NotebookRepoSyncTest(10),NotebookServiceTest(13),NotebookServiceRaceConditionTest(1),NoteManagerMoveResaveRaceTest(1),NotebookTest(42).testSchedule,testScheduleDisabledWithNameandtestSchedulePoolUsagefail locally with and without this change: they wait five seconds for the cron run, and the interpreter process here takes about six seconds to sync its libraries and register.