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

Merge branch_9x into fs/branch_9x (up to ccf4b198ec328095d45d2746189dc8ca633e8bcf) #20

Merged
merged 62 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
eb31c4e
Add next minor version 9.7.0
romseygeek Apr 26, 2023
3c0b163
Fix SynonymQuery equals implementation (#12260)
javanna May 3, 2023
15568ca
Fix MMapDirectory documentation for Java 20 (#12265)
uschindler May 5, 2023
ae305f8
Don't generate stacktrace in CollectionTerminatedException (#12270)
original-brownbear May 9, 2023
363f349
add missing changelog entry for #12260
javanna May 9, 2023
f074dc9
Add missing author to changelog entry for #12220
javanna May 9, 2023
3e6ab76
Make query timeout members final in ExitableDirectoryReader (#12274)
javanna May 9, 2023
48986d1
Update javadocs for QueryTimeout (#12272)
javanna May 9, 2023
447cfea
Make TimeExceededException members final (#12271)
javanna May 9, 2023
cf2dfd2
DOAP changes for release 9.6.0
romseygeek May 10, 2023
8e726f7
Add back-compat indices for 9.6.0
romseygeek May 10, 2023
37b97a6
`ToParentBlockJoinQuery` Explain Support Score Mode (#12245) (#12283)
mkhludnev May 10, 2023
784830a
Simplify SliceExecutor and QueueSizeBasedExecutor (#12285)
javanna May 11, 2023
ba91ef9
[Backport] GITHUB-11838 Add api to allow concurrent query rewrite (#1…
benwtrent May 12, 2023
972de54
Backport: Concurrent rewrite for KnnVectorQuery (#12160) (#12288)
benwtrent May 12, 2023
76e8a42
toposort use iterator to avoid stackoverflow (#12286)
tang-hi May 15, 2023
b895c24
Fix test to compile with Java 11 after backport of #12286
uschindler May 15, 2023
afacf23
Update Javadoc for topoSortStates method after #12286 (#12292)
tang-hi May 15, 2023
310360c
Optimize HNSW diversity calculation (#12235)
zhaih May 16, 2023
59110fc
Minor cleanup and improvements to DaciukMihovAutomatonBuilder (#12305)
gsmiller May 18, 2023
d1db558
GITHUB-12291: Skip blank lines from stopwords list. (#12299)
JerryChin May 18, 2023
4d1ed9e
Wrap Query rewrite backwards layer with AccessController (#12308)
uschindler May 19, 2023
b21b396
Make sure APIJAR reproduces with different timezone (unfortunately ja…
uschindler May 19, 2023
25a908d
Add multi-thread searchability to OnHeapHnswGraph (#12257)
zhaih May 22, 2023
3eb7b04
Fix backport error
zhaih May 22, 2023
7db2c12
[MINOR] Update javadoc in Query class (#12233)
AndreyBozhko May 23, 2023
0b53670
[Backport] Integrate the Incubating Panama Vector API #12311 (#12327)
ChrisHegarty May 25, 2023
e0ac15a
Parallelize knn query rewrite across slices rather than segments (#12…
javanna May 26, 2023
b568492
Optimize ConjunctionDISI.createConjunction (#12328)
original-brownbear May 26, 2023
02db735
Update changes to be correct with ARM (it is called NEON there)
uschindler May 26, 2023
a990c15
GH#12321: Marked DaciukMihovAutomatonBuilder as deprecated (#12332)
gsmiller May 26, 2023
ebea2e1
add BitSet.clear() (#12268)
jbellis May 26, 2023
d96e4ff
Clenaup and update changes and synchronize with 9.x
uschindler May 26, 2023
af243dc
Update TestVectorUtilProviders.java (#12338)
zhaih May 29, 2023
24df30c
Don't generate stacktrace for TimeExceededException (#12335)
javanna May 30, 2023
64b48b8
Introduced the Word2VecSynonymFilter (#12169)
dantuzi Apr 24, 2023
34e5905
Word2VecSynonymFilter constructor null check (#12169)
alessandrobenedetti Apr 24, 2023
26e4f06
Use thread-safe search version of HnswGraphSearcher (#12246)
dantuzi May 30, 2023
e134578
Word2VecSynonymProvider to use standard Integer max value for hnsw se…
zhaih May 16, 2023
327997b
Fix searchafter high latency when after value is out of range for seg…
gashutos May 31, 2023
204acc3
Make memory fence in `ByteBufferGuard` explicit (#12290)
JarvisCraft Jun 1, 2023
349b458
Add "direct to binary" option for DaciukMihovAutomatonBuilder and use…
gsmiller Jun 2, 2023
d76dd26
Add updateDocuments API which accept a query (reopen) (#12346)
zhaih Jun 4, 2023
9500438
GITHUB#11350: Handle backward compatibility when merging segments wit…
tflobbe Jun 7, 2023
84ea3aa
[Tessellator] Improve the checks that validate the diagonal between t…
iverase Jun 9, 2023
1107aa2
feat: soft delete optimize (#12339)
fudongyingluck Jun 9, 2023
a8602d6
Better paging when random reads go backwards (#12357)
romseygeek Jun 9, 2023
41cd1f7
Work around SecurityManager issues during initialization of vector ap…
uschindler Jun 9, 2023
b218b81
Restrict GraphTokenStreamFiniteStrings#articulationPointsRecurse recu…
cfournie Jun 12, 2023
adc3740
Implement MMapDirectory with Java 21 Project Panama Preview API (#12294)
uschindler Jun 12, 2023
d8f3be1
remove relic in apijar folder caused by vector additions
uschindler Jun 12, 2023
7f16909
Speed up IndexedDISI Sparse #AdvanceExactWithinBlock for tiny step ad…
gf2121 Jun 13, 2023
8c00149
Add checks in KNNVectorField / KNNVectorQuery to only allow non-null,…
jbellis Jun 13, 2023
b6690f4
Implement VectorUtilProvider with Java 21 Project Panama Vector API (…
ChrisHegarty Jun 13, 2023
c2e5ef4
Add CHANGES.txt for #12334 Honor after value for skipping documents e…
gashutos Jun 14, 2023
7f46d58
Move TermAndBoost back to its original location. (#12366)
jpountz Jun 14, 2023
433aa49
GITHUB-12252: Add function queries for computing similarity scores be…
eliaporciani Jun 14, 2023
27d480f
hunspell (minor): reduce allocations when processing compound rules (…
donnerpeter May 19, 2023
a2b47b0
hunspell (minor): reduce allocations when reading the dictionary's mo…
donnerpeter Jun 1, 2023
d3dcbfd
TestHunspell: reduce the flakiness probability (#12351)
donnerpeter Jun 7, 2023
ccf4b19
This allows VectorUtilProvider tests to be executed although hardware…
uschindler Jun 16, 2023
1a9f441
Merge branch 'branch_9x' into fs/branch_9x
patsonluk Jul 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ apply from: file('gradle/globals.gradle')
// Calculate project version:
version = {
// Release manager: update base version here after release:
String baseVersion = '9.6.0'
String baseVersion = '9.7.0'

// On a release explicitly set release version in one go:
// -Dversion.release=x.y.z
Expand Down Expand Up @@ -119,7 +119,7 @@ apply from: file('gradle/ide/eclipse.gradle')
// (java, tests)
apply from: file('gradle/java/folder-layout.gradle')
apply from: file('gradle/java/javac.gradle')
apply from: file('gradle/java/memorysegment-mrjar.gradle')
apply from: file('gradle/java/core-mrjar.gradle')
apply from: file('gradle/testing/defaults-tests.gradle')
apply from: file('gradle/testing/randomization.gradle')
apply from: file('gradle/testing/fail-on-no-tests.gradle')
Expand Down Expand Up @@ -158,7 +158,7 @@ apply from: file('gradle/generation/javacc.gradle')
apply from: file('gradle/generation/forUtil.gradle')
apply from: file('gradle/generation/antlr.gradle')
apply from: file('gradle/generation/unicode-test-classes.gradle')
apply from: file('gradle/generation/panama-foreign.gradle')
apply from: file('gradle/generation/extract-jdk-apis.gradle')

apply from: file('gradle/datasets/external-datasets.gradle')

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/scriptDepVersions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
ext {
scriptDepVersions = [
"apache-rat": "0.14",
"asm": "9.4",
"asm": "9.5",
"commons-codec": "1.13",
"ecj": "3.30.0",
"flexmark": "0.61.24",
Expand Down
8 changes: 7 additions & 1 deletion dev-tools/doap/lucene.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,20 @@
</maintainer>

<!-- NOTE: please insert releases in numeric order, NOT chronologically. -->
<release>
<Version>
<name>lucene-9.6.0</name>
<created>2023-05-09</created>
<revision>9.6.0</revision>
</Version>
</release>
<release>
<Version>
<name>lucene-9.5.0</name>
<created>2023-01-30</created>
<revision>9.5.0</revision>
</Version>
</release>

<release>
<Version>
<name>lucene-9.4.2</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@

def resources = scriptResources(buildscript)

configure(rootProject) {
ext {
// also change this in extractor tool: ExtractForeignAPI
vectorIncubatorJavaVersions = [ JavaVersion.VERSION_20, JavaVersion.VERSION_21 ] as Set
}
}

configure(project(":lucene:core")) {
ext {
apijars = file('src/generated/jdk');
panamaJavaVersions = [ 19, 20 ]
mrjarJavaVersions = [ 19, 20, 21 ]
}

configurations {
Expand All @@ -31,9 +38,9 @@ configure(project(":lucene:core")) {
apiextractor "org.ow2.asm:asm:${scriptDepVersions['asm']}"
}

for (jdkVersion : panamaJavaVersions) {
def task = tasks.create(name: "generatePanamaForeignApiJar${jdkVersion}", type: JavaExec) {
description "Regenerate the API-only JAR file with public Panama Foreign API from JDK ${jdkVersion}"
for (jdkVersion : mrjarJavaVersions) {
def task = tasks.create(name: "generateJdkApiJar${jdkVersion}", type: JavaExec) {
description "Regenerate the API-only JAR file with public Panama Foreign & Vector API from JDK ${jdkVersion}"
group "generation"

javaLauncher = javaToolchains.launcherFor {
Expand All @@ -45,18 +52,21 @@ configure(project(":lucene:core")) {
javaLauncher.get()
return true
} catch (Exception e) {
logger.warn('Launcher for Java {} is not available; skipping regeneration of Panama Foreign API JAR.', jdkVersion)
logger.warn('Launcher for Java {} is not available; skipping regeneration of Panama Foreign & Vector API JAR.', jdkVersion)
logger.warn('Error: {}', e.cause?.message)
logger.warn("Please make sure to point env 'JAVA{}_HOME' to exactly JDK version {} or enable Gradle toolchain auto-download.", jdkVersion, jdkVersion)
return false
}
}

classpath = configurations.apiextractor
mainClass = file("${resources}/ExtractForeignAPI.java") as String
mainClass = file("${resources}/ExtractJdkApis.java") as String
systemProperties = [
'user.timezone': 'UTC'
]
args = [
jdkVersion,
new File(apijars, "panama-foreign-jdk${jdkVersion}.apijar"),
new File(apijars, "jdk${jdkVersion}.apijar"),
]
}

Expand Down
197 changes: 197 additions & 0 deletions gradle/generation/extract-jdk-apis/ExtractJdkApis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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.
*/
import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.Paths;
import java.nio.file.attribute.FileTime;
import java.time.Instant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

public final class ExtractJdkApis {

private static final FileTime FIXED_FILEDATE = FileTime.from(Instant.parse("2022-01-01T00:00:00Z"));

private static final String PATTERN_PANAMA_FOREIGN = "java.base/java/{lang/foreign/*,nio/channels/FileChannel,util/Objects}";
private static final String PATTERN_VECTOR_INCUBATOR = "jdk.incubator.vector/jdk/incubator/vector/*";
private static final String PATTERN_VECTOR_VM_INTERNALS = "java.base/jdk/internal/vm/vector/VectorSupport{,$Vector,$VectorMask,$VectorPayload,$VectorShuffle}";

static final Map<Integer,List<String>> CLASSFILE_PATTERNS = Map.of(
19, List.of(PATTERN_PANAMA_FOREIGN),
20, List.of(PATTERN_PANAMA_FOREIGN, PATTERN_VECTOR_VM_INTERNALS, PATTERN_VECTOR_INCUBATOR),
21, List.of(PATTERN_PANAMA_FOREIGN)
);

public static void main(String... args) throws IOException {
if (args.length != 2) {
throw new IllegalArgumentException("Need two parameters: java version, output file");
}
Integer jdk = Integer.valueOf(args[0]);
if (jdk.intValue() != Runtime.version().feature()) {
throw new IllegalStateException("Incorrect java version: " + Runtime.version().feature());
}
if (!CLASSFILE_PATTERNS.containsKey(jdk)) {
throw new IllegalArgumentException("No support to extract stubs from java version: " + jdk);
}
var outputPath = Paths.get(args[1]);

// create JRT filesystem and build a combined FileMatcher:
var jrtPath = Paths.get(URI.create("jrt:/")).toRealPath();
var patterns = CLASSFILE_PATTERNS.get(jdk).stream()
.map(pattern -> jrtPath.getFileSystem().getPathMatcher("glob:" + pattern + ".class"))
.toArray(PathMatcher[]::new);
PathMatcher pattern = p -> Arrays.stream(patterns).anyMatch(matcher -> matcher.matches(p));

// Collect all files to process:
final List<Path> filesToExtract;
try (var stream = Files.walk(jrtPath)) {
filesToExtract = stream.filter(p -> pattern.matches(jrtPath.relativize(p))).collect(Collectors.toList());
}

// Process all class files:
try (var out = new ZipOutputStream(Files.newOutputStream(outputPath))) {
process(filesToExtract, out);
}
}

private static void process(List<Path> filesToExtract, ZipOutputStream out) throws IOException {
var classesToInclude = new HashSet<String>();
var references = new HashMap<String, String[]>();
var processed = new TreeMap<String, byte[]>();
System.out.println("Transforming " + filesToExtract.size() + " class files...");
for (Path p : filesToExtract) {
try (var in = Files.newInputStream(p)) {
var reader = new ClassReader(in);
var cw = new ClassWriter(0);
var cleaner = new Cleaner(cw, classesToInclude, references);
reader.accept(cleaner, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
processed.put(reader.getClassName(), cw.toByteArray());
}
}
// recursively add all superclasses / interfaces of visible classes to classesToInclude:
for (Set<String> a = classesToInclude; !a.isEmpty();) {
a = a.stream().map(references::get).filter(Objects::nonNull).flatMap(Arrays::stream).collect(Collectors.toSet());
classesToInclude.addAll(a);
}
// remove all non-visible or not referenced classes:
processed.keySet().removeIf(Predicate.not(classesToInclude::contains));
System.out.println("Writing " + processed.size() + " visible classes...");
for (var cls : processed.entrySet()) {
String cn = cls.getKey();
System.out.println("Writing stub for class: " + cn);
out.putNextEntry(new ZipEntry(cn.concat(".class")).setLastModifiedTime(FIXED_FILEDATE));
out.write(cls.getValue());
out.closeEntry();
}
classesToInclude.removeIf(processed.keySet()::contains);
System.out.println("Referenced classes not included: " + classesToInclude);
}

static boolean isVisible(int access) {
return (access & (Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC)) != 0;
}

static class Cleaner extends ClassVisitor {
private static final String PREVIEW_ANN = "jdk/internal/javac/PreviewFeature";
private static final String PREVIEW_ANN_DESCR = Type.getObjectType(PREVIEW_ANN).getDescriptor();

private final Set<String> classesToInclude;
private final Map<String, String[]> references;

Cleaner(ClassWriter out, Set<String> classesToInclude, Map<String, String[]> references) {
super(Opcodes.ASM9, out);
this.classesToInclude = classesToInclude;
this.references = references;
}

@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
super.visit(Opcodes.V11, access, name, signature, superName, interfaces);
if (isVisible(access)) {
classesToInclude.add(name);
}
references.put(name, Stream.concat(Stream.of(superName), Arrays.stream(interfaces)).toArray(String[]::new));
}

@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return Objects.equals(descriptor, PREVIEW_ANN_DESCR) ? null : super.visitAnnotation(descriptor, visible);
}

@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
if (!isVisible(access)) {
return null;
}
return new FieldVisitor(Opcodes.ASM9, super.visitField(access, name, descriptor, signature, value)) {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return Objects.equals(descriptor, PREVIEW_ANN_DESCR) ? null : super.visitAnnotation(descriptor, visible);
}
};
}

@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
if (!isVisible(access)) {
return null;
}
return new MethodVisitor(Opcodes.ASM9, super.visitMethod(access, name, descriptor, signature, exceptions)) {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return Objects.equals(descriptor, PREVIEW_ANN_DESCR) ? null : super.visitAnnotation(descriptor, visible);
}
};
}

@Override
public void visitInnerClass(String name, String outerName, String innerName, int access) {
if (!Objects.equals(outerName, PREVIEW_ANN)) {
super.visitInnerClass(name, outerName, innerName, access);
}
}

@Override
public void visitPermittedSubclass​(String c) {
}

}

}
Loading