Skip to content

Commit

Permalink
Release previous cartridge bucket on version overwrite/update.
Browse files Browse the repository at this point in the history
This mostly accounts for the case where developer version overwrites (installing a new cartridge that's the same version as an existing one) lead to unbounded storage growth because bucket keys are bound to a cartridge/version, so the new cartridge holds a strong reference to all previous cartridge buckets it replaced as well and those will only be collected when the cartridge is upgraded or archived.

This also improves storage usage for regular upgrades a little bit by making sure the garbage collection of the previous bucket kicks in faster.
  • Loading branch information
cute-the-niini committed Apr 16, 2024
1 parent c80db6c commit fb030e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/kate-core/source/os/apis/cart-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ export class CartManager {
}
);

if (old_meta != null && old_meta.bucket_key != null) {
const key = old_meta.bucket_key;
const partition = await this.os.file_store.get_partition(key.partition);
await partition.release_persistent(key);
}

await this.os.audit_supervisor.log("kate:cart-manager", {
resources: ["kate:storage"],
risk: "low",
Expand Down

0 comments on commit fb030e8

Please sign in to comment.