Skip to content

Commit 5eb53b9

Browse files
authored
Merge branch 'main' into mis-enable-failure-store
2 parents 0ba8cb7 + 61594da commit 5eb53b9

File tree

49 files changed

+969
-426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+969
-426
lines changed

docs/changelog/127621.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 127621
2+
summary: Fix error message when changing the password for a user in the file realm
3+
area: Security
4+
type: bug
5+
issues: []

docs/changelog/129161.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129161
2+
summary: Add Telemetry for models without adaptive allocations
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

docs/changelog/129418.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129418
2+
summary: Update traces duration mappings with appropriate unit type
3+
area: Ingest Node
4+
type: enhancement
5+
issues: []

docs/reference/elasticsearch/mapping-reference/keyword.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,14 @@ It is both allowed to submit documents that don’t have a value for the field o
295295
```console
296296
POST logs-debug/_doc
297297
{
298-
"date": "2019-12-12",
298+
"@timestamp": "2019-12-12",
299299
"message": "Starting up Elasticsearch",
300300
"level": "debug"
301301
}
302302

303303
POST logs-debug/_doc
304304
{
305-
"date": "2019-12-12",
305+
"@timestamp": "2019-12-12",
306306
"message": "Starting up Elasticsearch"
307307
}
308308
```

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/DefaultESVectorUtilSupport.java

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,58 @@ static float ipFloatBitImpl(float[] q, byte[] d, int start) {
204204
return acc0 + acc1 + acc2 + acc3;
205205
}
206206

