Skip to content

Commit 919dc48

Browse files
authored
Merge branch 'main' into java.base
2 parents 84dc310 + 1727818 commit 919dc48

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

libs/entitlement/asm-provider/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ apply plugin: 'elasticsearch.build'
1212
dependencies {
1313
compileOnly project(':libs:entitlement')
1414
compileOnly project(':libs:core')
15+
compileOnly project(':libs:logging')
1516
implementation 'org.ow2.asm:asm:9.7.1'
1617
testImplementation project(":test:framework")
1718
testImplementation project(":libs:entitlement:bridge")

libs/entitlement/asm-provider/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
requires org.elasticsearch.entitlement;
1616

1717
requires static org.elasticsearch.base; // for SuppressForbidden
18+
requires org.elasticsearch.logging;
1819

1920
provides InstrumentationService with InstrumentationServiceImpl;
2021
}

libs/entitlement/asm-provider/src/main/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumenterImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.elasticsearch.entitlement.instrumentation.CheckMethod;
1313
import org.elasticsearch.entitlement.instrumentation.Instrumenter;
1414
import org.elasticsearch.entitlement.instrumentation.MethodKey;
15+
import org.elasticsearch.logging.LogManager;
16+
import org.elasticsearch.logging.Logger;
1517
import org.objectweb.asm.AnnotationVisitor;
1618
import org.objectweb.asm.ClassReader;
1719
import org.objectweb.asm.ClassVisitor;
@@ -36,6 +38,8 @@
3638
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
3739

3840
public class InstrumenterImpl implements Instrumenter {
41+
private static final Logger logger = LogManager.getLogger(InstrumenterImpl.class);
42+
3943
private final String getCheckerClassMethodDescriptor;
4044
private final String handleClass;
4145

@@ -154,10 +158,10 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
154158
var key = new MethodKey(className, name, Stream.of(Type.getArgumentTypes(descriptor)).map(Type::getInternalName).toList());
155159
var instrumentationMethod = checkMethods.get(key);
156160
if (instrumentationMethod != null) {
157-
// System.out.println("Will instrument method " + key);
161+
logger.debug("Will instrument {}", key);
158162
return new EntitlementMethodVisitor(Opcodes.ASM9, mv, isStatic, isCtor, descriptor, instrumentationMethod);
159163
} else {
160-
// System.out.println("Will not instrument method " + key);
164+
logger.trace("Will not instrument {}", key);
161165
}
162166
}
163167
return mv;

muted-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ tests:
326326
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
327327
method: testEnrichExplosionManyMatches
328328
issue: https://github.com/elastic/elasticsearch/issues/122913
329+
- class: org.elasticsearch.xpack.search.AsyncSearchSecurityIT
330+
issue: https://github.com/elastic/elasticsearch/issues/122940
329331

330332
# Examples:
331333
#

server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2925,7 +2925,7 @@ protected void commitIndexWriter(final IndexWriter writer, final Translog transl
29252925
* {@link IndexWriter#commit()} call flushes all documents, we defer computation of the maximum sequence number to the time
29262926
* of invocation of the commit data iterator (which occurs after all documents have been flushed to Lucene).
29272927
*/
2928-
final Map<String, String> extraCommitUserData = getCommitExtraUserData();
2928+
final Map<String, String> extraCommitUserData = getCommitExtraUserData(localCheckpoint);
29292929
final Map<String, String> commitData = Maps.newMapWithExpectedSize(8 + extraCommitUserData.size());
29302930
commitData.putAll(extraCommitUserData);
29312931
commitData.put(Translog.TRANSLOG_UUID_KEY, translog.getTranslogUUID());
@@ -2973,8 +2973,10 @@ protected void commitIndexWriter(final IndexWriter writer, final Translog transl
29732973
/**
29742974
* Allows InternalEngine extenders to return custom key-value pairs which will be included in the Lucene commit user-data. Custom user
29752975
* data keys can be overwritten by if their keys conflict keys used by InternalEngine.
2976+
*
2977+
* @param localCheckpoint the local checkpoint of the commit
29762978
*/
2977-
protected Map<String, String> getCommitExtraUserData() {
2979+
protected Map<String, String> getCommitExtraUserData(final long localCheckpoint) {
29782980
return Collections.emptyMap();
29792981
}
29802982

server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7327,7 +7327,7 @@ public void testExtraUserDataIsCommitted() throws IOException {
73277327
engine.close();
73287328
engine = new InternalEngine(engine.config()) {
73297329
@Override
7330-
protected Map<String, String> getCommitExtraUserData() {
7330+
protected Map<String, String> getCommitExtraUserData(final long localCheckpoint) {
73317331
return Map.of("userkey", "userdata", ES_VERSION, IndexVersions.ZERO.toString());
73327332
}
73337333
};

0 commit comments

Comments
 (0)