@delali/narsil 0.3.1-next.184 → 0.3.1-next.185

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.
@@ -50,6 +50,8 @@ var FORWARD_RETRY_INITIAL_DELAY_MS = 50;
50
50
  var FORWARD_RETRY_DELAY_CAP_MS = 1e3;
51
51
  var ROLLBACK_RETRY_INITIAL_DELAY_MS = 50;
52
52
  var ROLLBACK_RETRY_DELAY_CAP_MS = 1e3;
53
+ var OUT_OF_STEP_REMOVAL_RETRY_INITIAL_DELAY_MS = 50;
54
+ var OUT_OF_STEP_REMOVAL_RETRY_DELAY_CAP_MS = 1e3;
53
55
  var PARTITION_WRITE_CONCURRENCY = 16;
54
56
  var MAX_NODE_LEFT_DELAY_MS = 2147483647;
55
57
  var MEMORY_SAMPLE_INTERVAL_MS = 1e3;
@@ -222,4 +224,4 @@ function refuseEncodeWithoutRoom(documents) {
222
224
  if (refusal2 !== null) throw refusal2;
223
225
  }
224
226
 
225
- export { ADMISSION_TIMEOUT_MS, ANSWER_DECODE_HEAP_BYTES_PER_PAYLOAD_BYTE, CATCH_UP_FEED_WINDOW_MS, CATCH_UP_TICK_MS, CLEAR_PAGE_SIZE, COORDINATOR_REQUEST_BUCKET_BOUNDS_SECONDS, COPY_FAILURE_ATTEMPTS, COPY_FAILURE_RETRY_DELAY_MS, DECOMMISSION_RECHECK_INTERVAL_MS, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS, DEFAULT_CAPACITY, DEFAULT_CREATE_INDEX_WAIT_MS, DEFAULT_IN_FLIGHT_WRITE_FRACTION, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DROP_ACKNOWLEDGE_POLL_INTERVAL_MS, FETCH_GROUP_DOCUMENT_IDS, FORWARD_RETRY_DELAY_CAP_MS, FORWARD_RETRY_INITIAL_DELAY_MS, MAX_CATCH_UP_IN_FLIGHT_BYTES, MAX_DROP_ACKNOWLEDGE_WAIT_MS, MAX_NODE_LEFT_DELAY_MS, MAX_SETTINGS_REPLACEMENT_ATTEMPTS, MAX_SOURCE_ID_LENGTH, MAX_WAIT_FOR_ACTIVE_REPLICAS, MEMORY_SAMPLE_INTERVAL_MS, MIN_CONTROLLER_LEASE_TTL_MS, PARTITION_BYTES_ENTRY_BYTES, PARTITION_BYTES_INDEX_OVERHEAD_BYTES, PARTITION_BYTES_REPORT_BUDGET_BYTES, PARTITION_WRITE_CONCURRENCY, PRIMARY_CHANGE_POLL_INTERVAL_MS, PRIMARY_CHANGE_RETRY_WINDOW_MS, REGISTRATION_LEASE_CONFIRM_TIMEOUT_MS, REGISTRATION_LEASE_DRIFT_SHARE, ROLLBACK_RETRY_DELAY_CAP_MS, ROLLBACK_RETRY_INITIAL_DELAY_MS, SEARCH_CONTEXT_ENTRY_HEAP_BYTES, SEARCH_CONTEXT_REAPER_INTERVAL_MS, SETTINGS_CONTENTION_REASON, SNAPSHOT_CHUNK_YIELD_INTERVAL_MS, SYNCED_POSITION_REPORT_TIMEOUT_MS, WRITE_APPLY_YIELD_INTERVAL_MS, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, answerRefusalOf, createWritePressure, estimateDocumentBytes, estimateDocumentsBytes, estimateForwardedBytes, refuseEncodeWithoutRoom, withAdmittedWrite };
227
+ export { ADMISSION_TIMEOUT_MS, ANSWER_DECODE_HEAP_BYTES_PER_PAYLOAD_BYTE, CATCH_UP_FEED_WINDOW_MS, CATCH_UP_TICK_MS, CLEAR_PAGE_SIZE, COORDINATOR_REQUEST_BUCKET_BOUNDS_SECONDS, COPY_FAILURE_ATTEMPTS, COPY_FAILURE_RETRY_DELAY_MS, DECOMMISSION_RECHECK_INTERVAL_MS, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS, DEFAULT_CAPACITY, DEFAULT_CREATE_INDEX_WAIT_MS, DEFAULT_IN_FLIGHT_WRITE_FRACTION, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DROP_ACKNOWLEDGE_POLL_INTERVAL_MS, FETCH_GROUP_DOCUMENT_IDS, FORWARD_RETRY_DELAY_CAP_MS, FORWARD_RETRY_INITIAL_DELAY_MS, MAX_CATCH_UP_IN_FLIGHT_BYTES, MAX_DROP_ACKNOWLEDGE_WAIT_MS, MAX_NODE_LEFT_DELAY_MS, MAX_SETTINGS_REPLACEMENT_ATTEMPTS, MAX_SOURCE_ID_LENGTH, MAX_WAIT_FOR_ACTIVE_REPLICAS, MEMORY_SAMPLE_INTERVAL_MS, MIN_CONTROLLER_LEASE_TTL_MS, OUT_OF_STEP_REMOVAL_RETRY_DELAY_CAP_MS, OUT_OF_STEP_REMOVAL_RETRY_INITIAL_DELAY_MS, PARTITION_BYTES_ENTRY_BYTES, PARTITION_BYTES_INDEX_OVERHEAD_BYTES, PARTITION_BYTES_REPORT_BUDGET_BYTES, PARTITION_WRITE_CONCURRENCY, PRIMARY_CHANGE_POLL_INTERVAL_MS, PRIMARY_CHANGE_RETRY_WINDOW_MS, REGISTRATION_LEASE_CONFIRM_TIMEOUT_MS, REGISTRATION_LEASE_DRIFT_SHARE, ROLLBACK_RETRY_DELAY_CAP_MS, ROLLBACK_RETRY_INITIAL_DELAY_MS, SEARCH_CONTEXT_ENTRY_HEAP_BYTES, SEARCH_CONTEXT_REAPER_INTERVAL_MS, SETTINGS_CONTENTION_REASON, SNAPSHOT_CHUNK_YIELD_INTERVAL_MS, SYNCED_POSITION_REPORT_TIMEOUT_MS, WRITE_APPLY_YIELD_INTERVAL_MS, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, answerRefusalOf, createWritePressure, estimateDocumentBytes, estimateDocumentsBytes, estimateForwardedBytes, refuseEncodeWithoutRoom, withAdmittedWrite };
@@ -1,4 +1,4 @@
1
- import { responseStopOf, sendRelayed, parseJson, validateQuery, rejectInvalid, refuseRegex, withServerRerankWindow, requestSignal, respondJson, encodeQueryResult, respondError, loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedBodyBudget, createSharedRequestGate, registerFeedRoute, registerServerRoutes, closeWhenTheProcessExits, statusLine, sendError, REQUEST_THREAD_MOVE_AFTER_MS, MAX_LONG_QUERIES_IN_FLIGHT, createDocumentReadHandlers, SERVER_CAPABILITIES, versionReport, serverRoutes, validateSuggest, isMainFeedNote, SEARCH_CLOCK_SAMPLE_UNITS, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed, stopResponse } from './chunk-GGIW6INA.mjs';
1
+ import { responseStopOf, sendRelayed, parseJson, validateQuery, rejectInvalid, refuseRegex, withServerRerankWindow, requestSignal, respondJson, encodeQueryResult, respondError, loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedBodyBudget, createSharedRequestGate, registerFeedRoute, registerServerRoutes, closeWhenTheProcessExits, statusLine, sendError, REQUEST_THREAD_MOVE_AFTER_MS, MAX_LONG_QUERIES_IN_FLIGHT, createDocumentReadHandlers, SERVER_CAPABILITIES, versionReport, serverRoutes, validateSuggest, isMainFeedNote, SEARCH_CLOCK_SAMPLE_UNITS, awaitDepartureConfirmation, departureConfirmation, REQUEST_THREAD_DEPARTURE_DRAIN_MS, departureConfirmed, stopResponse } from './chunk-MHBG33R5.mjs';
2
2
  import { SYNC_CLOSE_GOING_AWAY, encodeJson } from './chunk-FETZYCH7.mjs';
