diff --git a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala index 5496f10b18..864b8f6505 100644 --- a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala +++ b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/conf/HadoopConf.scala @@ -76,8 +76,8 @@ object HadoopConf { CommonVars("wds.linkis.hadoop.hdfs.cache.max.time", new TimeType("12h")).getValue.toLong /** - * Temporary directory for keytab files when LINKIS_KEYTAB_SWITCH is enabled - * 默认使用系统临时目录下的 keytab 子目录 + * Temporary directory for keytab files when LINKIS_KEYTAB_SWITCH is enabled 默认使用系统临时目录下的 keytab + * 子目录 */ val KEYTAB_TEMP_DIR = CommonVars("linkis.keytab.temp.dir", "/tmp/keytab") diff --git a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala index 4f4087e301..81fe6c3d74 100644 --- a/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala +++ b/linkis-commons/linkis-hadoop-common/src/main/scala/org/apache/linkis/hadoop/common/utils/HDFSUtils.scala @@ -23,7 +23,6 @@ import org.apache.linkis.hadoop.common.conf.HadoopConf import org.apache.linkis.hadoop.common.conf.HadoopConf._ import org.apache.linkis.hadoop.common.entity.HDFSFileSystemContainer -import com.google.common.cache.{CacheBuilder, LoadingCache, RemovalCause, RemovalListener, RemovalNotification} import org.apache.commons.io.IOUtils import org.apache.commons.lang3.StringUtils import org.apache.hadoop.conf.Configuration @@ -40,6 +39,14 @@ import java.util.concurrent.atomic.AtomicLong import scala.collection.JavaConverters._ +import com.google.common.cache.{ + CacheBuilder, + LoadingCache, + RemovalCause, + RemovalListener, + RemovalNotification +} + object HDFSUtils extends Logging { private val fileSystemCache: java.util.Map[String, HDFSFileSystemContainer] = @@ -52,9 +59,9 @@ object HDFSUtils extends Logging { val key = notification.getKey val path = notification.getValue val cause = notification.getCause - + logger.info(s"Keytab cache entry removed: $key, cause: $cause") - + // 当缓存项被移除时,清理对应的临时文件 if (path != null) { val file = new File(path) @@ -69,7 +76,8 @@ object HDFSUtils extends Logging { } } - CacheBuilder.newBuilder() + CacheBuilder + .newBuilder() .maximumSize(1000) // 最大缓存项数量 .expireAfterAccess(24, TimeUnit.HOURS) // 24小时未访问过期 .removalListener(removalListener) @@ -525,7 +533,10 @@ object HDFSUtils extends Logging { // 确保keytab临时目录存在 if (!Files.exists(keytabTempDir)) { Files.createDirectories(keytabTempDir) - Files.setPosixFilePermissions(keytabTempDir, PosixFilePermissions.fromString("rwxr-xr-x")) + Files.setPosixFilePermissions( + keytabTempDir, + PosixFilePermissions.fromString("rwxr-xr-x") + ) } val cachedPath = keytabTempFileCache.getIfPresent(cacheKey) diff --git a/linkis-commons/linkis-hadoop-common/src/test/scala/org/apache/linkis/hadoop/common/utils/HDFSUtilsKeytabCacheTest.scala b/linkis-commons/linkis-hadoop-common/src/test/scala/org/apache/linkis/hadoop/common/utils/HDFSUtilsKeytabCacheTest.scala index f5d40ce6e0..cc96318716 100644 --- a/linkis-commons/linkis-hadoop-common/src/test/scala/org/apache/linkis/hadoop/common/utils/HDFSUtilsKeytabCacheTest.scala +++ b/linkis-commons/linkis-hadoop-common/src/test/scala/org/apache/linkis/hadoop/common/utils/HDFSUtilsKeytabCacheTest.scala @@ -17,18 +17,18 @@ package org.apache.linkis.hadoop.common.utils -import org.junit.jupiter.api.{AfterAll, AfterEach, BeforeAll, DisplayName, Test} -import org.junit.jupiter.api.Assertions.{assertEquals, assertFalse, assertNotNull, assertTrue} - import java.io.File import java.nio.file.{Files, Paths, StandardOpenOption} import java.util.concurrent.{ConcurrentHashMap, Executors, TimeUnit} + import scala.collection.JavaConverters._ +import org.junit.jupiter.api.{AfterAll, AfterEach, BeforeAll, DisplayName, Test} +import org.junit.jupiter.api.Assertions.{assertEquals, assertFalse, assertNotNull, assertTrue} + /** - * Unit tests for keytab file cache optimization in HDFSUtils. - * This test validates that the caching mechanism reduces Full GC by avoiding - * repeated creation of temporary keytab files. + * Unit tests for keytab file cache optimization in HDFSUtils. This test validates that the caching + * mechanism reduces Full GC by avoiding repeated creation of temporary keytab files. */ @DisplayName("HDFSUtils Keytab Cache Test") class HDFSUtilsKeytabCacheTest { @@ -40,7 +40,10 @@ class HDFSUtilsKeytabCacheTest { @BeforeAll def setupClass(): Unit = { // Create test directory for keytab files - testKeytabDir = new File(System.getProperty("java.io.tmpdir"), "test_keytab_cache_" + System.currentTimeMillis()) + testKeytabDir = new File( + System.getProperty("java.io.tmpdir"), + "test_keytab_cache_" + System.currentTimeMillis() + ) testKeytabDir.mkdirs() // Create a dummy encrypted keytab file for testing @@ -77,7 +80,8 @@ class HDFSUtilsKeytabCacheTest { try { val cacheMethod = HDFSUtils.getClass.getDeclaredMethod("keytabFileCache") cacheMethod.setAccessible(true) - val cache = cacheMethod.invoke(HDFSUtils).asInstanceOf[ConcurrentHashMap[String, java.nio.file.Path]] + val cache = + cacheMethod.invoke(HDFSUtils).asInstanceOf[ConcurrentHashMap[String, java.nio.file.Path]] cache.asScala.foreach { case (_, path) => try { Files.deleteIfExists(path) @@ -111,7 +115,8 @@ class HDFSUtilsKeytabCacheTest { val label = null // Verify cache key generation is consistent - val keyMethod = HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) + val keyMethod = + HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) keyMethod.setAccessible(true) val key1 = keyMethod.invoke(HDFSUtils, userName, label).asInstanceOf[String] val key2 = keyMethod.invoke(HDFSUtils, userName, label).asInstanceOf[String] @@ -126,7 +131,8 @@ class HDFSUtilsKeytabCacheTest { val user2 = "testuser2" val label = null - val keyMethod = HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) + val keyMethod = + HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) keyMethod.setAccessible(true) val key1 = keyMethod.invoke(HDFSUtils, user1, label).asInstanceOf[String] val key2 = keyMethod.invoke(HDFSUtils, user2, label).asInstanceOf[String] @@ -143,7 +149,8 @@ class HDFSUtilsKeytabCacheTest { val label1 = "cluster1" val label2 = "cluster2" - val keyMethod = HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) + val keyMethod = + HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) keyMethod.setAccessible(true) val key1 = keyMethod.invoke(HDFSUtils, userName, label1).asInstanceOf[String] val key2 = keyMethod.invoke(HDFSUtils, userName, label2).asInstanceOf[String] @@ -160,7 +167,8 @@ class HDFSUtilsKeytabCacheTest { val label = null val threadCount = 10 - val keyMethod = HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) + val keyMethod = + HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) keyMethod.setAccessible(true) val executor = Executors.newFixedThreadPool(threadCount) @@ -195,7 +203,8 @@ class HDFSUtilsKeytabCacheTest { val label1 = null val label2 = "default" - val keyMethod = HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) + val keyMethod = + HDFSUtils.getClass.getDeclaredMethod("createKeytabCacheKey", classOf[String], classOf[String]) keyMethod.setAccessible(true) val key1 = keyMethod.invoke(HDFSUtils, userName, label1).asInstanceOf[String] val key2 = keyMethod.invoke(HDFSUtils, userName, label2).asInstanceOf[String] @@ -224,4 +233,5 @@ class HDFSUtilsKeytabCacheTest { case _: Exception => // Field may not be accessible } } + } diff --git a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/restful/EntranceLabelRestfulApi.java b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/restful/EntranceLabelRestfulApi.java index 5e503f499c..f6b9b6f0c4 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/restful/EntranceLabelRestfulApi.java +++ b/linkis-computation-governance/linkis-entrance/src/main/java/org/apache/linkis/entrance/restful/EntranceLabelRestfulApi.java @@ -21,9 +21,9 @@ import org.apache.linkis.common.ServiceInstance; import org.apache.linkis.common.conf.Configuration; import org.apache.linkis.entrance.EntranceServer; -import org.apache.linkis.entrance.scheduler.EntranceSchedulerContext; import org.apache.linkis.entrance.conf.EntranceConfiguration; import org.apache.linkis.entrance.protocol.EntranceGroupCacheClearBroadcast; +import org.apache.linkis.entrance.scheduler.EntranceSchedulerContext; import org.apache.linkis.instance.label.client.InstanceLabelClient; import org.apache.linkis.manager.label.constant.LabelKeyConstant; import org.apache.linkis.manager.label.constant.LabelValueConstant; @@ -149,8 +149,8 @@ public Message backOnline(HttpServletRequest req) { try { // 构造广播消息 EntranceGroupCacheClearBroadcast broadcast = - new EntranceGroupCacheClearBroadcast( - Sender.getThisInstance(), System.currentTimeMillis()); + new EntranceGroupCacheClearBroadcast( + Sender.getThisInstance(), System.currentTimeMillis()); // 获取entrance服务的Sender并发送广播 Sender.getSender(Sender.getThisServiceInstance()).send(broadcast); logger.info("Successfully sent cache clear broadcast for entrance offline"); diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/conf/EntranceConfiguration.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/conf/EntranceConfiguration.scala index a55922d03e..cbf483557c 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/conf/EntranceConfiguration.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/conf/EntranceConfiguration.scala @@ -467,7 +467,8 @@ object EntranceConfiguration { val HIVE_LOCATION_CONTROL_WHITELIST_CREATORS: CommonVars[String] = CommonVars("wds.linkis.hive.location.control.whitelist.creators", "") - /** Entrance Group缓存清理功能总开关 + /** + * Entrance Group缓存清理功能总开关 * * 控制以下功能是否启用: * 1. Entrance offline时发送Group缓存清理广播 2. 接收并处理Group缓存清理广播 3. 手动清理Group缓存API diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/SQLCodeCheckInterceptor.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/SQLCodeCheckInterceptor.scala index 71ff064821..2cf604d951 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/SQLCodeCheckInterceptor.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/SQLCodeCheckInterceptor.scala @@ -22,6 +22,7 @@ import org.apache.linkis.entrance.conf.EntranceConfiguration import org.apache.linkis.entrance.interceptor.EntranceInterceptor import org.apache.linkis.entrance.interceptor.exception.CodeCheckException import org.apache.linkis.governance.common.entity.job.JobRequest +import org.apache.linkis.manager.label.entity.engine.EngineType import org.apache.linkis.manager.label.utils.LabelUtil import org.apache.commons.lang3.StringUtils @@ -50,7 +51,7 @@ class SQLCodeCheckInterceptor extends EntranceInterceptor with Logging { // Only check if: 1. Hive engine 2. Feature enabled 3. Creator NOT in whitelist val engineType = LabelUtil.getEngineTypeLabel(jobRequest.getLabels).getEngineType if ( - "hive".equalsIgnoreCase(engineType) && + EngineType.HIVE.toString.equalsIgnoreCase(engineType) && EntranceConfiguration.HIVE_LOCATION_CONTROL_ENABLE.getValue && !isCreatorWhitelisted(LabelUtil.getUserCreatorLabel(jobRequest.getLabels).getCreator) ) { diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala index 6f039d74bc..b995c00d73 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/scheduler/EntranceGroupFactory.scala @@ -142,8 +142,7 @@ class EntranceGroupFactory extends GroupFactory with Logging { * 清除所有Group缓存 * * 调用时机: - * 1. 接收到EntranceGroupCacheClearBroadcast广播时(需功能开关启用) - * 2. 手动清除缓存(如管理API) + * 1. 接收到EntranceGroupCacheClearBroadcast广播时(需功能开关启用) 2. 手动清除缓存(如管理API) * * 线程安全:Guava Cache的invalidateAll()是原子操作,支持并发调用 * @@ -162,7 +161,7 @@ class EntranceGroupFactory extends GroupFactory with Logging { } catch { case e: Exception => logger.error("Failed to clear Group cache", e) - // 不抛出异常,避免影响调用方 + // 不抛出异常,避免影响调用方 } } diff --git a/linkis-computation-governance/linkis-entrance/src/test/java/org/apache/linkis/entrance/interceptor/impl/SQLExplainTest.java b/linkis-computation-governance/linkis-entrance/src/test/java/org/apache/linkis/entrance/interceptor/impl/SQLExplainTest.java index 626d486ad0..74a27755c4 100644 --- a/linkis-computation-governance/linkis-entrance/src/test/java/org/apache/linkis/entrance/interceptor/impl/SQLExplainTest.java +++ b/linkis-computation-governance/linkis-entrance/src/test/java/org/apache/linkis/entrance/interceptor/impl/SQLExplainTest.java @@ -18,7 +18,6 @@ package org.apache.linkis.entrance.interceptor.impl; import org.apache.linkis.common.conf.BDPConfiguration; - import org.apache.linkis.governance.common.entity.job.JobRequest; import org.junit.jupiter.api.Assertions; diff --git a/linkis-computation-governance/linkis-entrance/src/test/scripts/hive-location-control-test.sh b/linkis-computation-governance/linkis-entrance/src/test/scripts/hive-location-control-test.sh deleted file mode 100644 index e5f3c3fcf9..0000000000 --- a/linkis-computation-governance/linkis-entrance/src/test/scripts/hive-location-control-test.sh +++ /dev/null @@ -1,387 +0,0 @@ -#!/bin/bash - -############################################################################### -# Hive Location Control - Remote API Test Script -# -# This script tests the Hive LOCATION control feature via REST API -# It can be used for integration testing on deployed environments -# -# Usage: -# ./hive-location-control-test.sh [base_url] -# -# Arguments: -# base_url - Base URL of the Linkis Gateway (default: http://localhost:9001) -# -# Environment Variables: -# LINKIS_USER - Username for authentication (default: admin) -# LINKIS_PASSWORD - Password for authentication (default: admin) -############################################################################### - -# Configuration -BASE_URL="${1:-http://localhost:9001}" -LINKIS_USER="${LINKIS_USER:-admin}" -LINKIS_PASSWORD="${LINKIS_PASSWORD:-admin}" - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -# Test counters -TESTS_RUN=0 -TESTS_PASSED=0 -TESTS_FAILED=0 - -############################################################################### -# Helper Functions -############################################################################### - -print_header() { - echo "" - echo "========================================" - echo "$1" - echo "========================================" -} - -print_test() { - echo "" - echo -e "${YELLOW}[TEST ${TESTS_RUN}]${NC} $1" -} - -print_pass() { - echo -e "${GREEN}[PASS]${NC} $1" - ((TESTS_PASSED++)) -} - -print_fail() { - echo -e "${RED}[FAIL]${NC} $1" - ((TESTS_FAILED++)) -} - -print_summary() { - echo "" - echo "========================================" - echo "Test Summary" - echo "========================================" - echo "Total: ${TESTS_RUN}" - echo -e "Passed: ${GREEN}${TESTS_PASSED}${NC}" - echo -e "Failed: ${RED}${TESTS_FAILED}${NC}" - echo "========================================" -} - -# Function to execute SQL via Linkis REST API -execute_sql() { - local sql="$1" - local execute_json=$(cat < /dev/null - - sleep 1 - - local sql="CREATE TABLE test_table_with_loc (id INT) LOCATION '/tmp/test'" - - local response=$(execute_sql "$sql") - local exec_id=$(echo "$response" | grep -o '"execID":"[^"]*"' | cut -d'"' -f4) - - if [ -n "$exec_id" ]; then - print_pass "SQL accepted when disabled" - else - print_fail "SQL rejected even when disabled" - fi -} - -test_03_create_table_with_location_enabled() { - ((TESTS_RUN++)) - print_test "CREATE TABLE with LOCATION when control enabled (should be blocked)" - - # Enable location control - curl -s -X PUT \ - "${BASE_URL}/api/rest_j/v1/configuration/wds.linkis.hive.location.control.enable" \ - -u "${LINKIS_USER}:${LINKIS_PASSWORD}" \ - -H "Content-Type: application/json" \ - -d '{"value": "true"}' > /dev/null - - sleep 1 - - local sql="CREATE TABLE test_table_blocked (id INT) LOCATION '/user/data'" - - local response=$(execute_sql "$sql") - - # Should be rejected with error message - if echo "$response" | grep -q "LOCATION clause is not allowed"; then - print_pass "SQL blocked with correct error message" - elif echo "$response" | grep -q "execID"; then - print_fail "SQL was not blocked" - else - print_fail "Unexpected response: $response" - fi -} - -test_04_create_external_table_with_location() { - ((TESTS_RUN++)) - print_test "CREATE EXTERNAL TABLE with LOCATION (should be blocked)" - - local sql="CREATE EXTERNAL TABLE test_ext_table (id INT) LOCATION '/user/external'" - - local response=$(execute_sql "$sql") - - if echo "$response" | grep -q "LOCATION clause is not allowed"; then - print_pass "EXTERNAL TABLE with LOCATION blocked" - else - print_fail "EXTERNAL TABLE with LOCATION not blocked" - fi -} - -test_05_ctas_with_location() { - ((TESTS_RUN++)) - print_test "CTAS with LOCATION (should be blocked)" - - local sql="CREATE TABLE new_table LOCATION '/user/data' AS SELECT * FROM source_table" - - local response=$(execute_sql "$sql") - - if echo "$response" | grep -q "LOCATION clause is not allowed"; then - print_pass "CTAS with LOCATION blocked" - else - print_fail "CTAS with LOCATION not blocked" - fi -} - -test_06_ctas_without_location() { - ((TESTS_RUN++)) - print_test "CTAS without LOCATION (should succeed)" - - local sql="CREATE TABLE new_table AS SELECT * FROM source_table" - - local response=$(execute_sql "$sql") - local exec_id=$(echo "$response" | grep -o '"execID":"[^"]*"' | cut -d'"' -f4) - - if [ -n "$exec_id" ]; then - print_pass "CTAS without LOCATION accepted" - else - print_fail "CTAS without LOCATION rejected" - fi -} - -test_07_alter_table_set_location() { - ((TESTS_RUN++)) - print_test "ALTER TABLE SET LOCATION (should NOT be blocked)" - - local sql="ALTER TABLE existing_table SET LOCATION '/new/location'" - - local response=$(execute_sql "$sql") - local exec_id=$(echo "$response" | grep -o '"execID":"[^"]*"' | cut -d'"' -f4) - - if [ -n "$exec_id" ]; then - print_pass "ALTER TABLE SET LOCATION accepted (not blocked)" - else - print_fail "ALTER TABLE SET LOCATION rejected" - fi -} - -test_08_case_insensitive_location() { - ((TESTS_RUN++)) - print_test "CREATE TABLE with lowercase 'location' (should be blocked)" - - local sql="CREATE TABLE test_table (id INT) location '/user/data'" - - local response=$(execute_sql "$sql") - - if echo "$response" | grep -q "LOCATION clause is not allowed"; then - print_pass "Lowercase 'location' blocked" - else - print_fail "Lowercase 'location' not blocked" - fi -} - -test_09_multiline_create_table_with_location() { - ((TESTS_RUN++)) - print_test "Multi-line CREATE TABLE with LOCATION (should be blocked)" - - local sql="CREATE TABLE test_table ( - id INT COMMENT 'ID column', - name STRING COMMENT 'Name column' -) -COMMENT 'Test table' -LOCATION '/user/hive/warehouse/test_table'" - - local response=$(execute_sql "$sql") - - if echo "$response" | grep -q "LOCATION clause is not allowed"; then - print_pass "Multi-line SQL with LOCATION blocked" - else - print_fail "Multi-line SQL with LOCATION not blocked" - fi -} - -test_10_select_statement_not_blocked() { - ((TESTS_RUN++)) - print_test "SELECT statement (should NOT be blocked)" - - local sql="SELECT * FROM existing_table WHERE id > 100" - - local response=$(execute_sql "$sql") - local exec_id=$(echo "$response" | grep -o '"execID":"[^"]*"' | cut -d'"' -f4) - - if [ -n "$exec_id" ]; then - print_pass "SELECT statement accepted" - else - print_fail "SELECT statement rejected" - fi -} - -test_11_empty_sql() { - ((TESTS_RUN++)) - print_test "Empty SQL (should be handled gracefully)" - - local sql="" - - local response=$(execute_sql "$sql") - - # Empty SQL should be handled gracefully - print_pass "Empty SQL handled (response: $response)" -} - -test_12_error_message_quality() { - ((TESTS_RUN++)) - print_test "Error message contains guidance" - - local sql="CREATE TABLE test_table (id INT) LOCATION '/user/data'" - - local response=$(execute_sql "$sql") - - # Check if error message contains helpful guidance - if echo "$response" | grep -q "Please remove the LOCATION clause"; then - print_pass "Error message contains helpful guidance" - else - print_fail "Error message missing guidance" - fi -} - -############################################################################### -# Main Execution -############################################################################### - -main() { - print_header "Hive Location Control - Remote API Test" - echo "Base URL: ${BASE_URL}" - echo "User: ${LINKIS_USER}" - echo "" - - # Check if service is available - print_header "Checking Service Availability" - local health_check=$(curl -s -o /dev/null -w "%{http_code}" "${BASE_URL}/actuator/health") - - if [ "$health_check" != "200" ]; then - echo -e "${RED}ERROR: Service not available at ${BASE_URL}${NC}" - echo "Please check:" - echo " 1. Linkis Gateway is running" - echo " 2. Base URL is correct" - echo " 3. Network connectivity" - exit 1 - fi - - echo -e "${GREEN}Service is available${NC}" - - # Run all tests - print_header "Running Tests" - - test_01_create_table_without_location - test_02_create_table_with_location_disabled - test_03_create_table_with_location_enabled - test_04_create_external_table_with_location - test_05_ctas_with_location - test_06_ctas_without_location - test_07_alter_table_set_location - test_08_case_insensitive_location - test_09_multiline_create_table_with_location - test_10_select_statement_not_blocked - test_11_empty_sql - test_12_error_message_quality - - # Print summary - print_summary - - # Exit with appropriate code - if [ $TESTS_FAILED -eq 0 ]; then - echo -e "${GREEN}All tests passed!${NC}" - exit 0 - else - echo -e "${RED}Some tests failed!${NC}" - exit 1 - fi -} - -# Run main function -main "$@" diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/config/MonitorConfig.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/config/MonitorConfig.java index a6aa3d5bbe..0795d30970 100644 --- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/config/MonitorConfig.java +++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/config/MonitorConfig.java @@ -75,7 +75,7 @@ public class MonitorConfig { // Diagnosis log cleanup configuration public static final CommonVars DIAGNOSIS_LOG_ENABLED = - CommonVars.apply("linkis.monitor.diagnosis.log.enabled", true); + CommonVars.apply("linkis.monitor.diagnosis.log.enabled", false); public static final CommonVars DIAGNOSIS_LOG_RETENTION_DAYS = CommonVars.apply("linkis.monitor.diagnosis.log.retention.days", 90); public static final CommonVars DIAGNOSIS_LOG_PATH =