kuzzle 2.60.0-beta.5 → 2.60.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -468,6 +468,12 @@ export declare class ES7 {
468
468
  * collection waits for its shards (`wait_for_active_shards`); a node that
469
469
  * finds it already there calls this instead. It answers at once when the
470
470
  * shards are already active.
471
+ *
472
+ * A `yellow` status alone does not wait: Elasticsearch reports a new index
473
+ * whose primaries are still initializing as `yellow` (#3074). Asking for as
474
+ * many active shard copies as the index has primaries does, and, unlike
475
+ * `wait_for_no_initializing_shards`, does not also wait for replicas that
476
+ * are recovering, which a collection with data may take longer to do.
471
477
  */
472
478
  waitForCollectionShards(index: string, collection: string, timeout?: string): Promise<void>;
473
479
  /**
@@ -1214,12 +1214,25 @@ class ES7 {
1214
1214
  * collection waits for its shards (`wait_for_active_shards`); a node that
1215
1215
  * finds it already there calls this instead. It answers at once when the
1216
1216
  * shards are already active.
1217
+ *
1218
+ * A `yellow` status alone does not wait: Elasticsearch reports a new index
1219
+ * whose primaries are still initializing as `yellow` (#3074). Asking for as
1220
+ * many active shard copies as the index has primaries does, and, unlike
1221
+ * `wait_for_no_initializing_shards`, does not also wait for replicas that
1222
+ * are recovering, which a collection with data may take longer to do.
1217
1223
  */
1218
1224
  async waitForCollectionShards(index, collection, timeout = COLLECTION_SHARDS_TIMEOUT) {
1225
+ const alias = this._getAlias(index, collection);
1219
1226
  try {
1227
+ const { body } = await this._client.indices.getSettings({
1228
+ index: alias,
1229
+ name: "index.number_of_shards",
1230
+ });
1231
+ const primaries = Object.values(body)[0]?.settings?.index?.number_of_shards;
1220
1232
  await this._client.cluster.health({
1221
- index: this._getAlias(index, collection),
1233
+ index: alias,
1222
1234
  timeout,
1235
+ wait_for_active_shards: String(primaries ?? 1),
1223
1236
  wait_for_status: "yellow",
1224
1237
  });
1225
1238
  }
@@ -459,6 +459,12 @@ export declare class ES8 {
459
459
  * collection waits for its shards (`wait_for_active_shards`); a node that
460
460
  * finds it already there calls this instead. It answers at once when the
461
461
  * shards are already active.
462
+ *
463
+ * A `yellow` status alone does not wait: Elasticsearch reports a new index
464
+ * whose primaries are still initializing as `yellow` (#3074). Asking for as
465
+ * many active shard copies as the index has primaries does, and, unlike
466
+ * `wait_for_no_initializing_shards`, does not also wait for replicas that
467
+ * are recovering, which a collection with data may take longer to do.
462
468
  */
463
469
  waitForCollectionShards(index: string, collection: string, timeout?: string): Promise<void>;
464
470
  /**
@@ -1236,12 +1236,25 @@ class ES8 {
1236
1236
  * collection waits for its shards (`wait_for_active_shards`); a node that
1237
1237
  * finds it already there calls this instead. It answers at once when the
1238
1238
  * shards are already active.
1239
+ *
1240
+ * A `yellow` status alone does not wait: Elasticsearch reports a new index
1241
+ * whose primaries are still initializing as `yellow` (#3074). Asking for as
1242
+ * many active shard copies as the index has primaries does, and, unlike
1243
+ * `wait_for_no_initializing_shards`, does not also wait for replicas that
1244
+ * are recovering, which a collection with data may take longer to do.
1239
1245
  */
1240
1246
  async waitForCollectionShards(index, collection, timeout = COLLECTION_SHARDS_TIMEOUT) {
1247
+ const alias = this._getAlias(index, collection);
1241
1248
  try {
1249
+ const body = await this._client.indices.getSettings({
1250
+ index: alias,
1251
+ name: "index.number_of_shards",
1252
+ });
1253
+ const primaries = Object.values(body)[0]?.settings?.index?.number_of_shards;
1242
1254
  await this._client.cluster.health({
1243
- index: this._getAlias(index, collection),
1255
+ index: alias,
1244
1256
  timeout,
1257
+ wait_for_active_shards: Number(primaries ?? 1),
1245
1258
  wait_for_status: "yellow",
1246
1259
  });
1247
1260
  }
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.60.0-beta.5",
4
+ "version": "2.60.0-beta.6",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "scripts": {
7
7
  "build": "rm -Rf ./dist && tsc && node -r ts-node/register/transpile-only ./bin/copy-binaries.ts",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.60.0-beta.5",
4
+ "version": "2.60.0-beta.6",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "scripts": {
7
7
  "build": "rm -Rf ./dist && tsc && node -r ts-node/register/transpile-only ./bin/copy-binaries.ts",