sliftutils 1.7.20 → 1.7.22

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.
Files changed (38) hide show
  1. package/index.d.ts +24 -4
  2. package/misc/dist/strings.ts.cache +2 -2
  3. package/misc/https/dist/certs.ts.cache +2 -2
  4. package/misc/https/dist/persistentLocalStorage.ts.cache +2 -2
  5. package/package.json +2 -2
  6. package/storage/BulkDatabase2/dist/BulkDatabaseBase.ts.cache +2 -2
  7. package/storage/BulkDatabase2/dist/BulkDatabaseFormat.ts.cache +2 -2
  8. package/storage/BulkDatabase2/dist/BulkDatabaseMerge.ts.cache +2 -2
  9. package/storage/BulkDatabase2/dist/BulkDatabaseReader.ts.cache +2 -2
  10. package/storage/BulkDatabase2/dist/LoadedIndex.ts.cache +2 -2
  11. package/storage/BulkDatabase2/dist/WriteOverlay.ts.cache +2 -2
  12. package/storage/BulkDatabase2/dist/blockCache.ts.cache +2 -2
  13. package/storage/BulkDatabase2/dist/mergeLock.ts.cache +2 -2
  14. package/storage/BulkDatabase2/dist/mergeMarkers.ts.cache +2 -2
  15. package/storage/BulkDatabase2/dist/streamLog.ts.cache +2 -2
  16. package/storage/BulkDatabase2/dist/syncClient.ts.cache +2 -2
  17. package/storage/remoteStorage/ArchivesRemote.d.ts +3 -1
  18. package/storage/remoteStorage/ArchivesRemote.ts +7 -7
  19. package/storage/remoteStorage/blobStore.d.ts +0 -1
  20. package/storage/remoteStorage/blobStore.ts +4 -10
  21. package/storage/remoteStorage/createArchives.d.ts +1 -0
  22. package/storage/remoteStorage/createArchives.ts +38 -7
  23. package/storage/remoteStorage/deployTakeover.d.ts +7 -0
  24. package/storage/remoteStorage/deployTakeover.ts +59 -12
  25. package/storage/remoteStorage/dist/ArchivesRemote.ts.cache +3 -3
  26. package/storage/remoteStorage/dist/blobStore.ts.cache +16 -4
  27. package/storage/remoteStorage/dist/createArchives.ts.cache +52 -10
  28. package/storage/remoteStorage/dist/deployTakeover.ts.cache +84 -40
  29. package/storage/remoteStorage/dist/sourceWrapper.ts.cache +11 -4
  30. package/storage/remoteStorage/dist/storageController.ts.cache +9 -4
  31. package/storage/remoteStorage/dist/storageServerState.ts.cache +22 -9
  32. package/storage/remoteStorage/sourceWrapper.d.ts +4 -0
  33. package/storage/remoteStorage/sourceWrapper.ts +11 -1
  34. package/storage/remoteStorage/spec.md +1 -1
  35. package/storage/remoteStorage/storageController.d.ts +9 -2
  36. package/storage/remoteStorage/storageController.ts +31 -10
  37. package/storage/remoteStorage/storageServerState.ts +9 -5
  38. package/yarn.lock +4 -4
@@ -11,7 +11,7 @@ import {
11
11
  WRITE_PAST_WINDOW_GRACE, STORAGE_WRONG_VALID_WINDOW, STORAGE_WRONG_ROUTE, FULL_ROUTE,
12
12
  } from "../IArchives";
13
13
  import { ROUTING_FILE, parseRoutingData, parseHostedUrl, buildFileUrl, getConfigVersion, getRoute, routeContains, routeIntersection } from "./remoteConfig";
14
- import { applyDeployRemap, getFlushDeadline, onTakeoverEvent } from "./deployTakeover";
14
+ import { applyDeployRemap, getFlushDeadline, getTakeoverAltPort, onTakeoverEvent } from "./deployTakeover";
15
15
  import { createApiArchives } from "./createArchives";
16
16
  import type { IStorage } from "../IStorage";
17
17
  import type { AccessRequest, TrustRecord } from "./storageController";
@@ -164,15 +164,19 @@ const extraListenPorts = new Set<number>();
164
164
  export function addExtraListenPort(port: number): void {
165
165
  extraListenPorts.add(port);
166
166
  }
