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
Setup defined (and configurable) behavior if a ZedToken from
an older datastore is used
All ZedTokens are now minted with the datastore's unique ID included
in the ZedToken and that ID is checked when the ZedToken is decoded.
In scenarios where the datastore ID does not match, either an error is
raised (watch, at_exact_snapshot) or configurable behavior is used
(at_least_as_fresh)
Fixesauthzed#1541
log.Error().Str("zedtoken", consistency.GetAtExactSnapshot().Token).Msg("ZedToken specified references an older datastore but at-exact-snapshot was requested")
178
+
returnfmt.Errorf("ZedToken specified references an older datastore but at-exact-snapshot was requested")
179
+
}
180
+
155
181
err=ds.CheckRevision(ctx, requestedRev)
156
182
iferr!=nil {
157
183
returnrewriteDatastoreError(ctx, err)
@@ -175,7 +201,7 @@ var bypassServiceWhitelist = map[string]struct{}{
175
201
176
202
// UnaryServerInterceptor returns a new unary server interceptor that performs per-request exchange of
177
203
// the specified consistency configuration for the revision at which to perform the request.
log.Warn().Str("zedtoken", requested.Token).Msg("ZedToken specified references an older datastore and SpiceDB is configured to treat this as a full consistency request")
271
+
headRev, err:=ds.HeadRevision(ctx)
272
+
iferr!=nil {
273
+
returndatastore.NoRevision, false, err
274
+
}
275
+
276
+
returnheadRev, false, nil
277
+
278
+
caseTreatMismatchingTokensAsMinLatency:
279
+
log.Warn().Str("zedtoken", requested.Token).Msg("ZedToken specified references an older datastore and SpiceDB is configured to treat this as a min latency request")
280
+
returndatabaseRev, false, nil
281
+
282
+
caseTreatMismatchingTokensAsError:
283
+
log.Error().Str("zedtoken", requested.Token).Msg("ZedToken specified references an older datastore and SpiceDB is configured to raise an error in this scenario")
284
+
returndatastore.NoRevision, false, fmt.Errorf("ZedToken specified references an older datastore and SpiceDB is configured to raise an error in this scenario")
0 commit comments