3
3
  import { importOptionalReads, loadSortingFor, holdsQuotedText, loadQueryCode, executeQuery, lazyQueryBinding, executePreflight, resolveProjection, projectionKeepsField, loadRerankRuntime, setNestedValue } from './chunk-SL53DHVE.mjs';
4
4
  import { loadedMessagePack, loadMessagePack, extractVectorFieldsFromSchema } from './chunk-X5NHWOXT.mjs';
@@ -1,4 +1,4 @@
1
- import { bindResponseStop, sendError, RELAY_STREAM_CHUNKS_IN_FLIGHT } from './chunk-GGIW6INA.mjs';
1
+ import { bindResponseStop, sendError, RELAY_STREAM_CHUNKS_IN_FLIGHT } from './chunk-MHBG33R5.mjs';
2
2
  import { ServerErrorCodes } from './chunk-Q3ZZH5Z7.mjs';
3
3
  import { rm } from 'fs/promises';
4
4
  import path from 'path';
@@ -1,5 +1,5 @@
1
1
  import { encodeJson, SYNC_CLOSE_SERVER_ERROR, SYNC_SUBPROTOCOL, encodeScore } from './chunk-FETZYCH7.mjs';
2
- import { answerRefusalOf } from './chunk-3D4IMFSE.mjs';
2
+ import { answerRefusalOf } from './chunk-2GONI5HL.mjs';
3
3
  import { archiveRange } from './chunk-7WXGUTWK.mjs';
4
4
  import { readRecentMemoryFigures, readMemoryFigures, DEFAULT_RERANK_WINDOW } from './chunk-SL53DHVE.mjs';
5
5
  import { collectGarbageBeforeRefusal, collectYoungGenerationBeforeRefusal, reportRefusalAfterCollection, reservedHeapBytes, admitHeapBytes } from './chunk-F4OOBPKA.mjs';
