Skip to content

Commit

Permalink
Document safe & unsafe Cache invalidations
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 13, 2022
1 parent f0c67f0 commit aea5f62
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public ListenableFuture<TokenPoll> getTokenPoll(UUID authId)

public void dropToken(UUID authId)
{
// TODO this may not invalidate ongoing loads (https://github.com/trinodb/trino/issues/10512, https://github.com/google/guava/issues/1881).
// Determine whether this is OK here.
cache.invalidate(hashAuthId(authId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ public long getCacheRequestCount()
@Managed
public void cacheReset()
{
// Note: this may not invalidate ongoing loads (https://github.com/trinodb/trino/issues/10512, https://github.com/google/guava/issues/1881)
// This is acceptable, since this operation is invoked manually, and not relied upon for correctness.
generatedBlockOperatorCache.invalidateAll();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public long getCacheRequestCount()
@Managed
public void cacheReset()
{
// Note: this may not invalidate ongoing loads (https://github.com/trinodb/trino/issues/10512, https://github.com/google/guava/issues/1881)
// This is acceptable, since this operation is invoked manually, and not relied upon for correctness.
cache.invalidateAll();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public CachingIdentifierMapping(

public void flushCache()
{
// Note: this may not invalidate ongoing loads (https://github.com/trinodb/trino/issues/10512, https://github.com/google/guava/issues/1881)
// This is acceptable, since this operation is invoked manually, and not relied upon for correctness.
remoteSchemaNames.invalidateAll();
remoteTableNames.invalidateAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ public LocatedFileStatus next()
@Managed
public void flushCache()
{
// Note: this may not invalidate ongoing loads (https://github.com/trinodb/trino/issues/10512, https://github.com/google/guava/issues/1881)
// This is acceptable, since this operation is invoked manually, and not relied upon for correctness.
cache.invalidateAll();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public LdapAuthenticator(LdapAuthenticatorClient client, LdapConfig ldapConfig)
@VisibleForTesting
void invalidateCache()
{
// Note: this may not invalidate ongoing loads (https://github.com/trinodb/trino/issues/10512, https://github.com/google/guava/issues/1881)
// This is acceptable, since this operation is invoked in tests only, and not relied upon for correctness.
authenticationCache.invalidateAll();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ public ListenableFuture<Void> load(MissingShard missingShard)
missingShard.getShardXxhash64(),
missingShard.isActive());
ListenableFuture<Void> future = shardRecoveryExecutor.submit(task);
// TODO this may not invalidate ongoing loads (https://github.com/trinodb/trino/issues/10512, https://github.com/google/guava/issues/1881).
// Determine whether this is OK here.
future.addListener(() -> queuedMissingShards.invalidate(missingShard), directExecutor());
return future;
}
Expand Down

0 comments on commit aea5f62

Please sign in to comment.