Skip to content

Remove multiple paths from elasticsearch-node tool#72351

Merged
rjernst merged 3 commits intoelastic:masterfrom
rjernst:mdp13
May 4, 2021
Merged

Remove multiple paths from elasticsearch-node tool#72351
rjernst merged 3 commits intoelastic:masterfrom
rjernst:mdp13

Conversation

@rjernst
Copy link
Copy Markdown
Member

@rjernst rjernst commented Apr 28, 2021

relates #71205

@rjernst rjernst added :Core/Infra/Core Core issues without another label >refactoring v8.0.0 labels Apr 28, 2021
@rjernst rjernst requested a review from DaveCTurner April 28, 2021 04:53
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Apr 28, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Copy Markdown
Member

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

Looks ok to me but I think we should fix NodeEnvironment first, see comments below.

final Path[] dataPaths =
Arrays.stream(lock.getNodePaths()).filter(Objects::nonNull).map(p -> p.path).toArray(Path[]::new);
if (dataPaths.length == 0) {
if (lock.getNodePaths().length == 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NodeEnvironment.NodeLock#nodePaths always has length 1 now, so this will never happen. I'd prefer to refactor MDPs out of NodeEnvironment (including NodeEnvironment.NodeLock) first, because this was tricky to spot and there may be other things like it that I don't see.

// create same directory structure as prod does
Files.createDirectories(dataDir);
dataPaths = new Path[] {dataDir};
dataPath = dataDir;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

May as well get rid of the dataDir variable entirely and just use the field.

@rjernst
Copy link
Copy Markdown
Member Author

rjernst commented May 3, 2021

@DaveCTurner I updated this PR since NodeEnvironment is now single-fied.

Copy link
Copy Markdown
Member

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM

@rjernst rjernst merged commit 619a011 into elastic:master May 4, 2021
@rjernst rjernst deleted the mdp13 branch May 4, 2021 14:46
@rjernst rjernst mentioned this pull request Sep 30, 2021
17 tasks
rjernst added a commit to rjernst/elasticsearch that referenced this pull request Oct 4, 2021
elasticsearchmachine pushed a commit that referenced this pull request Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Core Core issues without another label >refactoring Team:Core/Infra Meta label for core/infra team v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants