signalk-questdb 1.5.1 → 1.5.2

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.
package/README.md CHANGED
@@ -160,8 +160,10 @@ QuestDB you point it at via `QuestDB host` + the HTTP/ILP ports.
160
160
 
161
161
  ## QuestDB Web Console
162
162
 
163
- QuestDB ships a web console (SQL editor + import UI) on its HTTP port. On the
164
- Signal K host it is at:
163
+ QuestDB ships a web console (SQL editor + import UI) on its HTTP port. See the
164
+ **[Web Console user guide](doc/web-console.md)** for an end-user walkthrough
165
+ with ready-to-paste sample queries (speed in knots, temperatures in °C,
166
+ distance per day, track export, and more). On the Signal K host it is at:
165
167
 
166
168
  ```
167
169
  http://localhost:9000
@@ -0,0 +1,2 @@
1
+ export type DeltaRoute = "number" | "string" | "position" | null;
2
+ export declare function routeDeltaValue(path: string, value: unknown): DeltaRoute;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.routeDeltaValue = routeDeltaValue;
4
+ function routeDeltaValue(path, value) {
5
+ if (typeof value === "number")
6
+ return "number";
7
+ if (typeof value === "string")
8
+ return "string";
9
+ if (path === "navigation.position" &&
10
+ value !== null &&
11
+ typeof value === "object" &&
12
+ "latitude" in value &&
13
+ "longitude" in value &&
14
+ Number.isFinite(value.latitude) &&
15
+ Number.isFinite(value.longitude))
16
+ return "position";
17
+ return null;
18
+ }
19
+ //# sourceMappingURL=delta-routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta-routing.js","sourceRoot":"","sources":["../src/delta-routing.ts"],"names":[],"mappings":";;AAUA,0CAcC;AAdD,SAAgB,eAAe,CAAC,IAAY,EAAE,KAAc;IAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC/C,IACE,IAAI,KAAK,qBAAqB;QAC9B,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,UAAU,IAAI,KAAK;QACnB,WAAW,IAAI,KAAK;QACpB,MAAM,CAAC,QAAQ,CAAE,KAA+B,CAAC,QAAQ,CAAC;QAC1D,MAAM,CAAC,QAAQ,CAAE,KAAgC,CAAC,SAAS,CAAC;QAE5D,OAAO,UAAU,CAAC;IACpB,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -44,7 +44,7 @@ export declare class ILPWriter {
44
44
  private nextNanos;
45
45
  write(path: string, context: string, value: number, timestamp?: Date): void;
46
46
  writeString(path: string, context: string, value: string, timestamp?: Date): void;
47
- writePosition(path: string, context: string, position: {
47
+ writePosition(context: string, position: {
48
48
  latitude: number;
49
49
  longitude: number;
50
50
  }, timestamp?: Date): void;
@@ -285,7 +285,9 @@ class ILPWriter {
285
285
  const ts = this.nextNanos(timestamp);
286
286
  this.enqueue(`signalk_str,path=${escapeTag(path)},context=${escapeTag(context)} value_str="${escapeFieldString(value)}" ${ts}\n`);
287
287
  }
288
- writePosition(path, context, position, timestamp) {
288
+ // signalk_position has no path column — it holds navigation.position rows
289
+ // exclusively (the caller enforces that), keyed on ts+context.
290
+ writePosition(context, position, timestamp) {
289
291
  const ts = this.nextNanos(timestamp);
290
292
  this.enqueue(`signalk_position,context=${escapeTag(context)} lat=${position.latitude},lon=${position.longitude} ${ts}\n`);
291
293
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ilp-writer.js","sourceRoot":"","sources":["../src/ilp-writer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,4EAA4E;AAC5E,yEAAyE;AACzE,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,0DAA0D;AAC7C,QAAA,yBAAyB,GAAG,IAAI,CAAC;AAC9C,MAAM,gBAAgB,GAAG,I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UAAU,EAAE,CAAC;YACpB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACjB,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE;gBACnB,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;gBACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;gBACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBACvB,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxWD,8BAwWC"}
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ const minimatch_1 = require("minimatch");
37
37
  const ilp_writer_1 = require("./ilp-writer");
38
38
  const query_client_1 = require("./query-client");
39
39
  const schema_1 = require("./config/schema");
40
+ const delta_routing_1 = require("./delta-routing");
40
41
  const history_v2_1 = require("./history-v2");
41
42
  const history_v1_1 = require("./history-v1");
42
43
  const retention_1 = require("./retention");
@@ -123,6 +124,20 @@ module.exports = (app) => {
123
124
  // could resurrect a just-purged container. A simple promise-chain mutex:
124
125
  // each call waits for the previous to settle, then runs.
125
126
  let lifecycleChain = Promise.resolve();
127
+ // Bumped by stop() and purge before they tear down. Lifecycle work captures
128
+ // the value when it is ENQUEUED and re-checks it when it actually runs (and
129
+ // after its long awaits): startAbort can only cancel the start that is
130
+ // currently executing, so without this a start/update still waiting behind
131
+ // the chain — or one parked in a long await — would run to completion after
132
+ // teardown and resurrect the resources that were just torn down.
133
+ let lifecycleGeneration = 0;
134
+ // True only between a FULLY completed start (providers, stream
135
+ // subscription, and timers all registered) and the next stop/purge.
136
+ // queryClient/writer are not usable as a running sentinel: they are
137
+ // created partway through startup, so a start that fails after that point
138
+ // (health-wait exhausted, ensureTables/connect threw) leaves them non-null
139
+ // on a plugin that never came up.
140
+ let pluginRunning = false;
126
141
  const withLifecycleLock = (fn) => {
127
142
  const run = lifecycleChain.then(fn, fn);
128
143
  // Keep the chain alive regardless of this op's outcome.
@@ -244,12 +259,15 @@ module.exports = (app) => {
244
259
  * QuestDB is not published beyond loopback / the shared network.
245
260
  * - on: publish the configured host ports on 0.0.0.0 (for LAN / separate-
246
261
  * Docker Grafana) on the shared `networkName`; the Signal K process
247
- * reaches them on the host loopback (bare-metal) or via the
248
- * host.containers.internal gateway (containerized SK).
262
+ * reaches them on the host loopback (bare-metal) or containerized —
263
+ * on whichever of loopback/host.containers.internal actually answers
264
+ * (probed, since the right one depends on the SK container's network
265
+ * mode; see resolveLanExposureHost).
249
266
  *
250
- * `endpoints` is resolved AFTER ensureRunning() on the signalkAccessiblePorts
251
- * path (the host port is allocated by then); on the LAN path it is already
252
- * known, so the returned resolver just echoes it.
267
+ * `endpoints` is resolved AFTER ensureRunning() on both paths: the
268
+ * signalkAccessiblePorts path needs the allocated host port, and the LAN
269
+ * path's probe needs a running QuestDB. The returned resolver defers the
270
+ * work into the closure (memoized on the LAN path) for exactly that reason.
253
271
  */
254
272
  async function applyQuestdbNetworking(config, containers, name, containerConfig) {
255
273
  const httpPort = config.questdbHttpPort ?? questdb_endpoint_1.QUESTDB_INTERNAL_HTTP_PORT;
@@ -274,14 +292,22 @@ module.exports = (app) => {
274
292
  await containers.ensureNetwork(config.networkName);
275
293
  containerConfig.networkMode = config.networkName;
276
294
  }
277
- // A 0.0.0.0-published port is reachable from a containerized SK via the
278
- // host gateway; a loopback-only one (or any bare-metal/old-container
279
- // case) is reached on 127.0.0.1.
280
- const skHost = config.exposeToContainers
281
- ? await (0, questdb_endpoint_1.resolveLanExposureHost)(containers, (msg) => app.debug(msg))
282
- : "127.0.0.1";
283
- const endpoints = (0, questdb_endpoint_1.lanExposureEndpoints)(skHost, httpPort, ilpPort);
284
- return async () => endpoints;
295
+ // A 0.0.0.0-published port is reached on 127.0.0.1 or via the host
296
+ // gateway depending on how a containerized SK is networked — resolved
297
+ // by probing, which only works once QuestDB is up. The resolver runs
298
+ // after ensureRunning() on both call sites, so defer the probe into
299
+ // the closure (and memoize: the endpoint can't change while the
300
+ // container config that produced it is live).
301
+ let endpoints = null;
302
+ return async () => {
303
+ if (!endpoints) {
304
+ const skHost = config.exposeToContainers
305
+ ? await (0, questdb_endpoint_1.resolveLanExposureHost)(containers, httpPort, (msg) => app.debug(msg))
306
+ : "127.0.0.1";
307
+ endpoints = (0, questdb_endpoint_1.lanExposureEndpoints)(skHost, httpPort, ilpPort);
308
+ }
309
+ return endpoints;
310
+ };
285
311
  }
286
312
  // Default path: signalk-container owns the networking. After the container
287
313
  // is up we additionally attach it to `networkName` so the companion
@@ -359,6 +385,9 @@ module.exports = (app) => {
359
385
  }
360
386
  }
361
387
  async function runStartInner(config, signal) {
388
+ // Not running until THIS start completes — a restart that reuses the
389
+ // slot must not leave a stale true from the previous run.
390
+ pluginRunning = false;
362
391
  // Older saved configs miss keys added since (pathFilter, samplingRates);
363
392
  // the per-delta pipeline dereferences them per delta, so normalize once
364
393
  // at the boundary.
@@ -463,7 +492,13 @@ module.exports = (app) => {
463
492
  if (signal.aborted)
464
493
  return;
465
494
  app.debug("QuestDB container ready");
466
- questdbEndpoints = await resolveEndpoints();
495
+ // The LAN path probes for the reachable host in here (up to its
496
+ // retry deadline), so this await is long enough for a stop/purge to
497
+ // preempt us — re-check before committing the result.
498
+ const resolved = await resolveEndpoints();
499
+ if (signal.aborted)
500
+ return;
501
+ questdbEndpoints = resolved;
467
502
  }
468
503
  catch (err) {
469
504
  app.debug("ensureRunning failed:", err);
@@ -567,17 +602,15 @@ module.exports = (app) => {
567
602
  // even gets *more* accurate history. Re-sent ILP batches keep their
568
603
  // original stamps (baked at write() time), so replay-idempotency holds.
569
604
  const ctx = isSelf ? "self" : context;
570
- if (typeof value === "number") {
605
+ const route = (0, delta_routing_1.routeDeltaValue)(path, value);
606
+ if (route === "number") {
571
607
  writer.write(path, ctx, value);
572
608
  }
573
- else if (typeof value === "string") {
609
+ else if (route === "string") {
574
610
  writer.writeString(path, ctx, value);
575
611
  }
576
- else if (value &&
577
- typeof value === "object" &&
578
- "latitude" in value &&
579
- "longitude" in value) {
580
- writer.writePosition(path, ctx, value);
612
+ else if (route === "position") {
613
+ writer.writePosition(ctx, value);
581
614
  }
582
615
  });
583
616
  unsubscribes.push(unsub);
@@ -591,11 +624,25 @@ module.exports = (app) => {
591
624
  void healSchemaTables();
592
625
  }, SCHEMA_HEAL_INTERVAL_MS);
593
626
  app.setPluginStatus(`Recording to QuestDB at ${ilpHost}:${ilpPort}`);
627
+ // Everything is registered — only now does the plugin count as running.
628
+ // Any earlier return/throw leaves the flag false, so a half-started
629
+ // plugin rejects lifecycle-dependent requests like /api/update/apply.
630
+ pluginRunning = true;
594
631
  }
595
632
  // Public entry: serialize startup behind the lifecycle lock so a purge or
596
- // update can't interleave with it.
633
+ // update can't interleave with it. The generation is captured at enqueue: a
634
+ // stop()/purge landing while this start is still queued invalidates it
635
+ // before it begins — the window startAbort cannot cover, since the abort
636
+ // controller only exists once runStart() is executing.
597
637
  function asyncStart(config) {
598
- return withLifecycleLock(() => runStart(config));
638
+ const generation = lifecycleGeneration;
639
+ return withLifecycleLock(async () => {
640
+ if (generation !== lifecycleGeneration) {
641
+ app.debug("skipping queued start: plugin stopped while it waited");
642
+ return;
643
+ }
644
+ await runStart(config);
645
+ });
599
646
  }
600
647
  const plugin = {
601
648
  id: "signalk-questdb",
@@ -609,6 +656,15 @@ module.exports = (app) => {
609
656
  });
610
657
  },
611
658
  async stop() {
659
+ // Preempt lifecycle work: bump the generation so anything still queued
660
+ // behind the lifecycle chain (or parked in a long await that re-checks
661
+ // it) bails, and abort the currently-executing start so its post-await
662
+ // signal checks return before registering resources. Together these
663
+ // keep a slow start/update (container pull, LAN-host probe) from
664
+ // resurrecting a writer/client after this teardown ran.
665
+ lifecycleGeneration++;
666
+ startAbort?.abort();
667
+ pluginRunning = false;
612
668
  for (const unsub of unsubscribes) {
613
669
  try {
614
670
  unsub();
@@ -872,6 +928,10 @@ module.exports = (app) => {
872
928
  });
873
929
  router.post("/api/update/apply", async (_req, res) => {
874
930
  try {
931
+ // Captured at route entry, before ANY await: a stop() that lands
932
+ // during the release fetch below must already invalidate this
933
+ // update, not just one that lands after the lock is acquired.
934
+ const updateGeneration = lifecycleGeneration;
875
935
  const containers = globalThis.__signalk_containerManager;
876
936
  if (!containers || !containers.getRuntime()) {
877
937
  res.status(503).json({ error: "Container manager not available" });
@@ -895,9 +955,26 @@ module.exports = (app) => {
895
955
  const newTag = stable.tag_name;
896
956
  // Run the mutating update under the lifecycle lock so a concurrent
897
957
  // purge/start can't interleave with the pull + recreate + reconnect.
958
+ // The route-entry generation is re-checked at lock entry and after
959
+ // the long awaits: a stop() during the release fetch, the pull, or
960
+ // the LAN-host probe must not let this resume, reassign endpoints,
961
+ // and report success for a container the teardown already dealt
962
+ // with.
898
963
  const ilp = await withLifecycleLock(async () => {
964
+ const assertNotStopped = () => {
965
+ if (updateGeneration !== lifecycleGeneration)
966
+ throw new Error("plugin stopped while the update was running");
967
+ };
968
+ assertNotStopped();
969
+ // A generation match only proves no stop() happened since route
970
+ // entry — it can't tell that the plugin was already stopped (or
971
+ // never fully started) when the request arrived. Gate on the
972
+ // completed-start sentinel before pulling or recreating anything.
973
+ if (!pluginRunning)
974
+ throw new Error("plugin is not running");
899
975
  app.setPluginStatus(`Pulling QuestDB ${newTag}...`);
900
976
  await containers.pullImage(`questdb/questdb:${newTag}`);
977
+ assertNotStopped();
901
978
  if (currentConfig) {
902
979
  currentConfig.questdbVersion = newTag;
903
980
  await new Promise((resolve, reject) => {
@@ -943,11 +1020,15 @@ module.exports = (app) => {
943
1020
  };
944
1021
  const resolveUpdateEndpoints = await applyQuestdbNetworking(currentConfig ?? {}, containers, QUESTDB_CONTAINER_NAME, updateConfig);
945
1022
  // Clear any prior clamp before re-running so a no-longer-clamping
946
- // update doesn't leave a stale warning.
1023
+ // update doesn't leave a stale warning. The recreate must not
1024
+ // happen after a stop/purge teardown, so gate it on the
1025
+ // generation one more time.
1026
+ assertNotStopped();
947
1027
  ulimitClamp = null;
948
1028
  await containers.ensureRunning(QUESTDB_CONTAINER_NAME, updateConfig, {
949
1029
  onUlimitClamped,
950
1030
  });
1031
+ assertNotStopped();
951
1032
  // The QuestDB version just changed, so the cached wal_tables()
952
1033
  // column shape may no longer match (the errorTag/errorMessage
953
1034
  // columns could appear on an upgrade or disappear on a downgrade).
@@ -958,26 +1039,51 @@ module.exports = (app) => {
958
1039
  // current endpoint. The version bump keeps the same container name
959
1040
  // and networking, so the endpoint is stable — the existing
960
1041
  // QueryClient/ILPWriter stay valid (and the registered history
961
- // providers keep their reference).
962
- questdbEndpoints = await resolveUpdateEndpoints();
1042
+ // providers keep their reference). On the LAN path this await
1043
+ // probes for the reachable host, so it's long enough for a stop()
1044
+ // to land mid-flight — re-check before touching plugin state.
1045
+ const updatedEndpoints = await resolveUpdateEndpoints();
1046
+ assertNotStopped();
1047
+ questdbEndpoints = updatedEndpoints;
963
1048
  const { host: ilpHost, port: ilpPort } = questdbEndpoints.ilp;
964
1049
  // Wait for the recreated container to answer, then reconnect ILP.
965
- if (queryClient) {
1050
+ // Locals are captured because stop() nulls the module bindings:
1051
+ // reading them again mid-loop would throw, and the generation
1052
+ // checks after every await are what keep a concurrent teardown
1053
+ // from being resurrected by the reconnect.
1054
+ const client = queryClient;
1055
+ if (client) {
966
1056
  const deadline = Date.now() + 30000;
967
1057
  while (Date.now() < deadline) {
968
- if (await queryClient.isHealthy())
1058
+ assertNotStopped();
1059
+ if (await client.isHealthy())
969
1060
  break;
970
1061
  await new Promise((resolve) => setTimeout(resolve, 500));
971
1062
  }
972
1063
  }
973
- if (writer) {
1064
+ assertNotStopped();
1065
+ const ilpWriter = writer;
1066
+ if (ilpWriter) {
974
1067
  try {
975
- await writer.disconnect();
1068
+ await ilpWriter.disconnect();
976
1069
  }
977
1070
  catch {
978
1071
  /* ignore */
979
1072
  }
980
- await writer.connect();
1073
+ assertNotStopped();
1074
+ await ilpWriter.connect();
1075
+ // A stop() that landed during connect() has already nulled
1076
+ // `writer`, so nothing would ever disconnect this fresh
1077
+ // connection — close it ourselves before failing the update.
1078
+ if (updateGeneration !== lifecycleGeneration) {
1079
+ try {
1080
+ await ilpWriter.disconnect();
1081
+ }
1082
+ catch {
1083
+ /* ignore */
1084
+ }
1085
+ assertNotStopped();
1086
+ }
981
1087
  }
982
1088
  return { ilpHost, ilpPort };
983
1089
  });
@@ -1098,6 +1204,7 @@ module.exports = (app) => {
1098
1204
  if (teardownStarted)
1099
1205
  return;
1100
1206
  teardownStarted = true;
1207
+ pluginRunning = false;
1101
1208
  // Stop all activity against the container before it and its data go
1102
1209
  // away — otherwise the retention timer keeps issuing DROP PARTITION
1103
1210
  // against a removed container and the writer keeps trying to connect.
@@ -1126,13 +1233,16 @@ module.exports = (app) => {
1126
1233
  // Purge is the RECOVERY action, so it must make progress even when a
1127
1234
  // start is wedged on a never-settling container call. Step 1: signal
1128
1235
  // any in-flight start to bail (its post-await checks return without
1129
- // creating resources). Step 2: try to acquire the lifecycle lock so
1236
+ // creating resources) and bump the generation so a start/update
1237
+ // still QUEUED behind the chain bails at entry instead of running
1238
+ // after the teardown. Step 2: try to acquire the lifecycle lock so
1130
1239
  // we still serialize against a start/update that IS progressing —
1131
1240
  // but only for a bounded time. If the lock isn't free within
1132
1241
  // PURGE_LOCK_TIMEOUT_MS (a truly hung start that ignored the abort
1133
1242
  // and never released it), run the teardown anyway. Interleaving risk
1134
1243
  // is minimal because we already aborted the start, so any start that
1135
1244
  // later wakes up returns early instead of recreating the container.
1245
+ lifecycleGeneration++;
1136
1246
  startAbort?.abort();
1137
1247
  let lockedTeardownSettled = false;
1138
1248
  let lockedTeardownError;