Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalidation race in CachingJdbcClient #10544

Merged
merged 3 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public ListenableFuture<TokenPoll> getTokenPoll(UUID authId)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about:

  • MongoSession
  • CachingHiveMetastore
  • CachingJdbcClient
    ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MongoSession

covered here

CachingHiveMetastore

tbd

CachingJdbcClient

covered here

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).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/may/does/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guava can change. I want the reader to be thoughtful, not take my words for granted.

// 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