@@ -8,8 +8,8 @@ import { addBackgroundAdmission, workWaitingForMemory, resolveHybridFusion, fuse
8
8
  import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
9
9
  import { bindEngineWriteBlock, bindIndexReads, syncServingSourceOf, bindSyncServing, validateBackupConfig, BACKUP_SWEEP_INTERVAL_MS, bindWriteBlockLookup, backupKeys, validateBackupName, storedFilesOf, BACKUP_MANIFEST_READS_AT_ONCE, decodeBackupManifest, BACKUP_JOBS_KEY, BACKUP_DELETES_AT_ONCE, BACKUP_PROGRESS_REPORT_INTERVAL_MS, BACKUP_PARTITION_RESULT_RETENTION_MS, BACKUP_JOB_POLL_INTERVAL_MS, SYNC_BACKUP_TAKER, BACKUP_FILES_AT_ONCE, isCount, storeWithoutSaveIfAbsent, CLUSTER_UUID_KEY, isSha256Hex, BACKUP_PUBLISH_RETRY_MS, readRestorePlacement, BACKUP_JOB_CAS_ATTEMPTS, BACKUP_JOB_CAS_RETRY_MS, MAX_CLUSTER_UUID_BYTES, MAX_FINISHED_BACKUP_JOBS, BACKUP_FILE_CHUNK_BYTES, encodeBackupManifest, SYNC_BACKUPS_KEPT, BACKUP_PARTITIONS_AT_ONCE, BACKUP_PARTITION_POLL_INTERVAL_MS, BACKUP_PRIMARY_WAIT_MS, readBackupPartition, readStoredFile } from './chunk-5BUEBIXR.mjs';
10
10
  import { DEFAULT_NODE_LIFECYCLE_CONFIG, DEFAULT_CONTROLLER_CONFIG, readIndexMetadataSnapshot, indexMetadataSnapshotOf, getIndexMetadata, getClusterIndexConfig, withPartitionCount, validateIndexName, suggestionStateOfSettings, indexConfigKey, metadataWithSync, indexConfigFromSettings, metadataWithBm25, readIndexState, storeSynonymSet, deleteSynonymSet, indexSettingsOf, putIndexMetadata, isValidInteger, isRecord, HIDDEN_GENERATION_PREFIX, isRecord2, decodeIndexSettings, metadataWithSynonymSet, RESHARD_RECORD_CAS_ATTEMPTS, indexUuidOfStoredMetadata, storedSynonymSetOf, RESHARD_FORWARD_BATCH_DOCUMENTS, RESHARD_RETRY_DELAY_MS, TEARDOWN_CAS_ATTEMPTS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_POLL_INTERVAL_MS, ALLOCATION_RETRY_DELAY_MS, TEARDOWN_RETRY_ROUNDS, ANALYSIS_CHANGE_RETRY_MS, putIndexReplicationFactor, ALLOCATION_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, MAX_RESHARD_CUTOVER_ATTEMPTS, ANALYSIS_CHANGE_POLL_INTERVAL_MS, RECOVERY_CAS_ATTEMPTS, ESTIMATED_PARTITION_BYTES, REBALANCE_THRESHOLD, putGenerationMetadata, RESHARD_CUTOVER_LAG_ENTRIES, ANALYSIS_REBUILD_RESEND_MS, RESHARD_CUTOVER_TIMEOUT_MS, PARTITION_STORES_TIMEOUT_MS, SYNC_EPOCH_CAS_ATTEMPTS, LEADERSHIP_IMBALANCE_THRESHOLD, BOOTSTRAP_CAS_ATTEMPTS, metadataWithSuggestionState } from './chunk-CODGHJVW.mjs';
11
- import { MAX_WAIT_FOR_ACTIVE_REPLICAS, MIN_CONTROLLER_LEASE_TTL_MS, MAX_NODE_LEFT_DELAY_MS, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_CAPACITY, CATCH_UP_TICK_MS, MEMORY_SAMPLE_INTERVAL_MS, createWritePressure, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, DEFAULT_IN_FLIGHT_WRITE_FRACTION, MAX_SETTINGS_REPLACEMENT_ATTEMPTS, SETTINGS_CONTENTION_REASON, MAX_DROP_ACKNOWLEDGE_WAIT_MS, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DEFAULT_CREATE_INDEX_WAIT_MS, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS, DROP_ACKNOWLEDGE_POLL_INTERVAL_MS, COORDINATOR_REQUEST_BUCKET_BOUNDS_SECONDS, COPY_FAILURE_ATTEMPTS, SEARCH_CONTEXT_REAPER_INTERVAL_MS, DECOMMISSION_RECHECK_INTERVAL_MS, refuseEncodeWithoutRoom, answerRefusalOf, withAdmittedWrite, estimateForwardedBytes, PARTITION_BYTES_INDEX_OVERHEAD_BYTES, MAX_SOURCE_ID_LENGTH, ADMISSION_TIMEOUT_MS, PARTITION_BYTES_ENTRY_BYTES, PARTITION_BYTES_REPORT_BUDGET_BYTES, CATCH_UP_FEED_WINDOW_MS, MAX_CATCH_UP_IN_FLIGHT_BYTES, SYNCED_POSITION_REPORT_TIMEOUT_MS, SNAPSHOT_CHUNK_YIELD_INTERVAL_MS, ANSWER_DECODE_HEAP_BYTES_PER_PAYLOAD_BYTE, REGISTRATION_LEASE_DRIFT_SHARE, REGISTRATION_LEASE_CONFIRM_TIMEOUT_MS, WRITE_APPLY_YIELD_INTERVAL_MS, ROLLBACK_RETRY_INITIAL_DELAY_MS, ROLLBACK_RETRY_DELAY_CAP_MS, FETCH_GROUP_DOCUMENT_IDS, COPY_FAILURE_RETRY_DELAY_MS, SEARCH_CONTEXT_ENTRY_HEAP_BYTES, CLEAR_PAGE_SIZE, estimateDocumentsBytes, estimateDocumentBytes, PRIMARY_CHANGE_RETRY_WINDOW_MS, PRIMARY_CHANGE_POLL_INTERVAL_MS, PARTITION_WRITE_CONCURRENCY, FORWARD_RETRY_INITIAL_DELAY_MS, FORWARD_RETRY_DELAY_CAP_MS } from './chunk-3D4IMFSE.mjs';
12
- export { DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR } from './chunk-3D4IMFSE.mjs';
11
+ import { MAX_WAIT_FOR_ACTIVE_REPLICAS, MIN_CONTROLLER_LEASE_TTL_MS, MAX_NODE_LEFT_DELAY_MS, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_CAPACITY, CATCH_UP_TICK_MS, MEMORY_SAMPLE_INTERVAL_MS, createWritePressure, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, DEFAULT_IN_FLIGHT_WRITE_FRACTION, MAX_SETTINGS_REPLACEMENT_ATTEMPTS, SETTINGS_CONTENTION_REASON, MAX_DROP_ACKNOWLEDGE_WAIT_MS, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DEFAULT_CREATE_INDEX_WAIT_MS, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS, DROP_ACKNOWLEDGE_POLL_INTERVAL_MS, COORDINATOR_REQUEST_BUCKET_BOUNDS_SECONDS, COPY_FAILURE_ATTEMPTS, SEARCH_CONTEXT_REAPER_INTERVAL_MS, DECOMMISSION_RECHECK_INTERVAL_MS, refuseEncodeWithoutRoom, answerRefusalOf, withAdmittedWrite, estimateForwardedBytes, PARTITION_BYTES_INDEX_OVERHEAD_BYTES, MAX_SOURCE_ID_LENGTH, ADMISSION_TIMEOUT_MS, PARTITION_BYTES_ENTRY_BYTES, PARTITION_BYTES_REPORT_BUDGET_BYTES, CATCH_UP_FEED_WINDOW_MS, MAX_CATCH_UP_IN_FLIGHT_BYTES, SYNCED_POSITION_REPORT_TIMEOUT_MS, SNAPSHOT_CHUNK_YIELD_INTERVAL_MS, ANSWER_DECODE_HEAP_BYTES_PER_PAYLOAD_BYTE, REGISTRATION_LEASE_DRIFT_SHARE, REGISTRATION_LEASE_CONFIRM_TIMEOUT_MS, WRITE_APPLY_YIELD_INTERVAL_MS, ROLLBACK_RETRY_INITIAL_DELAY_MS, ROLLBACK_RETRY_DELAY_CAP_MS, OUT_OF_STEP_REMOVAL_RETRY_INITIAL_DELAY_MS, OUT_OF_STEP_REMOVAL_RETRY_DELAY_CAP_MS, FETCH_GROUP_DOCUMENT_IDS, COPY_FAILURE_RETRY_DELAY_MS, SEARCH_CONTEXT_ENTRY_HEAP_BYTES, CLEAR_PAGE_SIZE, estimateDocumentsBytes, estimateDocumentBytes, PRIMARY_CHANGE_RETRY_WINDOW_MS, PRIMARY_CHANGE_POLL_INTERVAL_MS, PARTITION_WRITE_CONCURRENCY, FORWARD_RETRY_INITIAL_DELAY_MS, FORWARD_RETRY_DELAY_CAP_MS } from './chunk-2GONI5HL.mjs';
12
+ export { DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR } from './chunk-2GONI5HL.mjs';
13
13
  import { encodeIndexConfiguration, MAX_SNAPSHOT_ANALYSIS_ATTEMPTS, requireSyncSetting, requireNoQuerySuggestions, decodeIndexConfiguration, INDEX_CONFIGURATION_ENVELOPE_VERSION } from './chunk-URVH6BLO.mjs';
14
14
  import { restoredConfigFields, restoredEmbedding } from './chunk-N3M4NPML.mjs';
15
15
  import { estimatedArchiveBytes, readSnapshotArchive, archiveLayout, openManifestPayload, sourceIndexNameOf, listedKeysOf, decodeManifestPayload } from './chunk-7WXGUTWK.mjs';
@@ -3433,6 +3433,7 @@ function createCatchUpState() {
3433
3433
  admissionGenerations: /* @__PURE__ */ new Map(),
3434
3434
  lastAdmissionGeneration: 0,
3435
3435
  startedTerms: /* @__PURE__ */ new Map(),
3436
+ outOfStepRemovals: /* @__PURE__ */ new Map(),
3436
3437
  inFlightBytes: 0,
3437
3438
  timer: null,
3438
3439
  activeTick: null,
@@ -3505,6 +3506,18 @@ function forgetCatchUpIndex(state, indexName) {
3505
3506
  forgetKeysOfIndex(state.removedReplicas, indexName);
3506
3507
  forgetKeysOfIndex(state.admissionGenerations, indexName);
3507
3508
  forgetKeysOfIndex(state.startedTerms, indexName);
3509
+ forgetKeysOfIndex(state.outOfStepRemovals, indexName);
3510
+ }
3511
+ function forgetOutOfStepRemovalsOfIndex(state, indexName) {
3512
+ for (const key of [...state.outOfStepRemovals.keys()]) {
3513
+ if (key.slice(0, key.lastIndexOf(":")) !== indexName) continue;
3514
+ state.outOfStepRemovals.delete(key);
3515
+ state.startedTerms.delete(key);
3516
+ }
3517
+ }
3518
+ function feedsReplica(state, indexName, partitionId, replicaNodeId) {
3519
+ const key = partitionKey(indexName, partitionId);
3520
+ return state.cursors.get(key)?.has(replicaNodeId) === true || state.pendingAdmissions.get(key)?.has(replicaNodeId) === true;
3508
3521
  }
3509
3522
  function getPendingAdmissions(state, indexName, partitionId) {
3510
3523
  const pending = state.pendingAdmissions.get(partitionKey(indexName, partitionId));
@@ -3699,44 +3712,50 @@ async function removeFailedReplicasFromInsync(entry, failedReplicas, deps) {
3699
3712
  );
3700
3713
  }
3701
3714
  async function removeEachFailedReplica(entry, failedReplicas, deps) {
3715
+ const controllerNodeId = await controllerForRemoval(entry, failedReplicas, deps);
3716
+ for (const replicaNodeId of failedReplicas) {
3717
+ const generationAtRemoval = admissionGenerationOf(deps.catchUp, entry.indexName, entry.partitionId, replicaNodeId);
3718
+ await removeReplicaFromInsync(entry, replicaNodeId, controllerNodeId, generationAtRemoval, deps);
3719
+ }
3720
+ }
3721
+ async function controllerForRemoval(entry, failedReplicas, deps) {
3702
3722
  const controllerNodeId = await deps.coordinator.getLeaseHolder(CONTROLLER_LEASE_KEY);
3703
- if (controllerNodeId === null) {
3723
+ if (controllerNodeId !== null) return controllerNodeId;
3724
+ await deps.refreshAllocation?.(entry.indexName);
3725
+ await assertPrimaryWriteAuthority(entry, deps);
3726
+ throw new NarsilError(
3727
+ ErrorCodes.REPLICATION_INSYNC_REMOVAL_FAILED,
3728
+ `Failed to remove replicas from in-sync set for index '${entry.indexName}': no active controller lease holder`,
3729
+ { indexName: entry.indexName, partitionId: entry.partitionId, failedReplicas }
3730
+ );
3731
+ }
3732
+ async function removeReplicaFromInsync(entry, replicaNodeId, controllerNodeId, generationAtRemoval, deps, stillWanted) {
3733
+ const accepted = await requestInsyncRemovalWithTargets(
3734
+ entry.indexName,
3735
+ entry.partitionId,
3736
+ replicaNodeId,
3737
+ entry.primaryTerm,
3738
+ controllerNodeId,
3739
+ deps,
3740
+ stillWanted
3741
+ );
3742
+ if (!accepted) {
3704
3743
  await deps.refreshAllocation?.(entry.indexName);
3705
3744
  await assertPrimaryWriteAuthority(entry, deps);
3706
3745
  throw new NarsilError(
3707
3746
  ErrorCodes.REPLICATION_INSYNC_REMOVAL_FAILED,
3708
- `Failed to remove replicas from in-sync set for index '${entry.indexName}': no active controller lease holder`,
3709
- { indexName: entry.indexName, partitionId: entry.partitionId, failedReplicas }
3710
- );
3711
- }
3712
- for (const replicaNodeId of failedReplicas) {
3713
- const generationAtRemoval = admissionGenerationOf(deps.catchUp, entry.indexName, entry.partitionId, replicaNodeId);
3714
- const accepted = await requestInsyncRemovalWithTargets(
3715
- entry.indexName,
3716
- entry.partitionId,
3717
- replicaNodeId,
3718
- entry.primaryTerm,
3719
- controllerNodeId,
3720
- deps
3721
- );
3722
- if (!accepted) {
3723
- await deps.refreshAllocation?.(entry.indexName);
3724
- await assertPrimaryWriteAuthority(entry, deps);
3725
- throw new NarsilError(
3726
- ErrorCodes.REPLICATION_INSYNC_REMOVAL_FAILED,
3727
- `Controller rejected in-sync removal for replica '${replicaNodeId}' of index '${entry.indexName}' partition ${entry.partitionId}`,
3728
- { indexName: entry.indexName, partitionId: entry.partitionId, replicaNodeId }
3729
- );
3730
- }
3731
- recordRemovalUnlessReadmitted(
3732
- deps.catchUp,
3733
- entry.indexName,
3734
- entry.partitionId,
3735
- replicaNodeId,
3736
- entry.primaryTerm,
3737
- generationAtRemoval
3747
+ `Controller rejected in-sync removal for replica '${replicaNodeId}' of index '${entry.indexName}' partition ${entry.partitionId}`,
3748
+ { indexName: entry.indexName, partitionId: entry.partitionId, replicaNodeId }
3738
3749
  );
3739
3750
  }
3751
+ recordRemovalUnlessReadmitted(
3752
+ deps.catchUp,
3753
+ entry.indexName,
3754
+ entry.partitionId,
3755
+ replicaNodeId,
3756
+ entry.primaryTerm,
3757
+ generationAtRemoval
3758
+ );
3740
3759
  }
3741
3760
  function replicaTargetsOf(entry, assignment, deps) {
3742
3761
  const admitted = admittedBeyondTable(deps.catchUp, entry.indexName, entry.partitionId, assignment);
@@ -3750,11 +3769,28 @@ function replicaTargetsOf(entry, assignment, deps) {
3750
3769
  );
3751
3770
  return { admitted, targets };
3752
3771
  }
3753
- async function requestInsyncRemovalWithTargets(indexName, partitionId, replicaNodeId, primaryTerm, controllerNodeId, deps) {
3772
+ async function requestInsyncRemovalWithTargets(indexName, partitionId, replicaNodeId, primaryTerm, controllerNodeId, deps, stillWanted) {
3754
3773
  const targets = await resolveNodeTargets(controllerNodeId, deps);
3755
3774
  const result = await sendThroughTargets(
3756
3775
  targets,
3757
- (target) => requestInsyncRemoval(indexName, partitionId, replicaNodeId, primaryTerm, target, deps.transport, deps.nodeId),
3776
+ async (target) => {
3777
+ if (stillWanted?.() === false) {
3778
+ throw new NarsilError(
3779
+ ErrorCodes.REPLICATION_INSYNC_REMOVAL_FAILED,
3780
+ `The primary no longer wants replica '${replicaNodeId}' of index '${indexName}' partition ${partitionId} removed from the in-sync set, so it sent no removal request`,
3781
+ { indexName, partitionId, replicaNodeId, controllerNodeId }
3782
+ );
3783
+ }
3784
+ return requestInsyncRemoval(
3785
+ indexName,
3786
+ partitionId,
3787
+ replicaNodeId,
3788
+ primaryTerm,
3789
+ target,
3790
+ deps.transport,
3791
+ deps.nodeId
3792
+ );
3793
+ },
3758
3794
  {
3759
3795
  message: `Controller '${controllerNodeId}' did not answer an in-sync removal request for index '${indexName}' partition ${partitionId}`,
3760
3796
  details: { indexName, partitionId, replicaNodeId, controllerNodeId }
@@ -4234,8 +4270,8 @@ function refusedByPrimaryChange(error, retriesEndedTerm = false) {
4234
4270
  return abandonedWithTerm(error) && (retriesEndedTerm || abandonedWriteOf(error) !== void 0);
4235
4271
  }
4236
4272
  function nextCondition(error, current) {
4237
- const abandoned = abandonedWriteOf(error);
4238
- return abandoned === void 0 ? current : conditionOf(abandoned);
4273
+ const abandoned2 = abandonedWriteOf(error);
4274
+ return abandoned2 === void 0 ? current : conditionOf(abandoned2);
4239
4275
  }
4240
4276
  function refusedForAnotherIndex(error) {
4241
4277
  return refusedByPrimaryChange(error) && error instanceof NarsilError && typeof error.details.heldIndexUuid === "string";
@@ -4496,7 +4532,7 @@ function createGroupCommit(scope, appended, failed2) {
4496
4532
  async function replicateAppendedWrites(scope, appended, failed2, compensate, deps) {
4497
4533
  const succeeded2 = [];
4498
4534
  const chunks = chunkReplicationEntries(appended);
4499
- const abandoned = [];
4535
+ const abandoned2 = [];
4500
4536
  let abortError;
4501
4537
  for (const chunk of chunks) {
4502
4538
  if (abortError === void 0) {
@@ -4513,14 +4549,14 @@ async function replicateAppendedWrites(scope, appended, failed2, compensate, dep
4513
4549
  abortError = error;
4514
4550
  }
4515
4551
  }
4516
- abandoned.push(...chunk);
4552
+ abandoned2.push(...chunk);
4517
4553
  }
4518
- const first = abandoned[0];
4554
+ const first = abandoned2[0];
4519
4555
  if (first === void 0) return succeeded2;
4520
4556
  const failedAt = Date.now();
4521
4557
  const compensated = [];
4522
- for (let index = abandoned.length - 1; index >= 0; index--) {
4523
- const item = abandoned[index];
4558
+ for (let index = abandoned2.length - 1; index >= 0; index--) {
4559
+ const item = abandoned2[index];
4524
4560
  try {
4525
4561
  const compensation = await compensate(item, abortError);
4526
4562
  compensated.push({ item, compensation: compensation ?? null });
@@ -4797,6 +4833,127 @@ function termStartAckOf(response, request) {
4797
4833
  }
4798
4834
  }
4799
4835
 
4836
+ // src/distribution/cluster-node/write-routing/out-of-step-removal.ts
4837
+ function termOf(scope) {
4838
+ return { indexName: scope.indexName, partitionId: scope.partitionId, primaryTerm: scope.assignment.primaryTerm };
4839
+ }
4840
+ function claimOutOfStepRemoval(scope) {
4841
+ const { catchUp } = scope.deps;
4842
+ const key = partitionKey(scope.indexName, scope.partitionId);
4843
+ const current = catchUp.outOfStepRemovals.get(key);
4844
+ if (current !== void 0 && current.primaryTerm > scope.assignment.primaryTerm) return void 0;
4845
+ const removal = { primaryTerm: scope.assignment.primaryTerm };
4846
+ catchUp.outOfStepRemovals.set(key, removal);
4847
+ return removal;
4848
+ }
4849
+ function releaseOutOfStepRemoval(scope, removal) {
4850
+ const { catchUp } = scope.deps;
4851
+ const key = partitionKey(scope.indexName, scope.partitionId);
4852
+ if (catchUp.outOfStepRemovals.get(key) === removal) catchUp.outOfStepRemovals.delete(key);
4853
+ }
4854
+ function outOfStepCopyOf(scope, replicaNodeId) {
4855
+ const { deps, indexName, partitionId } = scope;
4856
+ return { replicaNodeId, generation: admissionGenerationOf(deps.catchUp, indexName, partitionId, replicaNodeId) };
4857
+ }
4858
+ async function removeOutOfStepCopies(scope, removal, copies) {
4859
+ const pending = { copies };
4860
+ let settled = true;
4861
+ try {
4862
+ settled = await attemptRemoval(scope, removal, pending, false);
4863
+ } catch (error) {
4864
+ settled = lostTerm(error);
4865
+ }
4866
+ if (settled || abandoned(scope, removal)) {
4867
+ releaseOutOfStepRemoval(scope, removal);
4868
+ return;
4869
+ }
4870
+ void keepRemoving(scope, pending, removal).catch(() => void 0).finally(() => releaseOutOfStepRemoval(scope, removal));
4871
+ }
4872
+ function abandoned(scope, removal) {
4873
+ const { deps, indexName, partitionId } = scope;
4874
+ return deps.stopped?.() === true || deps.catchUp.stopped || deps.catchUp.outOfStepRemovals.get(partitionKey(indexName, partitionId)) !== removal;
4875
+ }
4876
+ function admittedSince(scope, copy) {
4877
+ const { deps, indexName, partitionId } = scope;
4878
+ return !admissionGenerationIs(deps.catchUp, indexName, partitionId, copy.replicaNodeId, copy.generation);
4879
+ }
4880
+ function removable(scope, copy) {
4881
+ const { deps, indexName, partitionId } = scope;
4882
+ return !admittedSince(scope, copy) && !feedsReplica(deps.catchUp, indexName, partitionId, copy.replicaNodeId);
4883
+ }
4884
+ function stillInSync(scope, current, copies) {
4885
+ const { deps, indexName, partitionId } = scope;
4886
+ const inSync = withoutRemovedReplicas(
4887
+ deps.catchUp,
4888
+ indexName,
4889
+ partitionId,
4890
+ current.primaryTerm,
4891
+ copies.map((copy) => copy.replicaNodeId).filter((replicaNodeId) => current.inSyncSet.includes(replicaNodeId))
4892
+ );
4893
+ return copies.filter((copy) => inSync.includes(copy.replicaNodeId));
4894
+ }
4895
+ async function tryRemoval(scope, pending, refresh, live) {
4896
+ if (!live()) return false;
4897
+ pending.copies = pending.copies.filter((copy) => !admittedSince(scope, copy));
4898
+ if (refresh && pending.copies.length > 0) {
4899
+ const current = await leadingAssignment(scope);
4900
+ if (!live()) return false;
4901
+ pending.copies = stillInSync(scope, current, pending.copies);
4902
+ }
4903
+ let controllerNodeId;
4904
+ for (const copy of [...pending.copies]) {
4905
+ if (!removable(scope, copy)) continue;
4906
+ if (controllerNodeId === void 0) {
4907
+ controllerNodeId = await controllerForRemoval(
4908
+ termOf(scope),
4909
+ pending.copies.map((other) => other.replicaNodeId),
4910
+ scope.deps
4911
+ );
4912
+ if (!live()) return false;
4913
+ if (!removable(scope, copy)) continue;
4914
+ }
4915
+ const wanted = () => live() && removable(scope, copy);
4916
+ await removeReplicaFromInsync(
4917
+ termOf(scope),
4918
+ copy.replicaNodeId,
4919
+ controllerNodeId,
4920
+ copy.generation,
4921
+ scope.deps,
4922
+ wanted
4923
+ );
4924
+ if (!live()) return false;
4925
+ pending.copies = pending.copies.filter((other) => other !== copy);
4926
+ }
4927
+ pending.copies = pending.copies.filter((copy) => !admittedSince(scope, copy));
4928
+ return pending.copies.length === 0;
4929
+ }
4930
+ async function attemptRemoval(scope, removal, pending, refresh) {
4931
+ const timeoutMs = replicationTimeoutOf(scope.deps);
4932
+ let open3 = true;
4933
+ try {
4934
+ return await withinDeadline(
4935
+ tryRemoval(scope, pending, refresh, () => open3 && !abandoned(scope, removal)),
4936
+ timeoutMs,
4937
+ () => new Error(`A try to remove out-of-step copies did not finish within ${timeoutMs}ms`)
4938
+ );
4939
+ } finally {
4940
+ open3 = false;
4941
+ }
4942
+ }
4943
+ async function keepRemoving(scope, pending, removal) {
4944
+ let delayMs = OUT_OF_STEP_REMOVAL_RETRY_INITIAL_DELAY_MS;
4945
+ for (; ; ) {
4946
+ await pause(delayMs);
4947
+ if (abandoned(scope, removal)) return;
4948
+ try {
4949
+ if (await attemptRemoval(scope, removal, pending, true)) return;
4950
+ } catch (error) {
4951
+ if (lostTerm(error)) return;
4952
+ }
4953
+ delayMs = Math.min(delayMs * 2, OUT_OF_STEP_REMOVAL_RETRY_DELAY_CAP_MS);
4954
+ }
4955
+ }
4956
+
4800
4957
  // src/distribution/cluster-node/write-routing/term-start.ts
4801
4958
  async function startTermInQueue(scope) {
4802
4959
  const { deps, indexName, partitionId, assignment } = scope;
@@ -4805,13 +4962,28 @@ async function startTermInQueue(scope) {
4805
4962
  deps.catchUp.startedTerms.set(key, assignment.primaryTerm);
4806
4963
  const copies = getInSyncReplicaTargets(assignment, deps.nodeId);
4807
4964
  if (copies.length === 0) return false;
4808
- const work = startTermOnCopies(scope, copies).catch(() => void 0);
4965
+ const removal = claimOutOfStepRemoval(scope);
4966
+ const work = startTermOnCopies(scope, copies, removal).catch(() => void 0);
4809
4967
  await withinDeadline(work, replicationTimeoutOf(deps), () => new Error("The term start outlasted its hold")).catch(
4810
4968
  () => void 0
4811
4969
  );
4812
4970
  return true;
4813
4971
  }
4814
- async function startTermOnCopies(scope, copies) {
4972
+ async function startTermOnCopies(scope, copies, removal) {
4973
+ let outOfStep = [];
4974
+ try {
4975
+ outOfStep = await settleCopies(scope, copies);
4976
+ } finally {
4977
+ if (removal !== void 0) {
4978
+ await removeOutOfStepCopies(
4979
+ scope,
4980
+ removal,
4981
+ outOfStep.filter((copy) => copy !== null)
4982
+ );
4983
+ }
4984
+ }
4985
+ }
4986
+ async function settleCopies(scope, copies) {
4815
4987
  const { deps, indexName, partitionId, assignment } = scope;
4816
4988
  const log = deps.getReplicationLog(indexName, partitionId);
4817
4989
  const lastSeqNo = log.localLogEnd;
@@ -4823,9 +4995,13 @@ async function startTermOnCopies(scope, copies) {
4823
4995
  lastPrimaryTerm: lastSeqNo === 0 ? 0 : log.termAt(lastSeqNo) ?? 0
4824
4996
  };
4825
4997
  if (scope.indexUuid !== void 0) request.indexUuid = scope.indexUuid;
4826
- const inStep = await Promise.all(copies.map((copy) => settleCopy(scope, log, request, copy).catch(() => false)));
4827
- const removed = copies.filter((_, at) => !inStep[at]);
4828
- await removeFailedReplicasFromInsync({ indexName, partitionId, primaryTerm: assignment.primaryTerm }, removed, deps);
4998
+ return Promise.all(
4999
+ copies.map(async (copy) => {
5000
+ const beforeRequest = outOfStepCopyOf(scope, copy);
5001
+ const inStep = await settleCopy(scope, log, request, copy).catch(() => false);
5002
+ return inStep ? null : beforeRequest;
5003
+ })
5004
+ );
4829
5005
  }
4830
5006
  async function settleCopy(scope, log, request, copy) {
4831
5007
  const { deps } = scope;
@@ -14825,6 +15001,7 @@ function deleteIndexReplicationLogs(replicationLogs, indexName) {
14825
15001
  function forgetClosedCopy(state, indexName) {
14826
15002
  deleteIndexReplicationLogs(state.replicationLogs, indexName);
14827
15003
  forgetReshardIndex(state.reshard, indexName);
15004
+ forgetOutOfStepRemovalsOfIndex(state.catchUp(), indexName);
14828
15005
  }
14829
15006
  function forgetDroppedCopy(state, indexName) {
14830
15007
  forgetClosedCopy(state, indexName);
@@ -1,8 +1,8 @@
1
- import { createRelayClient, createThreadReadEngine, searchHandler, isLongQueryPortNote } from './chunk-HQPK73EW.mjs';
2
- import { answerRequest } from './chunk-SEM3PBRH.mjs';
3
- import './chunk-GGIW6INA.mjs';
1
+ import { createRelayClient, createThreadReadEngine, searchHandler, isLongQueryPortNote } from './chunk-FBQYC5OX.mjs';
2
+ import { answerRequest } from './chunk-JDG6CCXM.mjs';
3
+ import './chunk-MHBG33R5.mjs';
4
4
  import './chunk-FETZYCH7.mjs';
5
- import './chunk-3D4IMFSE.mjs';
5
+ import './chunk-2GONI5HL.mjs';
6
6
  import './chunk-7WXGUTWK.mjs';
7
7
  import './chunk-2KCCQK4R.mjs';
8
8
  import './chunk-CV3Q2EKO.mjs';
package/dist/server.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import { answerRequest } from './chunk-SEM3PBRH.mjs';
1
+ import { answerRequest } from './chunk-JDG6CCXM.mjs';
2
2
  import { resolveVectorText } from './chunk-EWGIF6FQ.mjs';
3
- import { DEFAULT_MAX_RETAINED_TASKS, loadUWebSockets, registerFeedRoute, resolveCors, authorizerFor, createSharedGateBuffer, gateSlotOfWorker, createBodyBudgetBuffer, createRouteRunner, corsHeaderReader, createSharedBodyBudget, MAIN_THREAD_GATE_SLOT, createSharedRequestGate, registerServerRoutes, DEFAULT_MAX_FEED_BUFFERED_BYTES, DEFAULT_MAX_FEED_CATCH_UPS, DEFAULT_MAX_FEED_CONNECTIONS, DEFAULT_FEED_WINDOW_BYTES, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, RUNNING_TASK_TTL_MS, DEFAULT_TASK_PAGE_SIZE, TERMINAL_TASK_TTL_MS, TASK_PROGRESS_WRITE_INTERVAL_MS, serializeNarsilError, createVersionHandler, createSyncSnapshotHandler, acceptorOf, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, toHttpError, createDocumentReadHandlers, sendError, respondError, respondJson, sendText, PROMETHEUS_TEXT_CONTENT_TYPE, MAX_INDEX_TOUCH_INTERVAL_MS, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, closeEveryThreadAtExit, REQUEST_THREAD_CLOSE_AT_EXIT_MS, clearGateSlot, clearBodyBudgetSlot, createCloseAtExitWords, createDepartureWord, departureConfirmed, TIMER_DELAY_LIMIT_MS, FEED_HEAD_RETRY_MS, parseJson, validateCreateIndex, rejectInvalid, isRemoveOnlyBatch, validateBatch, serializeBatchResult, parseWriteJson, validateDocumentBody, validateSuggest, validateQuery, refuseRegex, requestSignal, withServerRerankWindow, respondAnswer, encodeQueryResult, parseTaskListQuery, parseJsonOptional, validateChangeAnalysis, validateRebalance, badRequest, sendStream, SNAPSHOT_ARCHIVE_CONTENT_TYPE, DOCUMENT_EXPORT_CONTENT_TYPE, parseRefusalOf, IMPORT_FLUSHES_IN_FLIGHT, confirmDeparture, isThreadFeedNote, ENTRIES_MESSAGE_LIMIT_BYTES, SERVER_CAPABILITIES, MIN_UNBOUNDED_SERVER_LIMIT, MIN_COUNTED_SERVER_LIMIT } from './chunk-GGIW6INA.mjs';
4
- export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, CHANGE_ANALYSIS_CAPABILITY, DOCUMENT_EXPORT_CAPABILITY, INDEX_LIFECYCLE_CAPABILITY, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, httpStatusForNarsilError } from './chunk-GGIW6INA.mjs';
3
+ import { DEFAULT_MAX_RETAINED_TASKS, loadUWebSockets, registerFeedRoute, resolveCors, authorizerFor, createSharedGateBuffer, gateSlotOfWorker, createBodyBudgetBuffer, createRouteRunner, corsHeaderReader, createSharedBodyBudget, MAIN_THREAD_GATE_SLOT, createSharedRequestGate, registerServerRoutes, DEFAULT_MAX_FEED_BUFFERED_BYTES, DEFAULT_MAX_FEED_CATCH_UPS, DEFAULT_MAX_FEED_CONNECTIONS, DEFAULT_FEED_WINDOW_BYTES, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, RUNNING_TASK_TTL_MS, DEFAULT_TASK_PAGE_SIZE, TERMINAL_TASK_TTL_MS, TASK_PROGRESS_WRITE_INTERVAL_MS, serializeNarsilError, createVersionHandler, createSyncSnapshotHandler, acceptorOf, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, toHttpError, createDocumentReadHandlers, sendError, respondError, respondJson, sendText, PROMETHEUS_TEXT_CONTENT_TYPE, MAX_INDEX_TOUCH_INTERVAL_MS, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, closeEveryThreadAtExit, REQUEST_THREAD_CLOSE_AT_EXIT_MS, clearGateSlot, clearBodyBudgetSlot, createCloseAtExitWords, createDepartureWord, departureConfirmed, TIMER_DELAY_LIMIT_MS, FEED_HEAD_RETRY_MS, parseJson, validateCreateIndex, rejectInvalid, isRemoveOnlyBatch, validateBatch, serializeBatchResult, parseWriteJson, validateDocumentBody, validateSuggest, validateQuery, refuseRegex, requestSignal, withServerRerankWindow, respondAnswer, encodeQueryResult, parseTaskListQuery, parseJsonOptional, validateChangeAnalysis, validateRebalance, badRequest, sendStream, SNAPSHOT_ARCHIVE_CONTENT_TYPE, DOCUMENT_EXPORT_CONTENT_TYPE, parseRefusalOf, IMPORT_FLUSHES_IN_FLIGHT, confirmDeparture, isThreadFeedNote, ENTRIES_MESSAGE_LIMIT_BYTES, SERVER_CAPABILITIES, MIN_UNBOUNDED_SERVER_LIMIT, MIN_COUNTED_SERVER_LIMIT } from './chunk-MHBG33R5.mjs';
4
+ export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, CHANGE_ANALYSIS_CAPABILITY, DOCUMENT_EXPORT_CAPABILITY, INDEX_LIFECYCLE_CAPABILITY, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, httpStatusForNarsilError } from './chunk-MHBG33R5.mjs';
5
5
  import { startSyncRetentionSweep, publishedSyncSnapshot, publishedArchiveLayout } from './chunk-O337MDRJ.mjs';
6
6
  import { SYNC_CLOSE_RESYNC, SYNC_CLOSE_CREDENTIAL_EXPIRED, SYNC_CLOSE_POLICY, MAX_DEVICE_MESSAGE_BYTES, SYNC_CLOSE_TOO_LARGE, deviceMessageOf, SYNC_CLOSE_SERVER_ERROR, positionList, positionsByPartition, SYNC_CLOSE_GOING_AWAY } from './chunk-FETZYCH7.mjs';
7
7
  import { syncServingSourceOf, writeBlockLookupOf, indexReadsOf, validateBackupName, readRestorePlacement } from './chunk-5BUEBIXR.mjs';
8
8
  import { isRecord, validateIndexName } from './chunk-CODGHJVW.mjs';
9
- import './chunk-3D4IMFSE.mjs';
9
+ import './chunk-2GONI5HL.mjs';
10
10
  import './chunk-URVH6BLO.mjs';
11
11
  import './chunk-N3M4NPML.mjs';
12
12
  import { estimatedArchiveBytes } from './chunk-7WXGUTWK.mjs';
@@ -1,7 +1,7 @@
1
- export { closeRequestThread, searchHandler, serveRequests } from './chunk-HQPK73EW.mjs';
2
- import './chunk-GGIW6INA.mjs';
1
+ export { closeRequestThread, searchHandler, serveRequests } from './chunk-FBQYC5OX.mjs';
2
+ import './chunk-MHBG33R5.mjs';
3
3
  import './chunk-FETZYCH7.mjs';
4
- import './chunk-3D4IMFSE.mjs';
4
+ import './chunk-2GONI5HL.mjs';
5
5
  import './chunk-7WXGUTWK.mjs';
6
6
  import './chunk-2KCCQK4R.mjs';
7
7
  import './chunk-CV3Q2EKO.mjs';
@@ -32,9 +32,9 @@ async function importBootstrapModule(moduleUrl) {
32
32
  await import(moduleUrl);
33
33
  }
34
34
  async function stopServingRequests() {
35
- const { closeRequestThread } = await import('../thread-BJXE77AI.mjs');
35
+ const { closeRequestThread } = await import('../thread-NQRNW3IH.mjs');
36
36
  closeRequestThread();
37
- const { closeLongQueryThread } = await import('../long-query-thread-PU2XT527.mjs');
37
+ const { closeLongQueryThread } = await import('../long-query-thread-DIPJBMV7.mjs');
38
38
  closeLongQueryThread();
39
39
  }
40
40
  function holdsCopies(executor) {
@@ -87,7 +87,7 @@ function createActionHandler(executor) {
87
87
  if (!holdsCopies(executor)) {
88
88
  throw new NarsilError(ErrorCodes.CONFIG_INVALID, "This executor holds no copies to answer requests from");
89
89
  }
90
- const starting = import('../thread-BJXE77AI.mjs').then(
90
+ const starting = import('../thread-NQRNW3IH.mjs').then(
91
91
  ({ serveRequests }) => serveRequests(executor, action.settings)
92
92
  );
93
93
  serving.start = starting.then(
@@ -104,7 +104,7 @@ function createActionHandler(executor) {
104
104
  if (!holdsCopies(executor)) {
105
105
  throw new NarsilError(ErrorCodes.CONFIG_INVALID, "This executor holds no copies to answer long queries from");
106
106
  }
107
- const { serveLongQueries } = await import('../long-query-thread-PU2XT527.mjs');
107
+ const { serveLongQueries } = await import('../long-query-thread-DIPJBMV7.mjs');
108
108
  serveLongQueries(executor, action.settings);
109
109
  servingRequests = true;
110
110
  post(buildSuccessResponse(action.requestId, void 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delali/narsil",
3
- "version": "0.3.1-next.184",
3
+ "version": "0.3.1-next.185",
4
4
  "type": "module",
5
5
  "description": "Distributed search engine with full-text, vector, hybrid, and geosearch. One engine, embedded or on a server, with a cross-language .nrsl format.",
6
6
  "author": "Delali (https://sondelali.com)",
@@ -653,11 +653,11 @@
653
653
  }
654
654
  },
655
655
  "optionalDependencies": {
656
- "@delali/narsil-native-darwin-arm64": "0.3.1-next.184",
657
- "@delali/narsil-native-darwin-x64": "0.3.1-next.184",
658
- "@delali/narsil-native-linux-arm64": "0.3.1-next.184",
659
- "@delali/narsil-native-linux-x64": "0.3.1-next.184",
660
- "@delali/narsil-native-win32-arm64": "0.3.1-next.184",
661
- "@delali/narsil-native-win32-x64": "0.3.1-next.184"
656
+ "@delali/narsil-native-darwin-arm64": "0.3.1-next.185",
657
+ "@delali/narsil-native-darwin-x64": "0.3.1-next.185",
658
+ "@delali/narsil-native-linux-arm64": "0.3.1-next.185",
659
+ "@delali/narsil-native-linux-x64": "0.3.1-next.185",
660
+ "@delali/narsil-native-win32-arm64": "0.3.1-next.185",
661
+ "@delali/narsil-native-win32-x64": "0.3.1-next.185"
662
662
  }
663
663
  }