Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#3249] improvement(kafka-catalog): clarify error message and shorten timeout #3421

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfigDemo
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = debug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-catalog-hadoop/build/integration-test.log}
Expand Down
2 changes: 1 addition & 1 deletion catalogs/catalog-hive/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-catalog-hive/build/hive-integration-test.log}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-catalog-jdbc-doris/build/doris-integration-test.log}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-catalog-jdbc-mysql/build/mysql-integration-test.log}
Expand All @@ -23,7 +23,7 @@ appender.file.type = File
appender.file.name = fileLogger
appender.file.fileName = ${logPath}
appender.file.layout.type = PatternLayout
appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-catalog-jdbc-postgresql/build/postgresql-integration-test.log}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,13 @@ public NameIdentifier[] listTopics(Namespace namespace) throws NoSuchSchemaExcep
return topicNames.stream()
.map(name -> NameIdentifier.of(namespace, name))
.toArray(NameIdentifier[]::new);
} catch (InterruptedException | ExecutionException e) {
} catch (ExecutionException e) {
throw new RuntimeException(
String.format(
"Failed to list topics under the schema %s: %s",
namespace, e.getCause().getMessage()),
e);
} catch (InterruptedException e) {
throw new RuntimeException("Failed to list topics under the schema " + namespace, e);
}
}
Expand Down
4 changes: 3 additions & 1 deletion catalogs/catalog-kafka/src/main/resources/kafka.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
# This software is licensed under the Apache License version 2.
#

# bootstrap.servers = localhost:9092
# bootstrap.servers = localhost:9092
gravitino.bypass.request.timeout.ms = 15000
gravitino.bypass.default.api.timeout.ms = 15000
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static com.datastrato.gravitino.catalog.kafka.KafkaCatalogPropertiesMetadata.BOOTSTRAP_SERVERS;
import static com.datastrato.gravitino.catalog.kafka.KafkaTopicPropertiesMetadata.PARTITION_COUNT;
import static com.datastrato.gravitino.catalog.kafka.KafkaTopicPropertiesMetadata.REPLICATION_FACTOR;
import static com.datastrato.gravitino.connector.BaseCatalog.CATALOG_BYPASS_PREFIX;
import static com.datastrato.gravitino.integration.test.container.KafkaContainer.DEFAULT_BROKER_PORT;

import com.datastrato.gravitino.Catalog;
Expand All @@ -31,6 +32,7 @@
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.Config;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.admin.TopicDescription;
Expand Down Expand Up @@ -119,7 +121,8 @@ public void testCatalog() throws ExecutionException, InterruptedException {
Catalog createdCatalog = createCatalog(catalogName, comment, properties);
Assertions.assertEquals(catalogName, createdCatalog.name());
Assertions.assertEquals(comment, createdCatalog.comment());
Assertions.assertEquals(properties, createdCatalog.properties());
Assertions.assertEquals(
kafkaBootstrapServers, createdCatalog.properties().get(BOOTSTRAP_SERVERS));

// test load catalog
Catalog loadedCatalog = metalake.loadCatalog(NameIdentifier.of(METALAKE_NAME, catalogName));
Expand Down Expand Up @@ -173,6 +176,34 @@ public void testCatalogException() {
ImmutableMap.of("abc", "2")));
Assertions.assertTrue(
exception.getMessage().contains("Missing configuration: bootstrap.servers"));

// Test BOOTSTRAP_SERVERS that cannot be linked
Catalog kafka =
metalake.createCatalog(
NameIdentifier.of(METALAKE_NAME, catalogName),
Catalog.Type.MESSAGING,
PROVIDER,
"comment",
ImmutableMap.of(
BOOTSTRAP_SERVERS,
"192.0.2.1:9999",
CATALOG_BYPASS_PREFIX + AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG,
"3000",
CATALOG_BYPASS_PREFIX + AdminClientConfig.DEFAULT_API_TIMEOUT_MS_CONFIG,
"3000"));
exception =
Assertions.assertThrows(
RuntimeException.class,
() ->
kafka
.asTopicCatalog()
.listTopics(
Namespace.ofTopic(METALAKE_NAME, catalogName, DEFAULT_SCHEMA_NAME)));
Assertions.assertTrue(
exception
.getMessage()
.contains("Timed out waiting for a node assignment. Call: listTopics"),
exception.getMessage());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-catalog-messaging-kafka/build/kafka-integration-test.log}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-catalog-lakehouse-iceberg/build/iceberg-integration-test.log}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfigDemo
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = debug
Expand Down
2 changes: 1 addition & 1 deletion clients/client-java/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfigDemo
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = debug
Expand Down
2 changes: 1 addition & 1 deletion common/src/test/java/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfigDemo
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = debug
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfigDemo
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = debug
Expand Down
4 changes: 2 additions & 2 deletions dev/docker/trino/conf/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# File appender configuration
appender.file.type = File
appender.file.name = fileLogger
appender.file.fileName = gravitino-trino-connector.log
appender.file.layout.type = PatternLayout
appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = info
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-integration-test/build/integration-test.log}
Expand Down
2 changes: 1 addition & 1 deletion server/src/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfigDemo
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = debug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = ConsoleLogConfig
appender.console.type = Console
appender.console.name = consoleLogger
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Log files location
property.logPath = ${sys:gravitino.log.path:-integration-test/build/integration-test.log}
Expand All @@ -23,7 +23,7 @@ appender.file.type = File
appender.file.name = fileLogger
appender.file.fileName = ${logPath}
appender.file.layout.type = PatternLayout
appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n

# Root logger level
rootLogger.level = info
Expand Down
Loading