Skip to content

Commit f3df32b

Browse files
committed
Merge remote-tracking branch 'elastic/main' into sorted-dv-codec
2 parents 08813b6 + f8a72d9 commit f3df32b

File tree

19 files changed

+918
-161
lines changed

19 files changed

+918
-161
lines changed

docs/changelog/132774.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132774
2+
summary: Improve cpu utilization with dynamic slice size in doc partitioning
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/reference/search-connectors/release-notes.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,33 @@ If you are an Enterprise Search user and want to upgrade to Elastic 9.0, refer t
1313
It includes detailed steps, tooling, and resources to help you transition to supported alternatives in 9.x, such as Elasticsearch, the Open Web Crawler, and self-managed connectors.
1414
:::
1515

16+
## 9.1.2 [connectors-9.1.2-release-notes]
17+
There are no new features, enhancements, fixes, known issues, or deprecations associated with this release.
18+
19+
## 9.1.1 [connectors-9.1.1-release-notes]
20+
21+
### Fixes [connectors-9.1.1-fixes]
22+
23+
:::{dropdown} Resolves missing access control for “Everyone Except External Users” in SharePoint connector
24+
25+
Permissions granted to the `Everyone Except External Users` group were previously ignored, causing incomplete access control metadata in documents. This occurred because the connector did not recognize the group’s login name format.
26+
[#3577](https://github.com/elastic/connectors/pull/3577) resolves this issue by recognizing the group’s login format and correctly applying its permissions to document access control metadata.
27+
:::
28+
29+
## 9.1.0 [connectors-9.1.0-release-notes]
30+
There are no new features, enhancements, fixes, known issues, or deprecations associated with this release.
31+
32+
## 9.0.5 [connectors-9.0.5-release-notes]
33+
34+
### Fixes [connectors-9.0.5-fixes]
35+
36+
:::{dropdown} Resolves missing access control for `Everyone Except External Users` in SharePoint connector
37+
Permissions granted to the `Everyone Except External Users` group were previously ignored, causing incomplete access control metadata in documents. This occurred because the connector did not recognize the group’s login name format. [#3577](https://github.com/elastic/connectors/pull/3577) resolves this issue by recognizing the group’s login format and correctly applying its permissions to document access control metadata.
38+
:::
39+
40+
## 9.0.4 [connectors-9.0.4-release-notes]
41+
No changes since 9.0.3
42+
1643
## 9.0.3 [connectors-9.0.3-release-notes]
1744

1845
### Features and enhancements [connectors-9.0.3-features-enhancements]

muted-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,30 @@ tests:
549549
- class: org.elasticsearch.xpack.esql.analysis.AnalyzerTests
550550
method: testMagnitudePlanWithDenseVectorImplicitCasting
551551
issue: https://github.com/elastic/elasticsearch/issues/132985
552+
- class: org.elasticsearch.xpack.search.AsyncSearchErrorTraceIT
553+
method: testAsyncSearchFailingQueryErrorTraceDefault
554+
issue: https://github.com/elastic/elasticsearch/issues/133010
555+
- class: org.elasticsearch.xpack.esql.plugin.IndexResolutionIT
556+
method: testDoesNotResolveClosedIndex
557+
issue: https://github.com/elastic/elasticsearch/issues/133011
558+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
559+
method: test {p0=search/510_range_query_out_of_bounds/Test range query for float field with out of bounds lower limit}
560+
issue: https://github.com/elastic/elasticsearch/issues/133012
561+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
562+
method: test {p0=field_caps/10_basic/Field caps for boolean field with only doc values}
563+
issue: https://github.com/elastic/elasticsearch/issues/133019
564+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
565+
method: test {p0=search/160_exists_query/Test exists query on unmapped boolean field}
566+
issue: https://github.com/elastic/elasticsearch/issues/133029
567+
- class: org.elasticsearch.xpack.remotecluster.RemoteClusterSecurityEsqlIT
568+
method: testCrossClusterEnrichWithOnlyRemotePrivs
569+
issue: https://github.com/elastic/elasticsearch/issues/133031
570+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
571+
method: test {p0=search.vectors/45_knn_search_bit/Vector similarity with filter only}
572+
issue: https://github.com/elastic/elasticsearch/issues/133037
573+
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
574+
method: test {p0=search.vectors/45_knn_search_bit/Vector rescoring has no effect for non-quantized vectors and provides same results as non-rescored knn}
575+
issue: https://github.com/elastic/elasticsearch/issues/133039
552576

553577
# Examples:
554578
#

server/src/main/java/org/elasticsearch/index/codec/tsdb/es819/ES819TSDBDocValuesProducer.java

Lines changed: 121 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ public SortedDocValues getSorted(FieldInfo field) throws IOException {
347347
}
348348

349349
private SortedDocValues getSorted(SortedEntry entry, boolean valuesSorted) throws IOException {
350+
if (entry.ordsEntry.docsWithFieldOffset == -2) {
351+
return DocValues.emptySorted();
352+
}
353+
350354
final NumericDocValues ords = getNumeric(entry.ordsEntry, entry.termsDictEntry.termsDictSize);
351355
return new BaseSortedDocValues(entry) {
352356

@@ -382,7 +386,25 @@ public long cost() {
382386

383387
@Override
384388
public BlockLoader.Block tryRead(BlockLoader.BlockFactory factory, BlockLoader.Docs docs, int offset) throws IOException {
385-
if (valuesSorted && ords instanceof BaseDenseNumericValues denseOrds) {
389+
if (ords instanceof BaseDenseNumericValues denseOrds) {
390+
var block = tryReadAHead(factory, docs, offset);
391+
if (block != null) {
392+
return block;
393+
}
394+
// Falling back to tryRead(...) is safe here, given that current block index wasn't altered by looking ahead.
395+
try (var builder = factory.singletonOrdinalsBuilder(this, docs.count() - offset, true)) {
396+
BlockLoader.SingletonLongBuilder delegate = new SingletonLongToSingletonOrdinalDelegate(builder);
397+
var result = denseOrds.tryRead(delegate, docs, offset);
398+
if (result != null) {
399+
return result;
400+
}
401+
}
402+
}
403+
return null;
404+
}
405+
406+
BlockLoader.Block tryReadAHead(BlockLoader.BlockFactory factory, BlockLoader.Docs docs, int offset) throws IOException {
407+
if (ords instanceof BaseDenseNumericValues denseOrds && (valuesSorted || entry.termsDictEntry.termsDictSize == 1)) {
386408
int firstDoc = docs.get(offset);
387409
denseOrds.advanceExact(firstDoc);
388410
long startValue = denseOrds.longValue();
@@ -440,6 +462,10 @@ public TermsEnum termsEnum() throws IOException {
440462
public BlockLoader.Block tryRead(BlockLoader.BlockFactory factory, BlockLoader.Docs docs, int offset) throws IOException {
441463
return null;
442464
}
465+
466+
BlockLoader.Block tryReadAHead(BlockLoader.BlockFactory factory, BlockLoader.Docs docs, int offset) throws IOException {
467+
return null;
468+
}
443469
}
444470

445471
abstract static class BaseDenseNumericValues extends NumericDocValues implements BlockLoader.OptionalColumnAtATimeReader {
@@ -485,6 +511,10 @@ public BlockLoader.Block tryRead(BlockLoader.BlockFactory factory, BlockLoader.D
485511
}
486512

487513
abstract long lookAheadValueAt(int targetDoc) throws IOException;
514+
515+
BlockLoader.Block tryRead(BlockLoader.SingletonLongBuilder builder, BlockLoader.Docs docs, int offset) throws IOException {
516+
return null;
517+
}
488518
}
489519

490520
abstract static class BaseNumericValuesWithDISI extends NumericDocValues {
@@ -1319,41 +1349,49 @@ public long longValue() throws IOException {
13191349

13201350
@Override
13211351
public BlockLoader.Block tryRead(BlockLoader.BlockFactory factory, BlockLoader.Docs docs, int offset) throws IOException {
1322-
assert maxOrd == -1 : "unexpected maxOrd[" + maxOrd + "]";
1352+
try (BlockLoader.SingletonLongBuilder builder = factory.singletonLongs(docs.count() - offset)) {
1353+
return tryRead(builder, docs, offset);
1354+
}
1355+
}
1356+
1357+
@Override
1358+
BlockLoader.Block tryRead(BlockLoader.SingletonLongBuilder builder, BlockLoader.Docs docs, int offset) throws IOException {
13231359
final int docsCount = docs.count();
13241360
doc = docs.get(docsCount - 1);
1325-
try (BlockLoader.SingletonLongBuilder builder = factory.singletonLongs(docs.count() - offset)) {
1326-
for (int i = offset; i < docsCount;) {
1327-
int index = docs.get(i);
1328-
final int blockIndex = index >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1329-
final int blockInIndex = index & ES819TSDBDocValuesFormat.NUMERIC_BLOCK_MASK;
1330-
if (blockIndex != currentBlockIndex) {
1331-
assert blockIndex > currentBlockIndex : blockIndex + " < " + currentBlockIndex;
1332-
// no need to seek if the loading block is the next block
1333-
if (currentBlockIndex + 1 != blockIndex) {
1334-
valuesData.seek(indexReader.get(blockIndex));
1335-
}
1336-
currentBlockIndex = blockIndex;
1361+
for (int i = offset; i < docsCount;) {
1362+
int index = docs.get(i);
1363+
final int blockIndex = index >>> ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SHIFT;
1364+
final int blockInIndex = index & ES819TSDBDocValuesFormat.NUMERIC_BLOCK_MASK;
1365+
if (blockIndex != currentBlockIndex) {
1366+
assert blockIndex > currentBlockIndex : blockIndex + " < " + currentBlockIndex;
1367+
// no need to seek if the loading block is the next block
1368+
if (currentBlockIndex + 1 != blockIndex) {
1369+
valuesData.seek(indexReader.get(blockIndex));
1370+
}
1371+
currentBlockIndex = blockIndex;
1372+
if (bitsPerOrd == -1) {
13371373
decoder.decode(valuesData, currentBlock);
1374+
} else {
1375+
decoder.decodeOrdinals(valuesData, currentBlock, bitsPerOrd);
13381376
}
1377+
}
13391378

1340-
// Try to append more than just one value:
1341-
// Instead of iterating over docs and find the max length, take an optimistic approach to avoid as
1342-
// many comparisons as there are remaining docs and instead do at most 7 comparisons:
1343-
int length = 1;
1344-
int remainingBlockLength = Math.min(ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SIZE - blockInIndex, docsCount - i);
1345-
for (int newLength = remainingBlockLength; newLength > 1; newLength = newLength >> 1) {
1346-
int lastIndex = i + newLength - 1;
1347-
if (isDense(index, docs.get(lastIndex), newLength)) {
1348-
length = newLength;
1349-
break;
1350-
}
1379+
// Try to append more than just one value:
1380+
// Instead of iterating over docs and find the max length, take an optimistic approach to avoid as
1381+
// many comparisons as there are remaining docs and instead do at most 7 comparisons:
1382+
int length = 1;
1383+
int remainingBlockLength = Math.min(ES819TSDBDocValuesFormat.NUMERIC_BLOCK_SIZE - blockInIndex, docsCount - i);
1384+
for (int newLength = remainingBlockLength; newLength > 1; newLength = newLength >> 1) {
1385+
int lastIndex = i + newLength - 1;
1386+
if (isDense(index, docs.get(lastIndex), newLength)) {
1387+
length = newLength;
1388+
break;
13511389
}
1352-
builder.appendLongs(currentBlock, blockInIndex, length);
1353-
i += length;
13541390
}
1355-
return builder.build();
1391+
builder.appendLongs(currentBlock, blockInIndex, length);
1392+
i += length;
13561393
}
1394+
return builder.build();
13571395
}
13581396

13591397
@Override
@@ -1662,4 +1700,59 @@ private static class TermsDictEntry {
16621700
int maxBlockLength;
16631701
}
16641702

1703+
static final class SingletonLongToSingletonOrdinalDelegate implements BlockLoader.SingletonLongBuilder {
1704+
private final BlockLoader.SingletonOrdinalsBuilder builder;
1705+
1706+
SingletonLongToSingletonOrdinalDelegate(BlockLoader.SingletonOrdinalsBuilder builder) {
1707+
this.builder = builder;
1708+
}
1709+
1710+
@Override
1711+
public BlockLoader.SingletonLongBuilder appendLong(long value) {
1712+
throw new UnsupportedOperationException();
1713+
}
1714+
1715+
@Override
1716+
public BlockLoader.SingletonLongBuilder appendLongs(long[] values, int from, int length) {
1717+
// Unfortunately, no array copy here...
1718+
// Since we need to loop here, let's also keep track of min/max.
1719+
int minOrd = Integer.MAX_VALUE;
1720+
int maxOrd = Integer.MIN_VALUE;
1721+
int counter = 0;
1722+
int[] convertedOrds = new int[length];
1723+
int end = from + length;
1724+
for (int j = from; j < end; j++) {
1725+
int ord = Math.toIntExact(values[j]);
1726+
convertedOrds[counter++] = ord;
1727+
minOrd = Math.min(minOrd, ord);
1728+
maxOrd = Math.max(maxOrd, ord);
1729+
}
1730+
builder.appendOrds(convertedOrds, 0, length, minOrd, maxOrd);
1731+
return this;
1732+
}
1733+
1734+
@Override
1735+
public BlockLoader.Block build() {
1736+
return builder.build();
1737+
}
1738+
1739+
@Override
1740+
public BlockLoader.Builder appendNull() {
1741+
throw new UnsupportedOperationException();
1742+
}
1743+
1744+
@Override
1745+
public BlockLoader.Builder beginPositionEntry() {
1746+
throw new UnsupportedOperationException();
1747+
}
1748+
1749+
@Override
1750+
public BlockLoader.Builder endPositionEntry() {
1751+
throw new UnsupportedOperationException();
1752+
}
1753+
1754+
@Override
1755+
public void close() {}
1756+
}
1757+
16651758
}

server/src/main/java/org/elasticsearch/index/mapper/BlockDocValuesReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ public BlockLoader.Block read(BlockFactory factory, Docs docs, int offset) throw
756756
return block;
757757
}
758758
}
759-
try (var builder = factory.singletonOrdinalsBuilder(ordinals, docs.count() - offset)) {
759+
try (var builder = factory.singletonOrdinalsBuilder(ordinals, docs.count() - offset, false)) {
760760
for (int i = offset; i < docs.count(); i++) {
761761
int doc = docs.get(i);
762762
if (doc < ordinals.docID()) {

server/src/main/java/org/elasticsearch/index/mapper/BlockLoader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ interface BlockFactory {
447447
/**
448448
* Build a reader for reading {@link SortedDocValues}
449449
*/
450-
SingletonOrdinalsBuilder singletonOrdinalsBuilder(SortedDocValues ordinals, int count);
450+
SingletonOrdinalsBuilder singletonOrdinalsBuilder(SortedDocValues ordinals, int count, boolean isDense);
451451

452452
/**
453453
* Build a reader for reading {@link SortedSetDocValues}
@@ -548,6 +548,8 @@ interface SingletonOrdinalsBuilder extends Builder {
548548
* Appends an ordinal to the builder.
549549
*/
550550
SingletonOrdinalsBuilder appendOrd(int value);
551+
552+
SingletonOrdinalsBuilder appendOrds(int[] values, int from, int length, int minOrd, int maxOrd);
551553
}
552554

553555
interface SortedSetOrdinalsBuilder extends Builder {

0 commit comments

Comments
 (0)