From 99b71ac0c76ea8141accdef4c4b6322d7a36fef6 Mon Sep 17 00:00:00 2001 From: mozhenghua Date: Thu, 21 Mar 2024 09:59:57 +0800 Subject: [PATCH] enhance logger info detail when create kubeClient --- deploy.sh | 1 + .../kubeclient/FlinkKubeClientFactory.java | 25 +++++++++------ .../librarycache/BlobLibraryCacheManager.java | 2 +- .../ClassLoaderFactoryBuilder.java | 4 +-- flink-table/flink-table-planner/pom.xml | 32 +++++++++---------- 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/deploy.sh b/deploy.sh index 0e16fc7a45b31..7d6e19668a554 100644 --- a/deploy.sh +++ b/deploy.sh @@ -10,6 +10,7 @@ mvn compile deploy -Pscala-${scala_version} -Dfast -DskipTests=true -Ptis-repo ,flink-table/flink-table-runtime\ ,flink-test-utils-parent/flink-test-utils\ ,flink-test-utils-parent/flink-connector-test-utils\ +,flink-formats/flink-avro-confluent-registry\ ,flink-core\ ,flink-streaming-java\ ,flink-table/flink-table-common\ diff --git a/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/FlinkKubeClientFactory.java b/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/FlinkKubeClientFactory.java index e8965143d6ec1..cb6f94c0ad2be 100644 --- a/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/FlinkKubeClientFactory.java +++ b/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/FlinkKubeClientFactory.java @@ -27,6 +27,7 @@ import io.fabric8.kubernetes.client.KubernetesClientBuilder; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.NamespacedKubernetesClient; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,6 +46,7 @@ public class FlinkKubeClientFactory { public static FlinkKubeClientFactory getInstance() { return INSTANCE; } + public static Config kubeConfig; /** @@ -52,9 +54,10 @@ public static FlinkKubeClientFactory getInstance() { * * @param flinkConfig Flink configuration * @param useCase Flink Kubernetes client use case (e.g. client, resourcemanager, - * kubernetes-ha-services) + * kubernetes-ha-services) + * * @return Return the Flink Kubernetes client with the specified configuration and dedicated IO - * executor. + * executor. */ public FlinkKubeClient fromConfiguration(Configuration flinkConfig, String useCase) { final Config config; @@ -66,11 +69,13 @@ public FlinkKubeClient fromConfiguration(Configuration flinkConfig, String useCa final String kubeConfigFile = flinkConfig.getString(KubernetesConfigOptions.KUBE_CONFIG_FILE); - // baisui 20211104 modify for config inject form context + LOG.info(KubernetesConfigOptions.KUBE_CONFIG_FILE.key() + " path: {}.", kubeConfigFile); + // baisui 20211104 modify for config inject form context if (kubeConfig != null) { + LOG.info( "Trying to load kubernetes config from kubeConfig static" ); config = kubeConfig; - }else if (kubeConfigFile != null) { - LOG.debug("Trying to load kubernetes config from file: {}.", kubeConfigFile); + } else if (kubeConfigFile != null) { + LOG.info("Trying to load kubernetes config from file: {}.", kubeConfigFile); try { // If kubeContext is null, the default context in the kubeConfigFile will be used. // Note: the third parameter kubeconfigPath is optional and is set to null. It is @@ -87,9 +92,11 @@ public FlinkKubeClient fromConfiguration(Configuration flinkConfig, String useCa throw new KubernetesClientException("Load kubernetes config failed.", e); } } else { - LOG.debug("Trying to load default kubernetes config."); - - config = Config.autoConfigure(kubeContext); + throw new UnsupportedOperationException( + "Trying to load default kubernetes config is not support ."); +// LOG.debug("Trying to load default kubernetes config."); +// +// config = Config.autoConfigure(kubeContext); } final String namespace = flinkConfig.getString(KubernetesConfigOptions.NAMESPACE); @@ -97,7 +104,7 @@ public FlinkKubeClient fromConfiguration(Configuration flinkConfig, String useCa flinkConfig.getString(KubernetesConfigOptions.KUBERNETES_CLIENT_USER_AGENT); config.setNamespace(namespace); config.setUserAgent(userAgent); - LOG.debug("Setting Kubernetes client namespace: {}, userAgent: {}", namespace, userAgent); + LOG.info("Setting Kubernetes client namespace: {}, userAgent: {}", namespace, userAgent); final NamespacedKubernetesClient client = new KubernetesClientBuilder() diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/BlobLibraryCacheManager.java b/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/BlobLibraryCacheManager.java index 892ab2d2a3c10..5a32fb90b3f9c 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/BlobLibraryCacheManager.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/BlobLibraryCacheManager.java @@ -145,7 +145,7 @@ public interface ClassLoaderFactory { } // baisui modfiy - public static final class DefaultClassLoaderFactory implements ClassLoaderFactory { + public static class DefaultClassLoaderFactory implements ClassLoaderFactory { /** The resolve order to use when creating a {@link ClassLoader}. */ protected final FlinkUserCodeClassLoaders.ResolveOrder classLoaderResolveOrder; diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/ClassLoaderFactoryBuilder.java b/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/ClassLoaderFactoryBuilder.java index 1364b7f957dd5..e2f0c78f14cc1 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/ClassLoaderFactoryBuilder.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/ClassLoaderFactoryBuilder.java @@ -37,7 +37,7 @@ public default ClassLoaderFactory buildServerLoaderFactory( String[] alwaysParentFirstPatterns, @Nullable Consumer exceptionHander, boolean checkClassLoaderLeak){ - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(this.getClass().getName()); } public default ClassLoaderFactory buildClientLoaderFactory( @@ -45,6 +45,6 @@ public default ClassLoaderFactory buildClientLoaderFactory( String[] alwaysParentFirstPatterns, @Nullable Consumer exceptionHander, boolean checkClassLoaderLeak){ - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(this.getClass().getName()); } } diff --git a/flink-table/flink-table-planner/pom.xml b/flink-table/flink-table-planner/pom.xml index b7804d84f7082..5d28eef251807 100644 --- a/flink-table/flink-table-planner/pom.xml +++ b/flink-table/flink-table-planner/pom.xml @@ -321,10 +321,10 @@ under the License. org.apache.calcite org.apache.flink.calcite.shaded.org.apache.calcite --> - - org.codehaus - org.apache.flink.calcite.shaded.org.codehaus - + + + + @@ -364,18 +364,18 @@ under the License. org.apache.flink.table.shaded.com.ibm.icu - - - - org.codehaus.commons.compiler.properties - ordinal - - already_merged - 0 - false - - + + + + + + + + + + + +