Skip to content

Erasing personal data

The GDPR and the CCPA give people the right to have their data deleted, and whoever holds it must do so within a month (GDPR) or 45 days (CCPA), and be able to show it did. An agency’s warehouse holds emails, device IDs and hashes of them in many tables, copies and snapshots, and a plain DELETE leaves the rows in data files, old snapshots, query history and caches.

ERASE SUBJECT erases a person’s identifiers from all of them, physically, and keeps a record of what it did that no longer says whose data it was:

ERASE SUBJECT WHERE pii.email = 'ann@example.com' OR pii.device_id = '6F9619FF-8B86-D011-B42D-00C04FC964FF';
-- request_id | status
-- 01a14588-18d9-7271-8635-6fed7a56e198 | queued
SELECT status, verification FROM igloo.erasure_requests;
-- completed | {"rows":0,"files":0,"bounds":0,"statistics":0,"storage":0,"orphans":0,"sharing":0,"history":0,"caches":2,...}

A request usually completes within a minute or two. Data retentions (below) limit how long tables keep old versions of their rows in the first place.

Requests need the erasure key, IGLOO_ERASURE_KEY or the file IGLOO_ERASURE_KEY_FILE names (configuration), which the single-VM setup and the Helm chart generate. Every replica needs the same one: a replica with another key, or none, leaves requests to those that have it.

When a request completes, the person’s rows cannot be read through Igloo, or recovered from storage, in any table Igloo manages. That covers the tables’ current data, their older snapshots (time travel), branches, tags and clones; what is left in the warehouse of tables dropped or replaced, however that happened (a request waits for those of such files that are less than 3 days old, below); what Delta Sharing recipients and engines reading through Igloo’s Iceberg REST catalog can reach; the read cache of every running replica (a stopped one empties its own when it next starts); the results of queries every running replica keeps; what every worker of distributed execution keeps of what it read, its read cache, footers, models and exchange files (a worker purges before it serves again, and one whose cache outlives it that does not run keeps the request from completing until it has); the answers AI functions cached from those tables; the models trained from them, which it trains again, and their old blobs; the materialized views and dynamic tables made from them, their older snapshots and the state incremental refreshes keep, which it replaces; and the query, login, load and task history. A request finds the person’s rows by the columns tagged for the identifiers it names (below).

A request that cannot finish never reports itself completed. One that has not deleted anything yet fails, and says why; one that has begun deleting stays blocked, alerts, and keeps its identifiers sealed until an admin fixes the cause, when it goes on, or closes it (CLOSE ERASURE REQUEST), which records what it left (below).

The guarantee trusts the admins, the Iceberg catalog (Lakekeeper) and the object store. It does not extend, and Igloo does not defend, against:

  • Writes that go around Igloo: engines or people that change the catalog or the bucket directly rather than through Igloo’s SQL or its Iceberg REST catalog, such as a table another engine dropped, renamed or upgraded to format version 3 in Lakekeeper itself, or files written into the bucket.
  • Copies outside Igloo: exports and extracts, BI tools’ caches, files partners downloaded, other engines’ own copies of the tables, and backups or versions of the bucket and of the metadata database.
  • An admin who sets out to defeat a request, as by untagging the columns that hold the identifiers, or restoring a backup.

A request finds a person’s data through tags: it erases the rows whose columns tagged with the tag value it names hold one of its identifiers. Tag every column that holds an identifier, in every table, copies and materialized views included:

