Skip to content

Commit

Permalink
fix(swingset): move "kernelStats" into local/non-hashed DB space
Browse files Browse the repository at this point in the history
The kernelstats are merely incidentally deterministic: unlike c-lists and
run-queues and object/promise state, stats aren't the primary thing we want
to compare across replicas in a consensus machine. And we might want to add
more in the future without causing a compatibility break. So this changes the
DB key from `kernelStats` to `local.kernelStats`, which will exclude them
from the #3442 kernel activity hash.
  • Loading branch information
warner committed Aug 12, 2021
1 parent e79e43c commit df8359e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/SwingSet/src/kernel/state/kernelKeeper.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const enableKernelGC = true;

// exclude from consensus
// local.snapshot.$id = [vatID, ...]
// local.kernelStats // JSON(various kernel stats)

// d$NN.o.nextID = $NN
// d$NN.c.$kernelSlot = $deviceSlot = o-$NN/d+$NN/d-$NN
Expand Down Expand Up @@ -208,11 +209,14 @@ export default function makeKernelKeeper(hostStorage, kernelSlog) {
}

function saveStats() {
kvStore.set('kernelStats', JSON.stringify(kernelStats));
kvStore.set('local.kernelStats', JSON.stringify(kernelStats));
}

function loadStats() {
kernelStats = { ...kernelStats, ...JSON.parse(getRequired('kernelStats')) };
kernelStats = {
...kernelStats,
...JSON.parse(getRequired('local.kernelStats')),
};
}

function getStats() {
Expand Down

0 comments on commit df8359e

Please sign in to comment.