querysub 0.356.0 → 0.358.0
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/.cursorrules +9 -0
- package/bin/movelogs.js +4 -0
- package/package.json +13 -6
- package/scripts/postinstall.js +23 -0
- package/src/-a-archives/archiveCache.ts +10 -12
- package/src/-a-archives/archives.ts +29 -0
- package/src/-a-archives/archivesBackBlaze.ts +60 -12
- package/src/-a-archives/archivesDisk.ts +39 -13
- package/src/-a-archives/archivesLimitedCache.ts +21 -0
- package/src/-a-archives/archivesMemoryCache.ts +374 -0
- package/src/-a-archives/archivesPrivateFileSystem.ts +22 -0
- package/src/-g-core-values/NodeCapabilities.ts +3 -0
- package/src/0-path-value-core/auditLogs.ts +5 -1
- package/src/0-path-value-core/pathValueCore.ts +7 -7
- package/src/4-dom/qreact.tsx +1 -0
- package/src/4-querysub/Querysub.ts +1 -5
- package/src/config.ts +5 -0
- package/src/deployManager/components/MachineDetailPage.tsx +43 -2
- package/src/deployManager/components/MachinesListPage.tsx +10 -2
- package/src/deployManager/machineApplyMainCode.ts +3 -3
- package/src/deployManager/machineSchema.ts +39 -0
- package/src/diagnostics/MachineThreadInfo.tsx +235 -0
- package/src/diagnostics/NodeViewer.tsx +5 -3
- package/src/diagnostics/logs/FastArchiveAppendable.ts +79 -42
- package/src/diagnostics/logs/FastArchiveController.ts +102 -63
- package/src/diagnostics/logs/FastArchiveViewer.tsx +36 -8
- package/src/diagnostics/logs/IndexedLogs/BufferIndex.ts +462 -0
- package/src/diagnostics/logs/IndexedLogs/BufferIndexCPP.cpp +327 -0
- package/src/diagnostics/logs/IndexedLogs/BufferIndexCPP.d.ts +18 -0
- package/src/diagnostics/logs/IndexedLogs/BufferIndexCPP.js +1 -0
- package/src/diagnostics/logs/IndexedLogs/BufferIndexHelpers.ts +222 -0
- package/src/diagnostics/logs/IndexedLogs/BufferIndexLogsOptimizationConstants.ts +22 -0
- package/src/diagnostics/logs/IndexedLogs/BufferIndexWAT.wat +1145 -0
- package/src/diagnostics/logs/IndexedLogs/BufferIndexWAT.wat.d.ts +178 -0
- package/src/diagnostics/logs/IndexedLogs/BufferListStreamer.ts +208 -0
- package/src/diagnostics/logs/IndexedLogs/BufferUnitIndex.ts +716 -0
- package/src/diagnostics/logs/IndexedLogs/BufferUnitSet.ts +146 -0
- package/src/diagnostics/logs/IndexedLogs/FilePathSelector.tsx +569 -0
- package/src/diagnostics/logs/IndexedLogs/FindProgressTracker.ts +45 -0
- package/src/diagnostics/logs/IndexedLogs/IndexedLogs.ts +685 -0
- package/src/diagnostics/logs/IndexedLogs/LogStreamer.ts +47 -0
- package/src/diagnostics/logs/IndexedLogs/LogViewer3.tsx +901 -0
- package/src/diagnostics/logs/IndexedLogs/TimeFileTree.ts +236 -0
- package/src/diagnostics/logs/IndexedLogs/binding.gyp +23 -0
- package/src/diagnostics/logs/IndexedLogs/moveIndexLogsToPublic.ts +251 -0
- package/src/diagnostics/logs/IndexedLogs/moveLogsEntry.ts +10 -0
- package/src/diagnostics/logs/LogViewer2.tsx +120 -55
- package/src/diagnostics/logs/TimeRangeSelector.tsx +5 -2
- package/src/diagnostics/logs/diskLogger.ts +32 -48
- package/src/diagnostics/logs/errorNotifications/ErrorNotificationController.ts +3 -2
- package/src/diagnostics/logs/errorNotifications/errorDigests.tsx +1 -0
- package/src/diagnostics/logs/errorNotifications2/errorNotifications2.ts +0 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCyclePages.tsx +150 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycles.tsx +150 -15
- package/src/diagnostics/logs/lifeCycleAnalysis/test.ts +0 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/test.wat +106 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/test.wat.d.ts +2 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/testHoist.ts +5 -0
- package/src/diagnostics/logs/logViewerExtractField.ts +2 -3
- package/src/diagnostics/managementPages.tsx +10 -0
- package/src/diagnostics/trackResources.ts +1 -1
- package/src/functional/limitProcessing.ts +39 -0
- package/src/misc/lz4_wasm_nodejs.d.ts +34 -0
- package/src/misc/lz4_wasm_nodejs.js +178 -0
- package/src/misc/lz4_wasm_nodejs_bg.js +94 -0
- package/src/misc/lz4_wasm_nodejs_bg.wasm +0 -0
- package/src/misc/lz4_wasm_nodejs_bg.wasm.d.ts +15 -0
- package/src/storage/CompressedStream.ts +13 -0
- package/src/storage/LZ4.ts +32 -0
- package/src/storage/ZSTD.ts +10 -0
- package/src/wat/watCompiler.ts +1716 -0
- package/src/wat/watGrammar.pegjs +93 -0
- package/src/wat/watHandler.ts +179 -0
- package/src/wat/watInstructions.txt +707 -0
- package/src/zip.ts +3 -89
- package/src/diagnostics/logs/lifeCycleAnalysis/spec.md +0 -125
package/src/zip.ts
CHANGED
|
@@ -8,94 +8,8 @@ import { unzipThreaded } from "./zipThreaded";
|
|
|
8
8
|
import debugbreak from "debugbreak";
|
|
9
9
|
import { formatNumber } from "socket-function/src/formatting/format";
|
|
10
10
|
import { runInSerial } from "socket-function/src/batching";
|
|
11
|
+
import { MaybePromise } from "socket-function/src/types";
|
|
12
|
+
import { Zip } from "socket-function/src/Zip";
|
|
11
13
|
setFlag(require, "pako", "allowclient", true);
|
|
12
14
|
|
|
13
|
-
export
|
|
14
|
-
@measureFnc
|
|
15
|
-
public static async gzip(buffer: Buffer, level?: number): Promise<Buffer> {
|
|
16
|
-
if (isNode()) {
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
zlib.gzip(buffer, { level }, (err: any, result: Buffer) => {
|
|
19
|
-
if (err) reject(err);
|
|
20
|
-
else resolve(result);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
} else {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
return await doStream(new CompressionStream("gzip"), buffer);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
@measureFnc
|
|
29
|
-
public static async gunzip(buffer: Buffer): Promise<Buffer> {
|
|
30
|
-
return Zip.gunzipUntracked(buffer);
|
|
31
|
-
}
|
|
32
|
-
// A base function, so we can avoid instrumentation for batch calls
|
|
33
|
-
public static async gunzipUntracked(buffer: Buffer): Promise<Buffer> {
|
|
34
|
-
if (isNode()) {
|
|
35
|
-
let test = await unzipThreaded(buffer);
|
|
36
|
-
// let test2 = await new Promise<Buffer>((resolve, reject) => {
|
|
37
|
-
// zlib.gunzip(buffer, (err: any, result: Buffer) => {
|
|
38
|
-
// if (err) reject(err);
|
|
39
|
-
// else resolve(result);
|
|
40
|
-
// });
|
|
41
|
-
// });
|
|
42
|
-
// if (test.length !== test2.length) {
|
|
43
|
-
// debugbreak(2);
|
|
44
|
-
// debugger;
|
|
45
|
-
// }
|
|
46
|
-
// for (let i = 0; i < test.length; i++) {
|
|
47
|
-
// if (test[i] !== test2[i]) {
|
|
48
|
-
// debugbreak(2);
|
|
49
|
-
// debugger;
|
|
50
|
-
// }
|
|
51
|
-
// }
|
|
52
|
-
|
|
53
|
-
return test;
|
|
54
|
-
} else {
|
|
55
|
-
// NOTE: pako seems to be faster, at least clientside.
|
|
56
|
-
// TIMING: 700ms vs 1200ms
|
|
57
|
-
// - This might just be faster for small files.
|
|
58
|
-
return Buffer.from(pako.inflate(buffer));
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
// return await doStream(new DecompressionStream("gzip"), buffer);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@measureFnc
|
|
65
|
-
public static gunzipSync(buffer: Buffer): Buffer {
|
|
66
|
-
if (isNode()) {
|
|
67
|
-
return Buffer.from(zlib.gunzipSync(buffer));
|
|
68
|
-
} else {
|
|
69
|
-
return Buffer.from(pako.inflate(buffer));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@measureFnc
|
|
74
|
-
public static async gunzipBatch(buffers: Buffer[]): Promise<Buffer[]> {
|
|
75
|
-
let time = Date.now();
|
|
76
|
-
buffers = await Promise.all(buffers.map(Zip.gunzipUntracked));
|
|
77
|
-
time = Date.now() - time;
|
|
78
|
-
let totalSize = buffers.reduce((acc, buffer) => acc + buffer.length, 0);
|
|
79
|
-
//console.log(`Gunzip ${formatNumber(totalSize)}B at ${formatNumber(totalSize / time * 1000)}B/s`);
|
|
80
|
-
return buffers;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
async function doStream(stream: GenericTransformStream, buffer: Buffer): Promise<Buffer> {
|
|
85
|
-
let reader = stream.readable.getReader();
|
|
86
|
-
let writer = stream.writable.getWriter();
|
|
87
|
-
let writePromise = writer.write(buffer);
|
|
88
|
-
let closePromise = writer.close();
|
|
89
|
-
|
|
90
|
-
let outputBuffers: Buffer[] = [];
|
|
91
|
-
while (true) {
|
|
92
|
-
let { value, done } = await reader.read();
|
|
93
|
-
if (done) {
|
|
94
|
-
await writePromise;
|
|
95
|
-
await closePromise;
|
|
96
|
-
return Buffer.concat(outputBuffers);
|
|
97
|
-
}
|
|
98
|
-
outputBuffers.push(Buffer.from(value));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
}
|
|
15
|
+
export { Zip };
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
Huge amount of data:
|
|
2
|
-
https://127-0-0-1.querysubtest.com:7007/?hot&enableLogs&page=login&caseInsensitive&showingmanagement&endTime=1757732880000&startTime=1746997620000&managementpage=LogViewer2
|
|
3
|
-
Very small amount of data
|
|
4
|
-
https://127-0-0-1.querysubtest.com:7007/?hot&enableLogs&page=login&filter=%22431%22&showingmanagement&endTime=1755140880000&startTime=1754950020000&managementpage=LogViewer2
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
BUG: Digest email isn't limitting per file? We got 12 from a single file?
|
|
8
|
-
|
|
9
|
-
5) Life cycle analyzer
|
|
10
|
-
- Implement regular range lifecycles first (matching an === object field)
|
|
11
|
-
- THEN, Add lifecycle collections where we can define life cycles that have a certain type.
|
|
12
|
-
- A collection that has everything by default and we remove life cycles from it would also be useful.
|
|
13
|
-
- AFTER that, MAYBE, support global values, setting them, and referencing them in the life cycle (which makes them shown as a whole, AND on each line in the life cycle, so we can see the progression).
|
|
14
|
-
- We have to allow selecting the value we want as well based on a lifecycle state that it can set with its logs. And then we're basically building expression. The whole thing becomes very complicated. So maybe we won't even do it.
|
|
15
|
-
- We should definitely wait until we create life cycles and find use out of them before we start adding global values.
|
|
16
|
-
- It seems like life cycles have two types.
|
|
17
|
-
1) Set global values for user in other logs
|
|
18
|
-
- Allows for providing specific context, such as what are all the nodes that exist at this time, What are all the paths, authorities that exist, etc, So we can tell what the results should be by essentially knowing what the other values are on other servers inst... antly in a way that the current node couldn't possibly know at that time (And because it can't know it, it couldn't log it. So it's the only way to get this information).
|
|
19
|
-
2) Range based, a bunch of values connected via an === object field, making one range
|
|
20
|
-
- allows reducing the complexity of an analysis, by taking lots of different logs and reducing it to just one..
|
|
21
|
-
- IMPORTANT! Show the time and the count of logs in the life cycle.
|
|
22
|
-
- also allows us to look at them as a whole, as in how long did it take. Which is minor because we could just measure it, However, sometimes it's annoying to pass the start time information around And if we don't pass the start time around, then we need to look at the start time from the first log and the end time for the last log, which again, would require looking at it as a lifecycle analysis.
|
|
23
|
-
- allows adding information based on the existence or the non-existence of a log in that group, such as A setup process missing the last step.
|
|
24
|
-
- IMPORTANT! we need to support this by allowing defining life cycles as requiring certain field value combinations which we will end up making basically just the field will always be type and the value will be the type in that life cycle and we'll hard code all the steps that are required and then we can warn when there's a missing step
|
|
25
|
-
- I guess also show the count of every single step because that's useful to see if some things were repeated.
|
|
26
|
-
- Allows drilling into a lifecycle to see just the specific information of the lifecycle cross server
|
|
27
|
-
- Otherwise, it's somewhat annoying to look at things cross-server, and while we can search for a specific key that we log, which is exactly what life cycles will do, it's easier to just click to drilldown, rather than having to make the query dynamically every time we want it.
|
|
28
|
-
2.1) Collections of life cycles so we can further reduce the complexity.
|
|
29
|
-
- Uses FastArchiveViewer, but instead of showing a table, shows lifecycles (a derived concept)
|
|
30
|
-
- We save them in backblaze, with a bit of cache for loading them
|
|
31
|
-
- show the life cycles and allow viewing just the specific life cycles and then drilling into those life cycles. Also allow viewing multiple at once so we can view a stream that has many life cycles (as in life cycle collections, which we can also save. )
|
|
32
|
-
- Show overlap when we're showing the list of life cycles by having it first sorted by start time and then have some kind of indicator for how many values after the value it overlaps with. So if it's serial there'll be no overlap. If everything is being queued up and then run in serial we'll see the overlap go from 1, 2, 3, 4, 5, 6, 7, 8, etc. If it's just in parallel, it'll count up to a number and then go up and down a little bit as values are added and removed. If everything's added at once and it's in parallel, then the values will go up, but then they'll very quickly go down.
|
|
33
|
-
- Maybe we should have some indication for how much parallel overlap there is? Or kind of like how much gap there is to the start time of the next thing and to the end time of the next thing, something like that.
|
|
34
|
-
|
|
35
|
-
6) Add life cycles for
|
|
36
|
-
- Node discovery life cycle (new node, check for alive, check for paths, etc)
|
|
37
|
-
- Discover nodes
|
|
38
|
-
- Check if trusted
|
|
39
|
-
- Sets authorities
|
|
40
|
-
- Sets nodes which exist
|
|
41
|
-
- Ready broadcast
|
|
42
|
-
- Resync is also part of life cycle
|
|
43
|
-
- Use different keys for threadId, and, triggeredNodeId, so we can track how a node discovers other nodes, vs how a node is discovered
|
|
44
|
-
- Mark as dead, dead count increases, remove node as dead
|
|
45
|
-
- MAYBE there should be 2 lifecycles, one for all, and one for just creation type stuff (no discovery)
|
|
46
|
-
- There's a life cycle for something dying which starts when we first see it's dead and ends when the count reaches the maximum. We want to use the capability to change the ending state so we can have it as partially dead but not fully dead or fully dead so we can see if the dead life cycles keep starting but not finishing which would be bad.
|
|
47
|
-
- Trusted machine lifecycle
|
|
48
|
-
- Check if we need to add trust
|
|
49
|
-
- Add trust to archives
|
|
50
|
-
- Read trusted nodes from archives
|
|
51
|
-
=> Set of trusted machines per threadId
|
|
52
|
-
- Functions evaluation in FunctionRunner
|
|
53
|
-
- Adding in http, evaluation, and maybe even forwarding the final PathValue writes to it?
|
|
54
|
-
- Known nodes
|
|
55
|
-
- Not really a life cycle, but does set global state
|
|
56
|
-
- Value syncing
|
|
57
|
-
- Crosses node boundaries, with the server having to include the client key, so we can track a proxy access => ask the server => validate permissions => send value => receive value => notify proxy
|
|
58
|
-
- Value creation
|
|
59
|
-
- Source, propagation, writing to archives
|
|
60
|
-
- Permissions (probably part of value syncing)
|
|
61
|
-
- SOCKET connections, open, stats, closed, error, etc.
|
|
62
|
-
- Archive management
|
|
63
|
-
- Queue (count)
|
|
64
|
-
- Archive (count + file)
|
|
65
|
-
- Joining, deleting, etc, etc
|
|
66
|
-
|
|
67
|
-
6) Redeploy everything to the servers again, updating our machine apply script, all of our services, deploying our code, etc
|
|
68
|
-
|
|
69
|
-
7) Use log viewer to find rejections / errors during startup, and then trace down the sync life cycle for the path write, and find where it is lagging out!
|
|
70
|
-
- Re-enable all of our services as well.
|
|
71
|
-
- Just logs MIGHT be able to do it, but... life cycles should make it a lot easier to correlate logs, which is something we need to do anyways to solve it...
|
|
72
|
-
|
|
73
|
-
Make sure we check our life cycles for nodes being added and removed to make sure that life cycle path is pretty empty and there aren't nodes constantly being lost and re-added.
|
|
74
|
-
|
|
75
|
-
Check the startup lifecycle to make sure we can detect the nodes pretty fast and in parallel, instead of serial
|
|
76
|
-
|
|
77
|
-
11) Take all of the errors that we are ignoring and use the life cycles to detect why they're happening. A lot of them really shouldn't be happening.
|
|
78
|
-
- Receiving values from different authorities and the ones we're watching is weird. Why does that keep happening?
|
|
79
|
-
- And we keep running into audit mismatches? Why does that keep happening? Is it only because of our local development server?
|
|
80
|
-
|
|
81
|
-
DEBUG: Deploy hash updates.
|
|
82
|
-
- Forced refresh now, and then immediately refreshing is STILL not giving us the latest code. Even though we waited for everything to reload the UI, which took forever.
|
|
83
|
-
- It's probably an issue with the routing information being out of date, I think it's cached in Cloudflare. We could at least use life cycles to verify the values we have, and then if they're different than the values in the client, then I guess it must be in Cloudflare. We can also verify our timing, as I'm pretty sure we're supposed to be waiting for the cloud flare values to update, and if we're not, then that's a problem.
|
|
84
|
-
|
|
85
|
-
DEBUG: Suppression creation propagation
|
|
86
|
-
- It didn't propagate to all the servers?
|
|
87
|
-
|
|
88
|
-
DEBUG: Machine always up script not restoring dead node?
|
|
89
|
-
- Add lifecycle for service launching + checking
|
|
90
|
-
- Does it just not restart killed services... at all?
|
|
91
|
-
- Maybe machine always up just gets in a bad state (maybe the main loop exits?)
|
|
92
|
-
- But it's an infinite loop, so it can't?
|
|
93
|
-
|
|
94
|
-
DEBUG: Why we would get into an infinite identify loop:
|
|
95
|
-
Identified (loading) f194b2e77661e660.a794fbcf7b104c68.querysubtest.com:34139 as a path authority for:
|
|
96
|
-
=-.,querysubtest._com.,/
|
|
97
|
-
Waiting for 1 authorities to be ready:
|
|
98
|
-
=-.,querysubtest._com.,/
|
|
99
|
-
Starting to identify f194b2e77661e660.a794fbcf7b104c68.querysubtest.com:34139 as a path authority
|
|
100
|
-
Identified (loading) f194b2e77661e660.a794fbcf7b104c68.querysubtest.com:34139 as a path authority for:
|
|
101
|
-
=-.,querysubtest._com.,/
|
|
102
|
-
Waiting for 1 authorities to be ready:
|
|
103
|
-
=-.,querysubtest._com.,/
|
|
104
|
-
Starting to identify f194b2e77661e660.a794fbcf7b104c68.querysubtest.com:34139 as a path authority
|
|
105
|
-
Identified (loading) f194b2e77661e660.a794fbcf7b104c68.querysubtest.com:34139 as a path authority for:
|
|
106
|
-
=-.,querysubtest._com.,/
|
|
107
|
-
Starting to identify f194b2e77661e660.a794fbcf7b104c68.querysubtest.com:34139 as a path authority
|
|
108
|
-
Identified (loading) f194b2e77661e660.a794fbcf7b104c68.querysubtest.com:34139 as a path authority for:
|
|
109
|
-
=-.,querysubtest._com.,/
|
|
110
|
-
IMPORTANT! The infinite identify loop causes servers to never finish identification, and so new PathValueServers couldn't start. SO THIS IS A REALLY BIG ISSUE!
|
|
111
|
-
- Restarting the server fixed it. I'm not sure if it was one service, or all of them?
|
|
112
|
-
|
|
113
|
-
DEBUG: Backblaze errors
|
|
114
|
-
- Add a life cycle which handles the fact that one request might result in errors and retries. It also might result in an initial connection being done. It might be waiting on the initial connection, or it might be the one that triggers the initial connection.
|
|
115
|
-
- Being able to split up the different life cycles by various values, such as if they had to connect, if they had to retry, etc., would be useful as well. And then also splitting up the timing. And graphing various timing such as how long the request actually takes (minus the retries, initial connection, throttling, etc), how long the overall call takes, etc.
|
|
116
|
-
- And being able to plot by time would be useful as well, so we can see if the errors are time-based.
|
|
117
|
-
|
|
118
|
-
SPECIAL UI links for certain errors in log view
|
|
119
|
-
- Probably dynamically created, based on contents of log
|
|
120
|
-
- LINKS to filters for all these special errors on a special page
|
|
121
|
-
- Special errors
|
|
122
|
-
- Rejection errors
|
|
123
|
-
- Link to life cycle filtering show the life cycles involving the path (we need to hardcode the life cycle ids for these, after we create the life cycles)
|
|
124
|
-
- Audit failures
|
|
125
|
-
- Same info as rejection errors, except for the path, and the failing lock path
|