-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate better with lucene test framework and mockfilesystems #10656
Changes from 57 commits
6ac4d6d
fb481bc
4014526
e5a699f
4d44fa0
93e591c
68267f4
8ceb495
370819a
bac99cc
84b20c0
65367f5
007e8f1
89b9f0e
c421948
2d9e5b4
d08322e
7afa241
5718e56
57b5e06
b113fbd
a985c97
c7c4045
e3e4c02
e715535
43b6cd2
0ff0a00
84811a5
aa381a2
61b60da
a312098
52c4af6
621f502
96f08a3
c7ce727
e4de0cb
310e04b
b27c7f0
d2854d7
e91a7de
d8a9294
ce6b377
5bcd599
d301567
06eee11
c00f0ff
b46df4d
1378755
b728772
22af0e6
551d16f
c153772
9e0a958
68f75ea
b09d236
2ed711f
069e11b
a6c154a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
setup: | ||
- skip: | ||
version: 0 - 999 | ||
version: " - " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we sure this doesn't break the clients builds? @clintongormley WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @javanna it does but we are on master we can do this! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another question is if we want to have a "pending" test like this in the suite at all? Again, if yes, I'd like to have something semantic, like a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @karmi If you want a special |
||
reason: leaves transient metadata behind, need to fix it | ||
--- | ||
"Test put settings": | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.common.io; | ||
|
||
import org.elasticsearch.common.SuppressForbidden; | ||
|
||
import java.net.URI; | ||
import java.nio.file.FileSystem; | ||
import java.nio.file.FileSystems; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/** | ||
* Utilities for creating a Path from names, | ||
* or accessing the default FileSystem. | ||
* <p> | ||
* This class allows the default filesystem to | ||
* be changed during tests. | ||
*/ | ||
@SuppressForbidden(reason = "accesses the default filesystem by design") | ||
public final class PathUtils { | ||
/** no instantiation */ | ||
private PathUtils() {} | ||
|
||
/** the actual JDK default */ | ||
static final FileSystem ACTUAL_DEFAULT = FileSystems.getDefault(); | ||
|
||
/** can be changed by tests (via reflection) */ | ||
private static volatile FileSystem DEFAULT = ACTUAL_DEFAULT; | ||
|
||
/** | ||
* Returns a {@code Path} from name components. | ||
* <p> | ||
* This works just like {@code Paths.get()}. | ||
* Remember: just like {@code Paths.get()} this is NOT A STRING CONCATENATION | ||
* UTILITY FUNCTION. | ||
* <p> | ||
* Remember: this should almost never be used. Usually resolve | ||
* a path against an existing one! | ||
*/ | ||
public static Path get(String first, String... more) { | ||
return DEFAULT.getPath(first, more); | ||
} | ||
|
||
/** | ||
* Returns a {@code Path} from a URI | ||
* <p> | ||
* This works just like {@code Paths.get()}. | ||
* <p> | ||
* Remember: this should almost never be used. Usually resolve | ||
* a path against an existing one! | ||
*/ | ||
public static Path get(URI uri) { | ||
if (uri.getScheme().equalsIgnoreCase("file")) { | ||
return DEFAULT.provider().getPath(uri); | ||
} else { | ||
return Paths.get(uri); | ||
} | ||
} | ||
|
||
/** | ||
* Returns the default FileSystem. | ||
*/ | ||
public static FileSystem getDefaultFileSystem() { | ||
return DEFAULT; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,9 @@ public class EsExecutors { | |
*/ | ||
public static final String PROCESSORS = "processors"; | ||
|
||
/** Useful for testing */ | ||
public static final String DEFAULT_SYSPROP = "es.processors.override"; | ||
|
||
/** | ||
* Returns the number of processors available but at most <tt>32</tt>. | ||
*/ | ||
|
@@ -44,7 +47,11 @@ public static int boundedNumberOfProcessors(Settings settings) { | |
* ie. >= 48 create too many threads and run into OOM see #3478 | ||
* We just use an 32 core upper-bound here to not stress the system | ||
* too much with too many created threads */ | ||
return settings.getAsInt(PROCESSORS, Math.min(32, Runtime.getRuntime().availableProcessors())); | ||
int defaultValue = Math.min(32, Runtime.getRuntime().availableProcessors()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to document it but I wonder why we don't use the settings as we did before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to document it? Its just for tests. The idea is not to rely upon a bunch of test plumbing (like configuration) to always set it, its too fragile. with the base class setting a sysprop, we know its always set consistently. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh nevermind I didn't see what we still use the settings in the return statement.... all is well |
||
try { | ||
defaultValue = Integer.parseInt(System.getProperty(DEFAULT_SYSPROP)); | ||
} catch (Throwable ignored) {} | ||
return settings.getAsInt(PROCESSORS, defaultValue); | ||
} | ||
|
||
public static PrioritizedEsThreadPoolExecutor newSinglePrioritizing(ThreadFactory threadFactory) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice