Forráskód Böngészése

log + docs: the upgrade line no longer asks for a restart when nothing was rewritten; migration memory by phase

The online-upgrade log line said 'old plaintext copies are removed at the
next restart' even when 0 rows were rewritten and no reseal was requested
(reported by smartbotic-vectorapi). The guide now carries the measured
memory profile: the seal snapshot is the anonymous peak, compaction adds
none, and progress is not persisted, so a host that cannot fit the
snapshot fails at the same point on every boot. Not released.
fszontagh 1 hónapja
szülő
commit
28d3b112ae
2 módosított fájl, 30 hozzáadás és 8 törlés
  1. 22 5
      docs/integration-guide.md
  2. 8 3
      service/src/database_grpc_impl.cpp

+ 22 - 5
docs/integration-guide.md

@@ -1026,11 +1026,28 @@ backups or copies taken before the upgrade.
   needed rewriting took about 6.5 minutes; 24,733 rows / a 339 MB env / 192 MB
   of history that needed no rewriting took 190 s, of which 167 s was compacting
   that one env (measured by a consumer, under a 900 MB memory cap).
-- **Memory:** plan with the ANONYMOUS memory (364 MiB in the second run). RSS /
-  VmHWM also count the file-backed LMDB map (1.1 GB in that run, above its cap)
-  which the kernel reclaims under pressure rather than killing anything, so an
-  RSS above 1 GB on a 2 GB host is not by itself a reason to stop it. Since
-  2.17.1 history is rewritten one record at a time.
+- **Memory:** plan with the ANONYMOUS memory. RSS / VmHWM also count the
+  file-backed LMDB map, which the kernel reclaims under pressure rather than
+  killing anything, so an RSS above 1 GB on a 2 GB host is not by itself a
+  reason to stop it. Measured per phase (cgroup `memory.stat`, 22.5k documents,
+  2.17.2):
+
+  | phase | anonymous max | page cache max |
+  |---|---|---|
+  | boot + row pass | 456 MB (load spike, then ~375) | 218 MB |
+  | **seal snapshot** (5 s) | **774 MB** | 259 MB |
+  | compaction (3 min) | 373 MB, flat | 263 MB |
+
+  The peak is the seal's snapshot: the in-memory store serialized, compressed
+  and read back to verify, roughly the working set again on top of it. It is
+  the same code path as the server's routine snapshots, so a host that
+  survives those survives the seal; the peak RSS at a routine "Snapshot
+  created" is the number to check. Compaction adds no anonymous memory.
+  Progress is NOT persisted per step: a boot killed before the end repeats the
+  row pass (fast, skips what is done), the snapshot and every compaction, so a
+  host that cannot fit the snapshot fails at the same point on every boot -
+  restore the pre-upgrade backup rather than retrying. Since 2.17.1 history is
+  rewritten one record at a time.
 - **What it cannot reach:** copies made BEFORE that boot - backups, pre-upgrade
   copies, replicas, released disk blocks. Rotate any credential that was stored
   in plaintext.

+ 8 - 3
service/src/database_grpc_impl.cpp

@@ -2451,10 +2451,15 @@ grpc::Status DatabaseGrpcImpl::CreateCollection(
             service_.requestResealAtNextBoot(
                 smartbotic::database::resolveCollection(request->name()).project);
         }
+        // The tail must match what was requested above: an operator reads this
+        // line to decide whether a restart is due (reported by a consumer: the
+        // 2.17.2 wording asked for a restart that verify said was unneeded).
         spdlog::warn("v2.17 encryption: {} upgraded (encrypted={}, {} sensitive field(s)); {} row(s) "
-                     "and {} history version(s) encrypted now; old plaintext copies are removed at "
-                     "the next restart", request->name(), full.encrypted, full.sensitiveFields.size(),
-                     s.rewritten + s.lmdbOnly, s.versions);
+                     "and {} history version(s) encrypted now; {}", request->name(), full.encrypted,
+                     full.sensitiveFields.size(), s.rewritten + s.lmdbOnly, s.versions,
+                     s.rewritten + s.lmdbOnly + s.versions > 0
+                         ? "old plaintext copies are removed at the next restart"
+                         : "nothing was stored in plaintext, so no restart is needed");
     }
 
     return grpc::Status::OK;