From fd76fdbbfdafd9dc0d7fc1c75e1adefcaa9061f7 Mon Sep 17 00:00:00 2001 From: 861752346 <69664195+861752346@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:53:34 +0800 Subject: [PATCH] [AMORO-1857]: Check short name for principal before call constructUgi() (#1990) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [AMORO-1857] Fix If the kerberos account information filled in during catalog creation is abbreviated, it will cause the FileSystem to be unable to hit the cache, constantly create new FileSystem instances without being garbage collected, eventually leading to an out of memory error (#1857) * extract principal from username of ugi,and compare to krbPrincipal * [AMORO-1857] Fix If the kerberos account information filled in during catalog creation is abbreviated, it will cause the FileSystem to be unable to hit the cache, constantly create new FileSystem instances without being garbage collected, eventually leading to an out of memory error (#1857) * extract principal from username of ugi,and compare to krbPrincipal * [AMORO-1857] Fix If the kerberos account information filled in during catalog creation is abbreviated, it will cause the FileSystem to be unable to hit the cache, constantly create new FileSystem instances without being garbage collected, eventually leading to an out of memory error (#1857) * extract principal from username of ugi,and compare to krbPrincipal --------- Co-authored-by: 罗旭 Co-authored-by: baiyangtx --- .../src/main/java/com/netease/arctic/table/TableMetaStore.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/netease/arctic/table/TableMetaStore.java b/core/src/main/java/com/netease/arctic/table/TableMetaStore.java index ecc8bb5416..2eeb343177 100644 --- a/core/src/main/java/com/netease/arctic/table/TableMetaStore.java +++ b/core/src/main/java/com/netease/arctic/table/TableMetaStore.java @@ -236,7 +236,8 @@ public synchronized UserGroupInformation getUGI() { if (TableMetaStore.AUTH_METHOD_KERBEROS.equals(authMethod)) { // re-construct if (!ugi.getAuthenticationMethod().toString().equals(authMethod) || - !ugi.getUserName().equals(krbPrincipal)) { + (!ugi.getUserName().equals(krbPrincipal) && + !StringUtils.substringBefore(ugi.getUserName(),"@").equals(krbPrincipal))) { try { constructUgi(); LOG.info("Complete to re-build ugi {}", authInformation());