Skip to content

Commit

Permalink
Prevent open client leak
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Sep 25, 2019
1 parent 099121c commit a520d7e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1423,13 +1423,15 @@ private ThriftMetastoreClient createMetastoreClient()
private ThriftMetastoreClient createMetastoreClient(HiveIdentity identity)
throws TException
{
ThriftMetastoreClient client = createMetastoreClient();
if (!impersonationEnabled) {
return client;
return createMetastoreClient();
}

setMetastoreUserOrClose(client, identity.getUsername()
.orElseThrow(() -> new IllegalStateException("End-user name should exist when metastore impersonation is enabled")));
String username = identity.getUsername()
.orElseThrow(() -> new IllegalStateException("End-user name should exist when metastore impersonation is enabled"));

ThriftMetastoreClient client = createMetastoreClient();
setMetastoreUserOrClose(client, username);

This comment has been minimized.

Copy link
@tooptoop4

tooptoop4 Sep 26, 2019

Contributor

No test :O

return client;
}

Expand Down

0 comments on commit a520d7e

Please sign in to comment.