Skip to content
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

Upgrade to Lucene 4.10.1 snapshot #7844

Closed
wants to merge 9 commits into from
Closed
21 changes: 21 additions & 0 deletions dev-tools/build_release.py
Expand Up @@ -67,6 +67,8 @@
('head', 'mobz/elasticsearch-head')]

LOG = env.get('ES_RELEASE_LOG', '/tmp/elasticsearch_release.log')
if os.path.exists(LOG):
raise RuntimeError('please remove old release log %s first' % LOG)

def log(msg):
log_plain('\n%s' % msg)
Expand Down Expand Up @@ -306,6 +308,24 @@ def wait_for_node_startup(host='127.0.0.1', port=9200,timeout=15):

return False

# Ensures we are using a true Lucene release, not a snapshot build:
def verify_lucene_version():
s = open('pom.xml', encoding='utf-8').read()
if s.find('download.elasticsearch.org/lucenesnapshots') != -1:
raise RuntimeError('pom.xml contains download.elasticsearch.org/lucenesnapshots repository: remove that before releasing')

m = re.search(r'<lucene.version>(.*?)</lucene.version>', s)
if m is None:
raise RuntimeError('unable to locate lucene.version in pom.xml')
lucene_version = m.group(1)

m = re.search(r'<lucene.maven.version>(.*?)</lucene.maven.version>', s)
if m is None:
raise RuntimeError('unable to locate lucene.maven.version in pom.xml')
lucene_maven_version = m.group(1)
if lucene_version != lucene_maven_version:
raise RuntimeError('pom.xml is still using a snapshot release of lucene (%s): cutover to a real lucene release before releasing' % lucene_maven_version)

# Checks the pom.xml for the release version.
# This method fails if the pom file has no SNAPSHOT version set ie.
# if the version is already on a release version we fail.
Expand Down Expand Up @@ -564,6 +584,7 @@ def find_bwc_version(release_version, bwc_dir='backwards'):
print(' JAVA_HOME is [%s]' % JAVA_HOME)
print(' Running with maven command: [%s] ' % (MVN))
if build:
verify_lucene_version()
release_version = find_release_version(src_branch)
ensure_no_open_tickets(release_version)
if not dry_run:
Expand Down
29 changes: 17 additions & 12 deletions pom.xml
Expand Up @@ -31,7 +31,8 @@
</parent>

<properties>
<lucene.version>4.10.0</lucene.version>
<lucene.version>4.10.1</lucene.version>
<lucene.maven.version>4.10.1-snapshot-1627159</lucene.maven.version>
<tests.jvms>auto</tests.jvms>
<tests.shuffle>true</tests.shuffle>
<tests.output>onerror</tests.output>
Expand All @@ -45,6 +46,10 @@
</properties>

<repositories>
<repository>
<id>Lucene snapshots</id>
<url>https://download.elasticsearch.org/lucenesnapshots/</url>
</repository>
<repository>
<id>Codehaus Snapshots</id>
<url>http://repository.codehaus.org/</url>
Expand All @@ -67,7 +72,7 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -80,19 +85,19 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand All @@ -104,19 +109,19 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-memory</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand All @@ -128,26 +133,26 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-suggest</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-join</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
</dependency>
<!-- Lucene spatial, make sure when upgrading to work with latest version of jts/spatial4j dependencies -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-expressions</artifactId>
<version>${lucene.version}</version>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/elasticsearch/Version.java
Expand Up @@ -205,7 +205,7 @@ public class Version implements Serializable {
public static final int V_1_5_0_ID = /*00*/1050099;
public static final Version V_1_5_0 = new Version(V_1_5_0_ID, false, org.apache.lucene.util.Version.LUCENE_4_10_0);
public static final int V_2_0_0_ID = /*00*/2000099;
public static final Version V_2_0_0 = new Version(V_2_0_0_ID, true, org.apache.lucene.util.Version.LUCENE_4_10_0);
public static final Version V_2_0_0 = new Version(V_2_0_0_ID, true, org.apache.lucene.util.Version.LUCENE_4_10_1);

public static final Version CURRENT = V_2_0_0;

Expand Down
Expand Up @@ -237,7 +237,7 @@ void onOperation(@Nullable ShardRouting shard, final ShardIterator shardIt, int
if (logger.isDebugEnabled()) {
if (t != null) {
if (!TransportActions.isShardNotAvailableException(t)) {
logger.debug("{}: failed to executed [{}]", t, shard != null ? shard.shortSummary() : shardIt.shardId(), request);
logger.debug("{}: failed to execute [{}]", t, shard != null ? shard.shortSummary() : shardIt.shardId(), request);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/elasticsearch/common/lucene/Lucene.java
Expand Up @@ -43,6 +43,7 @@
import org.elasticsearch.index.fielddata.IndexFieldData;

import java.io.IOException;
import java.text.ParseException;

import static org.elasticsearch.common.lucene.search.NoopCollector.NOOP_COLLECTOR;

Expand Down Expand Up @@ -70,7 +71,7 @@ public static Version parseVersion(@Nullable String version, Version defaultVers
}
try {
return Version.parse(version);
} catch (IllegalArgumentException e) {
} catch (ParseException e) {
logger.warn("no version match {}, default to {}", version, defaultVersion, e);
return defaultVersion;
}
Expand Down Expand Up @@ -562,7 +563,7 @@ public static Version parse(String toParse, Version defaultValue) {
if (Strings.hasLength(toParse)) {
try {
return Version.parseLeniently(toParse);
} catch (IllegalArgumentException e) {
} catch (ParseException e) {
// pass to default
}
}
Expand Down
Expand Up @@ -230,7 +230,7 @@ public void renameFile(DirectoryService directoryService, String from, String to
Directory directory = getDirectory(from);
if (nameDirMapping.putIfAbsent(to, directory) != null) {
throw new IOException("Can't rename file from " + from
+ " to: " + to + "target file already exists");
+ " to: " + to + ": target file already exists");
}
boolean success = false;
try {
Expand Down
Expand Up @@ -24,6 +24,7 @@
import org.apache.lucene.store.BaseDirectoryTestCase;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TimeUnits;
import org.elasticsearch.index.store.distributor.Distributor;
Expand All @@ -46,6 +47,10 @@ protected Directory getDirectory(File path) throws IOException {
Directory[] directories = new Directory[1 + random().nextInt(5)];
for (int i = 0; i < directories.length; i++) {
directories[i] = newDirectory();
if (directories[i] instanceof MockDirectoryWrapper) {
// TODO: fix this test to handle virus checker
((MockDirectoryWrapper) directories[i]).setEnableVirusScanner(false);
}
}
return new DistributorDirectory(directories);
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/elasticsearch/index/store/StoreTest.java
Expand Up @@ -514,6 +514,8 @@ public LuceneManagedDirectoryService(Random random, boolean preventDoubleWrite)
dirs[i] = newDirectory(random);
if (dirs[i] instanceof MockDirectoryWrapper) {
((MockDirectoryWrapper)dirs[i]).setPreventDoubleWrite(preventDoubleWrite);
// TODO: fix this test to handle virus checker
((MockDirectoryWrapper)dirs[i]).setEnableVirusScanner(false);
}
}
this.random = random;
Expand Down
Expand Up @@ -85,6 +85,8 @@ public Directory wrap(Directory dir) {
w.setThrottling(throttle);
w.setCheckIndexOnClose(false); // we do this on the index level
w.setPreventDoubleWrite(preventDoubleWrite);
// TODO: make this test robust to virus scanner
w.setEnableVirusScanner(false);
w.setNoDeleteOpenFile(noDeleteOpenFile);
wrappers.add(w);
return w;
Expand Down