mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Correct index path validation (#129144)
All we care about is if reindex is true or false. We shouldn't worry about force merge. Because if reindex is true, we will create the directory, if its false, we won't.
This commit is contained in:
parent
e91f9469ae
commit
57ef140d2f
2 changed files with 3 additions and 8 deletions
|
@ -177,13 +177,8 @@ public class KnnIndexTester {
|
||||||
cmdLineArgs.vectorSpace(),
|
cmdLineArgs.vectorSpace(),
|
||||||
cmdLineArgs.numDocs()
|
cmdLineArgs.numDocs()
|
||||||
);
|
);
|
||||||
if (Files.exists(indexPath) == false) {
|
if (cmdLineArgs.reindex() == false && Files.exists(indexPath) == false) {
|
||||||
if (cmdLineArgs.reindex() == false) {
|
throw new IllegalArgumentException("Index path does not exist: " + indexPath);
|
||||||
throw new IllegalArgumentException("Index path does not exist: " + indexPath);
|
|
||||||
}
|
|
||||||
if (cmdLineArgs.forceMerge()) {
|
|
||||||
throw new IllegalArgumentException("Force merging without an existing index in: " + indexPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (cmdLineArgs.reindex()) {
|
if (cmdLineArgs.reindex()) {
|
||||||
knnIndexer.createIndex(result);
|
knnIndexer.createIndex(result);
|
||||||
|
|
|
@ -304,7 +304,7 @@ class KnnIndexer {
|
||||||
bytes.position(0);
|
bytes.position(0);
|
||||||
// wrap around back to the start of the file if we hit the end:
|
// wrap around back to the start of the file if we hit the end:
|
||||||
logger.warn("VectorReader hit EOF when reading " + this.input + "; now wrapping around to start of file again");
|
logger.warn("VectorReader hit EOF when reading " + this.input + "; now wrapping around to start of file again");
|
||||||
this.input.position(position);
|
input.position(position);
|
||||||
bytesRead = Channels.readFromFileChannel(this.input, position, bytes);
|
bytesRead = Channels.readFromFileChannel(this.input, position, bytes);
|
||||||
if (bytesRead < bytes.capacity()) {
|
if (bytesRead < bytes.capacity()) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue