You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 33d8254
Browse filesBrowse the repository at this point in the historyBrowse files
Deletes every relationship matching a filter, in committed batches.
63
+
64
+
Every filter flag is required. Pass <any> to leave a component
65
+
unconstrained; an omitted flag is an error, never a wildcard, so a forgotten
66
+
flag cannot widen the deletion. "*" is a literal subject object id (the
67
+
wildcard subject), so passing it to --subject-id matches only wildcard
68
+
relationships. Pass ... to --subject-relation to match
69
+
subjects that have no relation.
70
+
71
+
On CockroachDB the deletion advances a primary-key cursor so each batch resumes
72
+
where the last one stopped. On other engines it falls back to a slower loop that
73
+
rescans from the start of the range on every batch.
74
+
75
+
Relationships written while the deletion runs, whose keys sort before the
76
+
current cursor, are collected by a repeat sweep. Under sustained writes matching
77
+
the filter that sweep will not converge; pause writes to the affected filter for
78
+
a complete deletion.
79
+
80
+
Each batch logs its cursor, so an interrupted run can be resumed with
81
+
--resume-cursor taken straight from the log.
82
+
83
+
Unlike the serving path, batches wait indefinitely for a CockroachDB write
84
+
connection rather than failing fast after the 30ms admission-control default;
85
+
pass --write-conn-acquisition-timeout explicitly to bound the wait.
86
+
87
+
Batches also skip the CockroachDB transaction-overlap touch that orders the
88
+
commit timestamps of causally-dependent writes: a pure-delete batch has no
89
+
causal dependents, and the touch would contend with every concurrent write to
90
+
the cluster. Pass --datastore-tx-overlap-strategy explicitly to restore it.
91
+
92
+
Example:
93
+
94
+
spicedb datastore delete-relationships \
95
+
--datastore-engine=cockroachdb \
96
+
--datastore-conn-uri="postgresql://..." \
97
+
--resource-type=document \
98
+
--resource-id='<any>' \
99
+
--resource-id-prefix='<any>' \
100
+
--relation=viewer \
101
+
--subject-type=user \
102
+
--subject-id='<any>' \
103
+
--subject-relation='<any>'
104
+
105
+
106
+
```
107
+
spicedb datastore delete-relationships [flags]
108
+
```
109
+
110
+
### Options
111
+
112
+
```
113
+
--batch-size uint maximum relationships deleted per transaction (default 1000)
114
+
--datastore-allowed-migrations stringArray migration levels that will not fail the health check (in addition to the current head migration)
115
+
--datastore-bootstrap-files strings bootstrap data yaml files to load
116
+
--datastore-bootstrap-overwrite overwrite any existing data with bootstrap data (this can be quite slow)
117
+
--datastore-bootstrap-timeout duration maximum duration before timeout for the bootstrap data to be written (default 10s)
118
+
--datastore-conn-max-lifetime-jitter duration waits rand(0, jitter) after a connection is open for max lifetime to actually close the connection (default: 20% of max lifetime, 30m for CockroachDB)
119
+
--datastore-conn-pool-read-healthcheck-interval duration amount of time between connection health checks in a remote datastore's connection pool (default 30s)
120
+
--datastore-conn-pool-read-max-idletime duration maximum amount of time a connection can idle in a remote datastore's connection pool (default 30m0s)
121
+
--datastore-conn-pool-read-max-lifetime duration maximum amount of time a connection can live in a remote datastore's connection pool (default 30m0s)
122
+
--datastore-conn-pool-read-max-lifetime-jitter duration waits rand(0, jitter) after a connection is open for max lifetime to actually close the connection (default: 20% of max lifetime, 30m for CockroachDB)
123
+
--datastore-conn-pool-read-max-open int number of concurrent connections open in a remote datastore's connection pool (default 20)
124
+
--datastore-conn-pool-read-min-open int number of minimum concurrent connections open in a remote datastore's connection pool (default 20)
125
+
--datastore-conn-pool-write-healthcheck-interval duration amount of time between connection health checks in a remote datastore's connection pool (default 30s)
126
+
--datastore-conn-pool-write-max-idletime duration maximum amount of time a connection can idle in a remote datastore's connection pool (default 30m0s)
127
+
--datastore-conn-pool-write-max-lifetime duration maximum amount of time a connection can live in a remote datastore's connection pool (default 30m0s)
128
+
--datastore-conn-pool-write-max-lifetime-jitter duration waits rand(0, jitter) after a connection is open for max lifetime to actually close the connection (default: 20% of max lifetime, 30m for CockroachDB)
129
+
--datastore-conn-pool-write-max-open int number of concurrent connections open in a remote datastore's connection pool (default 10)
130
+
--datastore-conn-pool-write-min-open int number of minimum concurrent connections open in a remote datastore's connection pool (default 10)
131
+
--datastore-conn-uri string connection string used by remote datastores (e.g. "postgres://postgres:password@localhost:5432/spicedb")
132
+
--datastore-connect-rate duration rate at which new connections are allowed to the datastore (at a rate of 1/duration) (CockroachDB driver only) (default 100ms)
--datastore-follower-read-delay-duration duration amount of time to subtract from non-sync revision timestamps to ensure they are sufficiently in the past to enable follower reads (CockroachDB and Spanner drivers only) or read replicas (Postgres and MySQL drivers only) (default 4.8s)
139
+
--datastore-gc-interval duration how often the background worker deletes data that has aged out of the gc window; affects disk usage only, never which revisions are readable (Postgres and MySQL only) (default 3m0s)
140
+
--datastore-gc-max-operation-time duration maximum amount of time a garbage collection pass can operate before timing out (Postgres and MySQL only) (default 1m0s)
141
+
--datastore-gc-window duration how far into the past clients may read: revisions older than this are rejected as stale, regardless of whether their data has been physically deleted yet (default 24h0m0s)
142
+
--datastore-include-query-parameters-in-traces include query parameters in traces (Postgres and CockroachDB drivers only)
143
+
--datastore-max-tx-retries int number of times a retriable transaction should be retried; waits back off exponentially up to 10s (default 10)
144
+
--datastore-migration-phase string datastore-specific flag that should be used to signal to a datastore which phase of a multi-step migration it is in
145
+
--datastore-mysql-table-prefix string prefix to add to the name of all SpiceDB database tables
146
+
--datastore-prometheus-metrics set to false to disable metrics from the datastore (do not use for Spanner; setting to false will disable metrics to the configured metrics store in Spanner) (default true)
147
+
--datastore-read-replica-conn-pool-read-healthcheck-interval duration amount of time between connection health checks in a remote datastore's connection pool (default 30s)
148
+
--datastore-read-replica-conn-pool-read-max-idletime duration maximum amount of time a connection can idle in a remote datastore's connection pool (default 30m0s)
149
+
--datastore-read-replica-conn-pool-read-max-lifetime duration maximum amount of time a connection can live in a remote datastore's connection pool (default 30m0s)
150
+
--datastore-read-replica-conn-pool-read-max-lifetime-jitter duration waits rand(0, jitter) after a connection is open for max lifetime to actually close the connection (default: 20% of max lifetime, 30m for CockroachDB)
151
+
--datastore-read-replica-conn-pool-read-max-open int number of concurrent connections open in a remote datastore's connection pool (default 20)
152
+
--datastore-read-replica-conn-pool-read-min-open int number of minimum concurrent connections open in a remote datastore's connection pool (default 20)
153
+
--datastore-read-replica-conn-uri stringArray connection string used by remote datastores for read replicas (e.g. "postgres://postgres:password@localhost:5432/spicedb"). (Postgres and MySQL drivers only).
154
+
--datastore-read-replica-credentials-provider-name string retrieve datastore credentials dynamically using ("aws-iam")
155
+
--datastore-readonly set the service to read-only mode
156
+
--datastore-relationship-integrity-current-key-filename string current key filename for relationship integrity checks
157
+
--datastore-relationship-integrity-current-key-id string current key id for relationship integrity checks
--datastore-relationship-integrity-expired-keys stringArray config for expired keys for relationship integrity checks
160
+
--datastore-revision-quantization-interval duration boundary interval to which to round the quantized revision (default 5s)
161
+
--datastore-revision-quantization-max-staleness-percent float float percentage (where 1 = 100%) of the revision quantization interval where we may opt to select a stale revision for performance reasons. Defaults to 0.1 (representing 10%) (default 0.1)
162
+
--datastore-spanner-emulator-host string URI of spanner emulator instance used for development and testing (e.g. localhost:9010)
163
+
--datastore-spanner-metrics string configure the metrics that are emitted by the Spanner datastore ("none", "native", "otel") (default "otel")
164
+
--datastore-tx-overlap-key string static key to touch when writing to ensure transactions overlap (only used if --datastore-tx-overlap-strategy=static is set; CockroachDB driver only) (default "key")
165
+
--datastore-tx-overlap-strategy string strategy to generate transaction overlap keys ("request", "prefix", "static", "insecure") (CockroachDB driver only - see https://spicedb.dev/d/crdb-overlap for details) (default "static")
166
+
--datastore-watch-buffer-length uint16 how large the watch buffer should be before blocking (default 1024)
167
+
--datastore-watch-buffer-write-timeout duration how long the watch buffer should queue before forcefully disconnecting the reader (default 1s)
168
+
--datastore-watch-change-buffer-maximum-size string how much memory to reserve for the watch change buffer, either as a quantity of bytes (e.g. 5Gi) or a percentage of available memory (e.g. 50%). if this value is exceeded, the watch will error and must be restarted. (default "15%")
169
+
--datastore-watch-connect-timeout duration how long the watch connection to the underlying datastore should wait before timing out (CockroachDB driver only) (default 1s)
170
+
--pprof-block-profile-rate int sets the block profile sampling rate (between 0 and 1)
171
+
--pprof-mutex-profile-rate int sets the mutex profile sampling rate (between 0 and 1)
172
+
--relation string relation to match, or <any>
173
+
--resource-id string exact resource id to match, or <any>
174
+
--resource-id-prefix string resource id prefix to match, or <any>
175
+
--resource-type string resource type to match, or <any>
176
+
--resume-cursor string relationship to resume after, as printed by a previous run
177
+
--sleep-between-batches duration pause between batches, to bound datastore load
178
+
--subject-id string subject id to match, or <any> ("*" matches only the wildcard subject)
179
+
--subject-relation string subject relation to match, ... for subjects with no relation, or <any>
180
+
--subject-type string subject type to match, or <any>
181
+
--termination-log-path string local file path for Kubernetes terminationMessagePath; written with a JSON exit reason on TerminationError; disabled when empty
182
+
--write-conn-acquisition-timeout duration amount of time that the server will wait for a connection to the datastore to become available when performing a write operation before throwing a ResourceExhausted error. 0 means wait indefinitely. (CockroachDB driver only) (default 30ms)
183
+
--yes skip the confirmation prompt
184
+
```
185
+
186
+
### Options Inherited From Parent Flags
187
+
188
+
```
189
+
--log-format string format of logs ("auto", "console", "json") (default "auto")
--skip-release-check if true, skips checking for new SpiceDB releases
192
+
```
193
+
194
+
195
+
59
196
## Reference: `spicedb datastore gc`
60
197
61
198
Executes garbage collection against the datastore. Deletes stale relationships, expired relationships, and stale transactions.
@@ -480,6 +617,12 @@ spicedb serve [flags]
480
617
--experimental-dispatch-secondary-maximum-primary-hedging-delays stringToString maximum number of hedging delays to use for each request type to delay the primary request. default is 5ms (default [])
481
618
--experimental-dispatch-secondary-upstream-addrs stringToString secondary upstream addresses for dispatches, each with a name (default [])
482
619
--experimental-dispatch-secondary-upstream-exprs stringToString map from request type to its associated CEL expression, which returns the secondary upstream(s) to be used for the request (default [])
620
+
--experimental-full-relation-cache string full relation cache mode: disabled or enabled. When enabled, the server caches the complete set of relationships of a hot object#relation and serves reads — including negative answers — from memory. The --experimental-full-relation-cache-* flags only tune it; with --experimental-full-relation-cache-enabled=false or a zero max cost it stays inactive. When enabling, consider lowering --dispatch-cluster-cache-max-cost (e.g. 70% -> 40%) to fund --experimental-full-relation-cache-max-cost (default "disabled")
621
+
--experimental-full-relation-cache-enabled enable caching of full relations (has no effect unless --experimental-full-relation-cache=enabled) (default true)
622
+
--experimental-full-relation-cache-materialize-threshold uint accesses to an object#relation at one revision, within the estimator window, before its complete set at that revision is materialized (default 3)
623
+
--experimental-full-relation-cache-max-cost string upper bound (in bytes or as a percent of available memory) of the cache for full relations (has no effect unless --experimental-full-relation-cache=enabled) (default "30%")
624
+
--experimental-full-relation-cache-maximum-set-size uint maximum number of relationships in a materialized set; larger sets are memoized as too-big and served from the datastore (default 1024)
625
+
--experimental-full-relation-cache-metrics enable metrics for the cache for full relations (has no effect unless --experimental-full-relation-cache=enabled) (default true)
483
626
--experimental-lookup-resources-version lr3 if non-empty, the version of the experimental lookup resources API to use: lr3 or empty
484
627
--experimental-query-plan check comma-separated list of operations to route through the experimental query plan engine; valid values are check, `lr` (LookupResources), and `ls` (LookupSubjects)
485
628
--experimental-schema-mode string schema storage mode for migration to unified schema: read-legacy-write-legacy, read-legacy-write-both, read-new-write-both, read-new-write-new (default "read-legacy-write-legacy")
0 commit comments