167
-
168
167
  function findSelfIndexes(routing: RemoteConfig, account: string, bucketName: string): number[] {
169
168
  let { domain, port } = getStorageServerConfig();
170
169
  let indexes: number[] = [];
170
+ // The takeover's alternate port is the OTHER process of the switchover, on OUR machine with
171
+ // OUR disk - self for sync purposes on both sides (the old node must not scan/push its own
172
+ // successor; the shared folder plus the switchover disk scans reconcile them)
173
+ let takeoverAltPort = getTakeoverAltPort();
171
174
  for (let i = 0; i < routing.sources.length; i++) {
172
175
  let source = routing.sources[i];
173
176
  if (typeof source === "string" || source.type !== "remote") continue;
174
177
  let parsed = parseHostedUrl(source.url);
175
- if (parsed.address === domain && (parsed.port === port || extraListenPorts.has(parsed.port)) && parsed.account === account && parsed.bucketName === bucketName) {
178
+ if (parsed.address !== domain || parsed.account !== account || parsed.bucketName !== bucketName) continue;
179
+ if (parsed.port === port || extraListenPorts.has(parsed.port) || parsed.port === takeoverAltPort) {
176
180
  indexes.push(i);
177
181
  }
178
182
  }
@@ -431,11 +435,11 @@ export async function writeBucketFile(account: string, bucketName: string, fileP
431
435
  if (!config?.lastModified && loaded.selfEntries.length) {
432
436
  let timeValid = loaded.selfEntries.filter(x => writeTime >= x.validWindow[0] - WRITE_PAST_WINDOW_GRACE && writeTime <= x.validWindow[1] + WRITE_PAST_WINDOW_GRACE);
433
437
  if (!timeValid.length) {
434
- logWrongTargetRejection(`Rejecting fresh write of ${JSON.stringify(filePath)} to bucket ${account}/${bucketName}: outside our valid windows (a switchover moved the write target)`);
438
+ logWrongTargetRejection(`Rejecting fresh write of ${JSON.stringify(filePath)} to bucket ${account}/${bucketName}: writeTime ${writeTime} (${new Date(writeTime).toISOString()}) is outside all our valid windows ${JSON.stringify(loaded.selfEntries.map(x => x.validWindow))} even with the ${WRITE_PAST_WINDOW_GRACE}ms grace (a switchover moved the write target)`);
435
439
  throw new Error(`${STORAGE_WRONG_VALID_WINDOW} This server is not a valid write target at ${writeTime} for bucket ${account}/${bucketName} (our valid windows: ${JSON.stringify(loaded.selfEntries.map(x => x.validWindow))}). Re-resolve the currently valid source and retry.`);
436
440
  }
437
441
  if (!timeValid.some(x => routeContains(x.route, route))) {
438
- logWrongTargetRejection(`Rejecting fresh write of ${JSON.stringify(filePath)} to bucket ${account}/${bucketName}: route ${route} is not ours (the client's shard config is stale)`);
442
+ logWrongTargetRejection(`Rejecting fresh write of ${JSON.stringify(filePath)} to bucket ${account}/${bucketName}: route ${route} is outside our routes ${JSON.stringify(timeValid.map(x => x.route || FULL_ROUTE))} at writeTime ${writeTime} (the client's shard config is stale)`);
439
443
  throw new Error(`${STORAGE_WRONG_ROUTE} This server does not handle route ${route} (key ${JSON.stringify(filePath)}) for bucket ${account}/${bucketName} (our routes at this time: ${JSON.stringify(timeValid.map(x => x.route || FULL_ROUTE))}). Re-resolve the source for this key and retry.`);
440
444
  }
441
445
  }
package/yarn.lock CHANGED
@@ -1944,10 +1944,10 @@ slash@^3.0.0:
1944
1944
  resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
1945
1945
  integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
1946
1946
 
1947
- socket-function@^1.2.25:
1948
- version "1.2.25"
1949
- resolved "https://registry.yarnpkg.com/socket-function/-/socket-function-1.2.25.tgz#4f715d96354596e781d9619fe8725d7ab243a878"
1950
- integrity sha512-4jalIocImnTG5cw7IJ5XtMwVN3fySTKN+Kyixl6I/R6IYXzPP8HspXi0c1D18SRcFwZZuG06+2FWv5xB+ny/mw==
1947
+ socket-function@^1.2.26:
1948
+ version "1.2.26"
1949
+ resolved "https://registry.yarnpkg.com/socket-function/-/socket-function-1.2.26.tgz#f674419614e4a1cbac3f162246d55c64ffa48a54"
1950
+ integrity sha512-khUT1tHH3WiqNyGWmicglkv9uZ/4q7smy884XzyDUViStJNb6cYaPVnTL01k5ysotf8yz6bdnbUc5r/Jo+FfpQ==
1951
1951
  dependencies:
1952
1952
  "@types/pako" "^2.0.3"
1953
1953
  "@types/ws" "^8.5.3"