This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new c65f1044f67 [opt](log) avoid print too much log when get partitions 
failed #41892 (#42116)
c65f1044f67 is described below

commit c65f1044f6729ed2bb1428d8d3310f06415395af
Author: Rayner Chen <morning...@163.com>
AuthorDate: Sat Oct 19 00:28:49 2024 +0800

    [opt](log) avoid print too much log when get partitions failed #41892 
(#42116)
    
    cherry pick from #41892
---
 .../datasource/hive/ThriftHMSCachedClient.java     | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/ThriftHMSCachedClient.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/ThriftHMSCachedClient.java
index 7632101d7ff..56b69dc71e2 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/ThriftHMSCachedClient.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/ThriftHMSCachedClient.java
@@ -325,8 +325,15 @@ public class ThriftHMSCachedClient implements 
HMSCachedClient {
                 throw e;
             }
         } catch (Exception e) {
-            throw new HMSClientException("failed to get partition for table %s 
in db %s with value %s", e, tblName,
-                    dbName, partitionValues);
+            // Avoid printing too much log
+            String partitionValuesMsg;
+            if (partitionValues.size() <= 3) {
+                partitionValuesMsg = partitionValues.toString();
+            } else {
+                partitionValuesMsg = partitionValues.subList(0, 3) + "... 
total: " + partitionValues.size();
+            }
+            throw new HMSClientException("failed to get partition for table %s 
in db %s with value [%s]", e, tblName,
+                    dbName, partitionValuesMsg);
         }
     }
 
@@ -340,8 +347,15 @@ public class ThriftHMSCachedClient implements 
HMSCachedClient {
                 throw e;
             }
         } catch (Exception e) {
-            throw new HMSClientException("failed to get partition for table %s 
in db %s with value %s", e, tblName,
-                    dbName, partitionNames);
+            // Avoid printing too much log
+            String partitionNamesMsg;
+            if (partitionNames.size() <= 3) {
+                partitionNamesMsg = partitionNames.toString();
+            } else {
+                partitionNamesMsg = partitionNames.subList(0, 3) + "... total: 
" + partitionNames.size();
+            }
+            throw new HMSClientException("failed to get partitions for table 
%s in db %s with value [%s]", e, tblName,
+                    dbName, partitionNamesMsg);
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to