CREATE TAG pii ALLOWED_VALUES 'email', 'email:sha256', 'email:null', 'device_id';
ALTER TABLE crm.contacts ALTER COLUMN email SET TAG pii = 'email';
ALTER TABLE marts.impressions ALTER COLUMN device_id SET TAG pii = 'device_id';
ALTER TABLE audiences.segments ALTER COLUMN email_hash SET TAG pii = 'email:sha256';
ALTER TABLE crm.referrals ALTER COLUMN referrer_email SET TAG pii = 'email:null';
  • Values compare as DuckDB’s lower(trim(...)) leaves them, so ' Ann@Example.com' finds ann@example.com, UUIDs and integers compare as their text, and binary columns as hex. A UUID is found in UUID columns and in binary columns that hold its 16 bytes, whether it is given with dashes or as 32 hex digits. What Igloo compares itself, in manifest bounds, the rows it rewrites and history, it normalizes with DuckDB’s own tables, which differ from Go’s for characters newer Unicode versions added. Tagged columns must be strings, UUIDs, binary values or integers: a request is refused while a tag it needs is on a list, struct or map, whose values hold identifiers inside them. A JSON document in a string column compares as a whole, too. A request logs a warning when one tag value is on columns of different kinds (text, UUIDs, bytes, integers): an identifier given in a form some of them do not hold finds nothing there.
  • What a request could not finish is refused before it deletes anything. A table it could not erase from with certainty is refused when a request is made, and again before its first DELETE, when the request fails having deleted nothing: a table of Iceberg format version 3, which can hold deletion vectors that Igloo cannot read yet; a table with a data or delete file that is not Parquet, which Igloo can neither search nor rewrite; and a table with a branch or tag whose schema requires a value in a column tagged :null, or whose files Igloo could not write again with a partition spec that schema has the columns of, or whose manifests list files of a spec no schema of the table has the columns of. Each table is loaded and checked again just before each DELETE from it, on every run, retries included, a DELETE sent again after losing to another writer’s commit too, so no DELETE runs on a table another engine changed so meanwhile.
  • Tables stay within reach. Igloo has its catalog (Lakekeeper 0.13 or later) refuse tables of format version 3 in its warehouse, whoever makes or upgrades them, when it starts (with IGLOO_CATALOG_SETUP=false it does not, and logs a warning: set the warehouse’s format-version policy yourself); tables of version 3 made before stay writable. Lakekeeper’s APIs have no authentication of their own, so this, and everything below, holds only while nothing but Igloo reaches the catalog: keep it on a private network, as the Helm chart’s NetworkPolicy does. On top of that, and on any catalog, Igloo’s SQL and its Iceberg REST endpoint refuse, to everyone, admins included: to upgrade a table with tags to version 3, or to make a table of version 3 under its name; and, while a request that is not over erases from a table (its clones too), to drop it or its schema, to replace it (CREATE OR REPLACE TABLE, with AS SELECT or CLONE too), to rename it or another table to its name, to upgrade it, or to make a table of version 3 under its name. In SQL these rules hold for every change a statement makes to the catalog, as the catalog would see it, however the statement says so: Igloo checks each change DuckDB asks of the catalog before the catalog gets it, so EXPLAIN ANALYZE, a statement among others, a prepared statement, or set_iceberg_table_properties with a key computed at run time make no difference. No one sets or removes Igloo’s own clone properties (igloo.clone.*) but CREATE TABLE ... CLONE, so no table can claim to read a tagged table’s files and be taken into requests for it. Parquet position delete files scoped to one data file, as Java’s Iceberg writes Spark’s, are read as any.
  • Nothing a writer does stops anyone’s erasure. A snapshot whose manifest list does not exist references nothing anyone can read: a request passes over it (Igloo’s Iceberg REST endpoint refuses such snapshots, but a catalog takes them). A table of the catalog that cannot be read at all, as one whose manifest list is damaged, nothing reads either: a request keeps the files under its location, and those it says it shares, which it may reference, and deletes the rest.
  • What is left of a dropped table goes. Whatever is left of a table dropped or replaced, however that happened, whether clones read its files then or not, is under no table’s location: every request deletes the warehouse’s files under no table’s or view’s location that no table references (below). Dropping or replacing a table through Igloo also deletes its files at once, unless clones may read them, but the guarantee does not rest on that.
  • Once it has sent a DELETE, a request never fails: failing would forget whose rows it deleted while files may still hold them. A table it cannot go on with then, as one another engine renamed or upgraded to version 3 by going around Igloo, is set aside, and the request goes on with its other tables through every step; it is then blocked (see below) until someone fixes it, or an admin closes it. A table another engine dropped, or replaced, as CREATE OR REPLACE TABLE does, is not: its files, under a location no table has any more, go as all such files do, and the request erases from a table that has its name now.
  • Hashed identifiers: a tag value with :sha256, :sha1 or :md5 after it marks a column of the identifier’s hex digest, as ad platforms match on: of the identifier as given, or lower-cased and trimmed. A request for pii.email erases from columns tagged pii = 'email' and pii = 'email:sha256' alike. Binary digests work too. To erase by the hashes a partner’s opt-out list holds, name the hashed value: ERASE SUBJECT WHERE pii."email:sha256" = '5d41402a...' erases from the columns tagged pii = 'email:sha256'.
  • Whole rows go. A request deletes every row in which a tagged column holds an identifier. A column that names the person in a row about someone else, such as a referrer’s email, is tagged with :null after the value (pii = 'email:null', pii = 'email:sha256:null'): the request sets it to NULL in such rows and keeps them. Such a column must allow NULL.
  • A request for a tag value no column of the catalog’s tables has is refused, so a request never silently erases nothing; so is one while a table with such a tag does not exist, as after it was dropped, through Igloo or not, or renamed by another engine: unset its tags (ALTER TABLE t ALTER COLUMN c UNSET TAG pii works on a dropped table’s name), or tag it under its new name.
  • Zero-copy clones count as tagged where their source is, and the reverse (below): tag either.
  • Tags stay with a table’s name and a column’s: renaming a table with tags, or renaming, dropping or changing the type of a tagged column, is refused, in SQL (ALTER TABLE ONLY included) and through the Iceberg REST catalog alike, admins included, so nothing slips out of later requests. So is CREATE OR REPLACE TABLE of a table with tags when the new table lacks a tagged column, and, through the REST catalog, removing a tagged table’s old schemas, which name its columns as they were. A column that another engine dropped and added again under its name anyway is still found: a request looks in every field that had the name, older files included. A tagged column that none of a table’s schemas has, as after another engine replaced the table with one that names it otherwise, makes the request fail rather than complete without erasing from it: tag the column that holds the identifiers now.

Admins, and users granted ERASE on the account, directly or through a custom role. A privacy officer needs nothing else, not even the reader role:

CREATE ROLE privacy_officer;
GRANT ERASE ON ACCOUNT TO privacy_officer;
CREATE USER pat WITH PASSWORD '...' ROLE none;
GRANT privacy_officer TO pat;

They may ask for erasures, preview, confirm and cancel them, list the requests, and set data retentions of tables with tags. A held request must be confirmed by someone other than the user who made it: another admin or privacy officer. Other users see no requests. A request is carried out whatever later happens to the account that made it.

ERASE SUBJECT WHERE tag.value = 'identifier' [OR tag.value IN ('identifier', ...)] ... [DRY RUN]
CONFIRM ERASURE REQUEST 'request_id'
CANCEL ERASURE REQUEST 'request_id'
CLOSE ERASURE REQUEST 'request_id' -- admins only: the last resort for a blocked request
DEREGISTER WORKER 'name' -- admins only: stop waiting for a worker that will not come back

A request takes up to 1,000 identifiers, of one or more tag values; send a batch of people in one request when you can, since each request reads the tagged tables in full. It returns the request’s ID, and runs in the background. The identifiers never reach the query history, in whatever statement they are (the request is recorded as ERASE SUBJECT WHERE "pii"."email" IN ('***'), and any other statement that says ERASE SUBJECT, such as an EXPLAIN, as ERASE ...), the logs or the list of running statements.

Safeguards against erasing the wrong people:

  • Placeholders are refused: identifiers that stand for no one, such as an opted-out iPhone’s all-zero advertising ID (also in braces), the all-F ID, 0 in any form (0x0, 0e0, other scripts’ zeros), -1, null, nan, unknown, n/a or -, in brackets, quotes or spaces or not ((null), <null>), placeholder emails such as noemail@noemail.com, and the SHA-256, SHA-1 and MD5 digests of the empty string and of these, which hashed columns hold for every row without the identifier.
  • DRY RUN shows, without making a request, which tables a request would erase from, why, and how many of their rows match, of how many.
  • Large deletions wait to be confirmed. A request that would delete more than 1% of a table’s rows, and more than 100 of them, counting those that other requests made within 24 hours of it, before or after, match in the table (but those canceled, confirmed, or that failed before they deleted anything), or that would delete every row of a table however small, is held once it has counted them, before it deletes anything, until someone who may erase, other than its requester, runs CONFIRM ERASURE REQUEST. Whichever of such requests runs first, the others count it: one waits up to an hour for the others made about when it was to count their rows (waiting, with error naming them), and is held if they still have not. The metric igloo_erasure_requests_held_total counts held requests.
  • CANCEL ERASURE REQUEST cancels a request that has not begun deleting: once it has sent its first DELETE, which may have committed even when no answer came, it must finish.

A request runs as a job on Igloo’s scheduler, on one replica at a time, one request at a time. A run that finds another request running ends at once and tries again a minute later, so requests never hold up tasks, pipes and materialized views. Each step is recorded when it ends and works from the tables as they are when it runs, so a request that a failure or a restart interrupts goes on where it stopped. Before each step, a run checks that it still holds its lock, which it loses if its connection to the metadata database drops. With scale to zero, the gateway starts Igloo while a request has work to do.

Step What it does
find Lists the tables with columns tagged with the request’s tag values; the tables being made to replace them (below); the tables that share data files with them (clones); and the tables that the query history and the definitions of materialized views and tasks say were written from them. Tagged tables of connections are listed, but nothing is erased from them. Counts their rows and those that match, and holds a request that would delete much of a table.
delete Deletes the matching rows, as a DELETE would: queries no longer see them. Last, it deletes from each ID domain’s dictionary once more, holding the domain’s lease and having noted the erasure, which a write giving values new ids checks under the lease: one that found the person’s value in rows this step then deleted adds no entry for it, so no erased value comes back into a dictionary. Before its first DELETE, and again under the lease just before that last delete, it looks up the ids the dictionaries gave the person’s values, and keeps them sealed under the erasure key with the identifiers, for the sets derived from ids (below).
rewrite On every branch and tag of every table, writes each data file that holds matching rows again with its deletes applied, leaving out the rows that match, or setting columns tagged :null to NULL in them, in the same commit that replaces the file: rows that arrived since the delete step go too. Equality delete files that hold matches go with the files they apply to, or at once if they apply to none; a position delete file goes only when every file it deletes rows of is replaced or gone, so rows deleted from files the commit keeps stay deleted. Then writes again the manifests that still list the old files: a manifest keeps a removed file’s entry, with column bounds that can hold the value itself. Every branch but main is rewritten with its head’s own schema, and a tag with its snapshot’s, as they are read (Igloo’s AT (BRANCH => …), PyIceberg), so a column dropped since stays in them; main, with the table’s current schema. Each file is written again with its own partition spec or, if the schema it is read with lacks a column that spec partitions by, with the table’s default spec or another whose columns it has. A tag is rewritten on a branch of the request’s (igloo-erasure-…), and moved to the result, if it still points where it did: a tag moved meanwhile is rewritten where it points now, and the branch of a tag dropped meanwhile goes. Branches keep their unpublished rows. A position delete file that carries the rows it deletes, as the spec allows, and holds the person’s, goes too, with the files it deletes rows of rewritten so that it can, or at once if none of them is live any more, as after another engine rewrote them copy-on-write.
views Replaces every materialized view and dynamic table whose query reads one of the request’s tables, or a table history says was written from them, or such a view, whose table or state has a snapshot from before the step began: upstream views first, each made again from its query, as its owner, as CREATE OR REPLACE TABLE … AS would (grants kept), which deletes the old table’s files, older snapshots and all, and the files a full refresh of the view stopped before its commit left (operations); its state for incremental refreshes (igloo_refresh), which can hold a group’s ids in a bitmap, dropped; and what its last refresh read forgotten, so its next refresh is full. It holds the view’s job while it does, so no refresh runs meanwhile; one that runs makes it try again a minute later. A view it cannot replace, because its owner is gone, is disabled or may no longer read its tables, keeps the request blocked, with an alert naming the view and why; it goes on once the view can be replaced or is dropped.
expire Expires the snapshots that reference a file that held matching rows, or whose bounds may, however recent, so time travel to them ends. Snapshots that reference none stay, older ones included, and so do the snapshots branches and tags point at, which the rewrite step made reference none. A snapshot staged by write-audit-publish (Spark’s wap.id) that holds matching rows holds others’ unpublished rows too: the request waits (waiting, with error saying which) for it to be published, by fast-forward or by cherry-pick (a snapshot with its wap.id as published-wap-id), and then rewrites the branch, or discarded. It waits from when the request was made, as long as maintenance keeps such a snapshot (7 days, or the table’s history.expire.max-snapshot-age-ms if longer), and at most 21 days, so that it completes within the month the GDPR allows; then it expires the snapshot, unpublished rows and all. The commit asserts every branch and tag as the catalog has them just before it, so none made meanwhile at an expired snapshot is lost. Last, it has the sets Igloo derives from ID domains’ ids, such as bitmap indexes, delete or rebuild every set that holds one of the person’s ids, with the versions and files that hold it.
purge Deletes from object storage the files only the expired snapshots referenced, and the tables’ orphan files that are at least 3 days old, those a worker’s write or a replica’s stopped before its commit left included. A newer orphan may belong to a write in progress; if one holds matching rows, the request waits until it is 3 days old, then deletes it. It also deletes the warehouse’s files under no table’s or view’s location (below): all of them unread: those at least 3 days old at once, newer ones once they are 3 days old, which the request waits for. It deletes files only in the warehouse, and never one that another table references (clones). Paths compare without their scheme (s3a:// and s3:// name the same file, as file:// and a local path do), unescaped, and a listed file that the table references under a spelling Igloo cannot tell the same, but whose name a referenced file has, is kept: if it holds matching rows, the request stops with an error that names it, for someone to check.
sharing Deletes the Delta Sharing copies of data files that hold matching rows, which Delta Sharing keeps under the warehouse’s .igloo/sharing/, those of tables since replaced included; it writes them again from the files that remain.
history Replaces the identifiers in the query history (statements, query tags, application names and the locations outside the catalog statements read), the login history’s application names, and the errors of the load history and of task runs, with ***: as they are, as SQL quotes them in a string (o’’brien@…), and as URLs and paths escape them (o%27brien%40…). Then it purges what AI functions cached from the request’s tables and from those history says were written from them, every answer derived from them, the person’s or not, and any answer of a statement that read what Igloo could not name, such as a file; and from then on no statement that began before the purge keeps anything more, since it may have read the person’s rows. This step runs after expire, so a statement that begins after it reads no snapshot that holds them.
models Trains again every model whose training read one of the request’s tables, or one history says was written from them, directly, through a view or through another model’s predictions; every model whose training read what Igloo could not name, such as a file; and every model created before Igloo recorded what models read. Each is trained from its CREATE statement, as its owner, with the search path and dialect it was created with, as CREATE OR REPLACE would, grants kept; oldest first, so a model trained on another’s predictions is trained after it; and only if it is still the model the request read, not one its owner replaced or dropped meanwhile. First the step moves the models’ erasure epoch on, once a round: a CREATE that read its training data before, which may have read the person’s rows, stores nothing and fails, asking to be run again. Then it deletes from object storage the blobs the models had, unless a model has the same, and has every replica drop the models and methods’ results it holds in memory (see cache), the models ai_predict_class and ai_predict_value trained among them: a statement prepared before then, which names them, fails with a message to prepare it again. A model it cannot train again, because its owner is gone or may no longer create models in its schema or read its input, or its input no longer runs, keeps the request blocked, with an alert naming the model and why; it goes on once the model can be trained again or is dropped.
cache Waits until every running replica has emptied its read cache, on disk and in memory, since the request deleted files or trained models again; the replica drops the models it holds in memory, and the query results it keeps, with it. A cache is emptied whole: it may also hold blocks of files deleted before, by maintenance or another engine. A replica that is not running empties its cache when it starts. It waits for every running worker of distributed execution too, which coordinators have purge within 15 seconds of a deletion, and for those no coordinator reaches until they have had time to purge by themselves; it is blocked, with an alert naming them, while a worker whose read cache outlives it does not run and has not purged, or a worker does not say what it keeps.
verify Looks for tables being made for the tagged tables since it last looked, and then for the identifiers in what is left: the tables’ rows; every data and delete file any snapshot references, deleted rows included; the bounds of every manifest entry, live or not; the Parquet statistics of every data file; recent orphan files; the warehouse’s files under no table’s or view’s location; sharing copies; history; AI functions’ cached answers derived from the tables by statements that began before the purge; the sets derived from ID domains’ ids; models trained from the tables that the models step has not trained again, and the old blobs of those it did that object storage still has; materialized views and dynamic tables made from the tables whose table or state has a snapshot from before the views step; workers whose read caches outlive them that do not run and have not purged. Anything found sends the request back to the step that removes it.

A failed run is tried again after a minute, then 2, 4 and so on up to an hour. Before its first DELETE, a request fails for good (failed) when its runs fail 10 times in a row, or at once when it finds a table it could not erase from (see above): it stops, forgets its identifiers, logs erasure request failed at error level, raises the built-in alert FAILED_RUNS (alerts), and counts in igloo_erasure_requests_failed_total. It has deleted nothing; fix what error says and make the request again.

Once it has sent a DELETE, which may have committed even when no answer came, a request never fails. A table it cannot go on with, as one another engine renamed or changed so that the request cannot erase from it any more, or whose runs fail 10 times in a row, is set aside: its blocked and blocked_at (in tables) say why and at which step, and the request goes on with its other tables through every step, so their old snapshots are expired and their files deleted. Failures count per table: a run that fails with one table counts against that table alone, so one passing error of another does not set it aside. While a table set aside cannot be read, the files under its location stay, as it may reference them; the others’ go.

Igloo treats the warehouse as its own: the location of a table or view of the catalog is the only claim on a file in it. When it purges, and again when it verifies, every request lists the whole warehouse once, and deletes, as orphan files, the files under no table’s or view’s location: those of tables dropped or replaced, before the request or while it ran, through Igloo or around it, while clones read them or not, and files written for tables never made. None is read: what a dropped table’s file holds can be under column names it no longer has, or in a manifest’s bounds. One at least 3 days old goes at once. A newer one may be a file of a table being made (a staged CREATE TABLE ... AS, here or in another engine), so the request waits until it is 3 days old, then deletes it, and verification counts it until then; meanwhile the request lists the warehouse again every hour, so a file the catalog has deleted, or that a table being made has come to own, stops counting. So a drop or replace that leaves files less than 3 days old makes requests wait for them. Through Igloo, few do: dropping a table and replacing one, with CREATE OR REPLACE TABLE ... AS or a clone refresh (CREATE OR REPLACE TABLE ... CLONE, CREATE OR REPLACE SCHEMA ... CLONE), delete the old table’s files at once, as long as no clone reads them, decided the same way for each (files that clones share). Those of a table that clones read, or may (Igloo cannot tell), stay, and are under no table’s location once the clones are gone too. A waiting request’s error says how many files it waits for, and names one. A file another table references stays, as do the files under the location of a table that cannot be read and those it says it shares, and Igloo’s own files (.igloo/). Which files are whose cannot be told while a table or view of the catalog cannot be loaded, so a request does not complete until it can.

So a table dropped while the request runs is not set aside: the request goes on without it, and what it held goes with the rest. The same goes for a table replaced under its name, as CREATE OR REPLACE TABLE does: the request erases from the new table. A table renamed rather than dropped still holds its rows, and is set aside for someone to tag it under its new name.

CREATE TABLE ... AS and CREATE OR REPLACE TABLE fill a table under a temporary name (name__igloo_new_...) and rename it to the name. While they run, and if Igloo stops part way, that table holds a copy of the tagged table’s rows, and its location the files workers wrote for it. It joins the request with the tagged table’s columns, those it has, at the find step and at each verification, for those made since, and goes through every step as any other table.

What would fail the request itself, as verification that sends it back more than five times because matching rows keep coming back, or a table set aside, makes it blocked: it keeps its identifiers sealed, logs at error level, raises FAILED_RUNS (once an hour), counts in igloo_erasure_requests_blocked_runs_total, and every hour takes up again the tables it set aside, each for one try, from the step the earliest stopped at, or goes on from the step that removes what verification found. It completes once what error says is fixed, and cannot be canceled. Each failed run raises FAILED_RUNS for the request’s job too, with the error, scrubbed of identifiers and hashes as everything the request logs is.

The last resort. When what blocks a request will not be fixed, as a table another engine upgraded to version 3, which Igloo cannot rewrite yet, an admin can end it with CLOSE ERASURE REQUEST, once someone has erased what it could not in another way. Before it forgets the identifiers, closing does what needs no table: it deletes the Delta Sharing copies that hold the person’s rows, redacts the identifiers from the history, and has every replica, and every running worker, empty its read cache of what the request deleted. If one of those cannot be done yet, as while a replica has yet to empty its cache, the request is not closed, and the error (SQLSTATE 55000) says why: try again. The files the request recorded for a table set aside that was dropped since go, unless a table references them, as do the old files under no table’s location. What it erased stays erased; each table it did not finish with keeps why in left (in tables), with the paths of the files it leaves that may hold the person’s rows (its identifiers scrubbed from them), those it recorded and did not delete; error lists the newer files under no table’s location (the first 100 of them), which a later request deletes once they are 3 days old. A table counts as finished only if the last verification found nothing, not an earlier one. The request records who closed it, as closed with error saying so, logs erasure request closed at warning level, and forgets its identifiers, as a completed request does. The statement is in the query history like any other. Only admins may close a request, and only a blocked one: privacy officers and the requester cannot, as they cannot cancel one that has begun deleting.

Three kinds of run never count, however often they happen, since none says anything is wrong with the request:

  • Other writers came first. Igloo never lets iceberg-go retry a commit that removes files, whatever commit.retry.num-retries says: a retry would list the replaced files again beside their replacements. A rewrite that lost to appends is committed again on the new head with the files it already wrote; one that lost to anything else is planned again. A table that writers change faster than that keeps the request retrying, a minute at a time, until they leave it a moment.
  • The catalog could not answer. A table that the catalog cannot load for a moment (unavailable, or failing) when a request checks whether the catalog’s tables share files with its own stops the run, which tries again a minute later: leaving the table out could delete files it reads. A table the catalog refuses for good (forbidden, or a bad request) is left out, with a warning in the log, as nothing can read it.
  • The erasure key. A replica whose IGLOO_ERASURE_KEY is not the one a request’s identifiers were sealed under, or that has none, leaves the request retrying with an error that says so, logs it at error level, and lets a replica with the right key run it. Set the same key on every replica.

A zero-copy clone references its source’s data files, under the source’s location, and its compactions and updates write copies of the source’s rows under its own. A request therefore erases from the clones of the tables it finds and from the tables those were cloned from, clones of clones included, whichever of them has the tags; a clone’s columns are its source’s, renamed or not. A file one of them references is rewritten in each, and its snapshots expired in each, before it is deleted. Tables that reference another’s files otherwise, as another engine’s add_files can make them, are found by their manifests, and their columns named like the tagged ones count as tagged.

While a request deletes files, it holds the locks that making a clone of one of its tables takes (CREATE TABLE ... CLONE, see SQL), so no clone is made meanwhile; while one is being made, the request tries again later. A clone made after the request began is added to it. If a table the request does not erase from references a file it would delete, the request stops with an error that names the table instead of breaking it: tag that table’s columns and ask again for the same identifiers, and the first request goes on once the second has erased from it. A table of the catalog that the catalog refuses for good, or whose metadata cannot be read, which nothing can read either, is left out of the search, with a warning in the log, rather than stopping every request; the files under its location, and those it says it shares, are kept, as it may reference them.

While a request is open, its identifiers are kept sealed (AES-256-GCM) under a key derived from the erasure key, and rows are found by SHA-256 hashes of their values salted with a value derived from the erasure key and a random salt of the request’s. Neither the identifiers nor the hashes are in the metadata database in the clear, and the erasure key never is: the database alone does not tell whose data a request erases, and nothing about them is sent to it, not even hashes. A replica unseals the identifiers in memory while it runs the request. Once a request completes, fails or is canceled, its sealed identifiers, its salt and the paths of the files it deleted, which can hold identifiers as partition values, are deleted too: its record says what was erased, from which tables and when, but not whose data it was. Erasing a table’s snapshots does not change the snapshot retention it has otherwise.

SHOW ERASURE REQUESTS and the view igloo.erasure_requests list every request, newest first, to admins and holders of ERASE:

Column Is
request_id, requester The request, and who made it
status queued, running, held (waits for CONFIRM ERASURE REQUEST), waiting (for replicas, for a recent file to be old enough to delete, or for a staged snapshot to be published or discarded), retrying (the last run failed; error says why), blocked (has begun deleting and cannot go on until what error says is fixed), completed, canceled, failed (before it deleted anything) or closed (by an admin while blocked)
step The step it runs next, done once complete
created_at, updated_at, completed_at When
subjects JSON: the tag values, and how many identifiers of each
tables JSON: per table, its tagged columns, why it was included, rows that matched of how many, rows deleted, values nulled, files rewritten, snapshots expired, files deleted, files outside the warehouse it left, the branches and tags it rewrote, and when each step ended for it; remote for a table of a connection, which it did not erase from; blocked and blocked_at for a table it set aside, failures for one whose runs failed in a row, gone for a table dropped while it ran (see above), and left, once an admin closed it, for one it did not finish with
downstream JSON: tables written from those, as history tells, and whether the request erased from them because they have the tags too
history_redacted History records redacted
steps JSON: when each step started and last finished, and how often it ran
verification JSON: what the last check found, counts only (see the verify step), models and workers among them; all zero once complete, with the number of read caches emptied since it deleted files and of those that will be when their replica starts
error Why the last run failed, or what it waits for, without identifiers or the request’s hashes
SELECT request_id, completed_at, t->>'table', t->>'rows_deleted'
FROM (SELECT *, unnest(json_extract(tables::JSON, '$[*]')) AS t FROM igloo.erasure_requests);

Each run of a request is in igloo.task_history, as kind erasure. The log says erasure requested, erasure request completed, erasure request held, confirmed, canceled, failed, cannot go on (blocked, or a table set aside) and closed, and why a run failed. Requests are kept in the metadata database (schema igloo_erasure); without one, in memory, lost on restart.

A downstream table that does not have the tags is reported and left alone: tag its columns and ask again. Materialized views and dynamic tables are replaced (the views step), whether they have the tags or not.

Tables that hold personal data can be kept from holding old versions of rows for long:

ALTER TABLE marts.impressions SET (data_retention_days = 30);
ALTER TABLE marts.impressions RESET (data_retention_days);
SELECT * FROM igloo.data_retention;

Table maintenance then keeps no snapshot older than that but the current one, whatever the table’s snapshot retention and history.expire.min-snapshots-to-keep say, and rewrites the data files whose rows were deleted longer ago, so the rows leave the files too, but those of tables with deletion vectors, which Igloo cannot read yet: it logs a warning and leaves them. Time travel on main reaches back that far at most. With an hourly maintenance pass, a deleted row is gone from storage about an hour after it is older than the retention. Branches and tags, and the snapshots they point at, are kept as long as their own max-ref-age-ms or the table’s says, forever by default: a tag can be someone’s reference point, such as an audit’s. Drop the ones that must not outlive the retention, or let an erasure request rewrite them.

A retention is at least a day. Admins set and remove data retentions of any table, holders of ERASE of tables with tagged columns. Everyone may list those of the tables they may see; admins and holders of ERASE, all of them. They are kept with policies and tags, stay with a table’s name, and renaming such a table is refused.

A request reads the tagged columns of every tagged table in full, every file of every snapshot, when it starts and again when it verifies, and rewrites only the files that hold matching rows, at most 8 GB per commit, on every branch and tag that holds them. It reads every record of the history stores twice, as it redacts and as it verifies, lists the whole warehouse when it purges and when it verifies, and, before it deletes files, the metadata of every table in the catalog, to be sure no other table references them, which it remembers by metadata file between runs, so a table that did not change is not read again. DuckDB reads only the tagged columns, with all of a replica’s cores; a table of billions of rows takes minutes. Requests run one at a time, so batching people into one request saves reading the same tables again. Each replica’s read cache is emptied once after a request deletes files, and fills again as queries read.