207+
/**
208+
* Returns the inner product (aka dot product) between the query vector {@code q}, and the data vector {@code d}.
209+
* <p>
210+
* The query vector should be {@link #B_QUERY}-bit quantized and striped, so that the first {@code n} bits
211+
* of the array are the initial bits of each of the {@code n} vector dimensions; the next {@code n}
212+
* bits are the second bits of each of the {@code n} vector dimensions, and so on
213+
* (this algorithm is only valid for vectors with dimensions a multiple of 8).
214+
* The striping is usually done by {@code BQSpaceUtils.transposeHalfByte}.
215+
* <p>
216+
* The data vector should be single-bit quantized.
217+
*
218+
* <h4>Dot products with bit quantization</h4>
219+
*
220+
* The dot product of any vector with a bit vector is a simple selector - each query vector dimension is multiplied
221+
* by the 0 or 1 in the corresponding data vector dimension; the result is that each dimension value
222+
* is either kept or ignored, with the dimensions that are kept then summed together.
223+
*
224+
* <h4>The algorithm</h4>
225+
*
226+
* The transposition already applied to the query vector ensures there's a 1-to-1 correspondence
227+
* between the data vector bits and query vector bits (see {@code BQSpaceUtils.transposeHalfByte)};
228+
* this means we can use a bitwise {@code &} to keep only the bits of the vector elements we want to sum.
229+
* Essentially, the data vector is used as a selector for each of the striped bits of each vector dimension
230+
* as stored, concatenated together, in {@code q}.
231+
* <p>
232+
* The final dot product result can be obtained by observing that the sum of each stripe of {@code n} bits
233+
* can be computed using the bit count of that stripe. Similar to
234+
* <a href="https://en.wikipedia.org/wiki/Multiplication_algorithm#Long_multiplication">long multiplication</a>,
235+
* the result of each stripe of {@code n} bits can be added together by shifting the value {@code s} bits to the left,
236+
* where {@code s} is the stripe number (0-3), then adding to the overall result. Any carry is handled by the add operation.
237+
*
238+
* @param q query vector, {@link #B_QUERY}-bit quantized and striped (see {@code BQSpaceUtils.transposeHalfByte})
239+
* @param d data vector, 1-bit quantized
240+
* @return inner product result
241+
*/
207242
public static long ipByteBinByteImpl(byte[] q, byte[] d) {
208243
long ret = 0;
209244
int size = d.length;
210-
for (int i = 0; i < B_QUERY; i++) {
245+
for (int s = 0; s < B_QUERY; s++) { // for each stripe of B_QUERY-bit quantization in q...
211246
int r = 0;
212-
long subRet = 0;
247+
long stripeRet = 0;
248+
// bitwise & the query and data vectors together, 32-bits at a time, and counting up the bits still set
213249
for (final int upperBound = d.length & -Integer.BYTES; r < upperBound; r += Integer.BYTES) {
214-
subRet += Integer.bitCount((int) BitUtil.VH_NATIVE_INT.get(q, i * size + r) & (int) BitUtil.VH_NATIVE_INT.get(d, r));
250+
stripeRet += Integer.bitCount((int) BitUtil.VH_NATIVE_INT.get(q, s * size + r) & (int) BitUtil.VH_NATIVE_INT.get(d, r));
215251
}
252+
// handle any tail
253+
// Java operations on bytes automatically extend to int, so we need to mask back down again in case it sign-extends the int
216254
for (; r < d.length; r++) {
217-
subRet += Integer.bitCount((q[i * size + r] & d[r]) & 0xFF);
255+
stripeRet += Integer.bitCount((q[s * size + r] & d[r]) & 0xFF);
218256
}
219-
ret += subRet << i;
257+
// shift the result of the s'th stripe s to the left and add to the result
258+
ret += stripeRet << s;
220259
}
221260
return ret;
222261
}

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/ESVectorUtilSupport.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111

1212
public interface ESVectorUtilSupport {
1313

14+
/**
15+
* The number of bits in bit-quantized query vectors
16+
*/
1417
short B_QUERY = 4;
1518

19+
/**
20+
* Compute dot product between {@code q} and {@code d}
21+
* @param q query vector, {@link #B_QUERY}-bit quantized and striped (see {@code BQSpaceUtils.transposeHalfByte})
22+
* @param d data vector, 1-bit quantized
23+
*/
1624
long ipByteBinByte(byte[] q, byte[] d);
1725

1826
int ipByteBit(byte[] q, byte[] d);

muted-tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,24 @@ tests:
529529
- class: org.elasticsearch.entitlement.runtime.policy.FileAccessTreeTests
530530
method: testWindowsAbsolutPathAccess
531531
issue: https://github.com/elastic/elasticsearch/issues/129168
532+
- class: org.elasticsearch.xpack.esql.qa.single_node.PushQueriesIT
533+
method: testCaseInsensitiveEquality {KEYWORD}
534+
issue: https://github.com/elastic/elasticsearch/issues/129422
535+
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
536+
method: test {knn-function.KnnSearchWithKOption ASYNC}
537+
issue: https://github.com/elastic/elasticsearch/issues/129447
538+
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT
539+
method: test
540+
issue: https://github.com/elastic/elasticsearch/issues/129453
541+
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
542+
method: testWithDatastreams
543+
issue: https://github.com/elastic/elasticsearch/issues/129457
544+
- class: org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceDiskSpaceTests
545+
method: testMergeTasksAreUnblockedWhenMoreDiskSpaceBecomesAvailable
546+
issue: https://github.com/elastic/elasticsearch/issues/129296
547+
- class: org.elasticsearch.xpack.security.PermissionsIT
548+
method: testCanManageIndexWithNoPermissions
549+
issue: https://github.com/elastic/elasticsearch/issues/129471
532550

533551
# Examples:
534552
#

server/src/main/java/org/elasticsearch/cluster/ProjectState.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ public ClusterState updatedState(Consumer<ProjectMetadata.Builder> projectBuilde
7676
return ClusterState.builder(cluster).putProjectMetadata(projectBuilder).build();
7777
}
7878

79+
/**
80+
* Build a new {@link ClusterState} with the updated project.
81+
*/
82+
public ClusterState updatedState(ProjectMetadata updatedProject) {
83+
return ClusterState.builder(cluster).putProjectMetadata(updatedProject).build();
84+
}
85+
7986
/**
8087
* Build a new {@link ProjectState} with the updated {@code project}.
8188
*/

server/src/main/java/org/elasticsearch/cluster/routing/ExpectedShardSizeEstimator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static boolean shouldReserveSpaceForInitializingShard(ShardRouting shard,
5858
// shrink/split/clone operation is going to clone existing locally placed shards using file system hard links
5959
// so no additional space is going to be used until future merges
6060
case LOCAL_SHARDS -> false;
61+
case RESHARD_SPLIT -> false;
6162
};
6263
}
6364

server/src/main/java/org/elasticsearch/cluster/routing/RecoverySource.java

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.elasticsearch.common.io.stream.StreamOutput;
1515
import org.elasticsearch.common.io.stream.Writeable;
1616
import org.elasticsearch.index.IndexVersion;
17+
import org.elasticsearch.index.shard.ShardId;
1718
import org.elasticsearch.repositories.IndexId;
1819
import org.elasticsearch.snapshots.Snapshot;
1920
import org.elasticsearch.xcontent.ToXContent;
@@ -31,6 +32,7 @@
3132
* - {@link PeerRecoverySource} recovery from a primary on another node
3233
* - {@link SnapshotRecoverySource} recovery from a snapshot
3334
* - {@link LocalShardsRecoverySource} recovery from other shards of another index on the same node
35+
* - {@link ReshardSplitRecoverySource} recovery of a shard that is created as a result of a resharding split
3436
*/
3537
public abstract class RecoverySource implements Writeable, ToXContentObject {
3638

@@ -57,6 +59,7 @@ public static RecoverySource readFrom(StreamInput in) throws IOException {
5759
case PEER -> PeerRecoverySource.INSTANCE;
5860
case SNAPSHOT -> new SnapshotRecoverySource(in);
5961
case LOCAL_SHARDS -> LocalShardsRecoverySource.INSTANCE;
62+
case RESHARD_SPLIT -> new ReshardSplitRecoverySource(in);
6063
};
6164
}
6265

@@ -78,7 +81,8 @@ public enum Type {
7881
EXISTING_STORE,
7982
PEER,
8083
SNAPSHOT,
81-
LOCAL_SHARDS
84+
LOCAL_SHARDS,
85+
RESHARD_SPLIT
8286
}
8387

8488
public abstract Type getType();
@@ -319,4 +323,39 @@ public boolean expectEmptyRetentionLeases() {
319323
return false;
320324
}
321325
}
326+
327+
/**
328+
* Recovery of a shard that is created as a result of a resharding split.
329+
* Not to be confused with _split API.
330+
*/
331+
public static class ReshardSplitRecoverySource extends RecoverySource {
332+
private final ShardId sourceShardId;
333+
334+
public ReshardSplitRecoverySource(ShardId sourceShardId) {
335+
this.sourceShardId = sourceShardId;
336+
}
337+
338+
ReshardSplitRecoverySource(StreamInput in) throws IOException {
339+
sourceShardId = new ShardId(in);
340+
}
341+
342+
@Override
343+
public Type getType() {
344+
return Type.RESHARD_SPLIT;
345+
}
346+
347+
public ShardId getSourceShardId() {
348+
return sourceShardId;
349+
}
350+
351+
@Override
352+
protected void writeAdditionalFields(StreamOutput out) throws IOException {
353+
sourceShardId.writeTo(out);
354+
}
355+
356+
@Override
357+
public void addAdditionalFields(XContentBuilder builder, Params params) throws IOException {
358+
sourceShardId.toXContent(builder, params);
359+
}
360+
}
322361
}

0 commit comments

Comments
 (0)