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

[#411] test: support E2E tests for IcebergREST server #416

Closed
wants to merge 3 commits into from

Conversation

Clearvive
Copy link
Contributor

What changes were proposed in this pull request?

support E2E tests for IcebergREST server

@github-actions
Copy link

github-actions bot commented Sep 19, 2023

Code Coverage Report

Overall Project 62.25% -0.6% 🟢
Files changed 22.43% 🔴

Module Coverage
catalog-lakehouse 79.48% -13.45% 🔴
core 71.48% -0.06% 🟢
Files
Module File Coverage
catalog-lakehouse IcebergRESTConfig.java 100% 🟢
IcebergTableOps.java 80.34% -10.67% 🔴
IcebergCatalogUtil.java 53.33% -42.67% 🔴
IcebergAuxiliaryService.java 0% 🔴
core Config.java 38.13% -2.33% 🟢


public class IcebergRESTConfig extends Config {
public static final ConfigEntry<Integer> ICEBERG_REST_SERVER_HTTP_PORT =
new ConfigBuilder("serverPort")
Copy link
Member

@xunliu xunliu Sep 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the key ICEBERG_REST_SERVER_HTTP_PORT of the IcebergRESTConfig does not match the key of the Graviton, e.g. graviton.server.webserver.host, graviton.server.webserver.httpPort, etc?

And because ICEBERG_REST_SERVER_HTTP_PORT("serverPort") does not begin graviton.****** prefix, And let you need to change
public void Config::loadFromMap(Map<String, String> map) {
to
public void Config::loadFromMap(Map<String, String> map, boolean checkPrefix) {
??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ICEBERG_REST_SERVER_HTTP_PORT actually is 'graviton.auxService.GravitonIcebergREST.httpPort' in graviton.conf, the prefix is removed by AuxiliaryServiceManager

  private void registerAuxServices(Map<String, String> config) {
    String auxServiceNames = config.getOrDefault(AUX_SERVICE_NAMES, "");
    splitter
        .omitEmptyStrings()
        .trimResults()
        .splitToStream(auxServiceNames)
        .forEach(
            auxServiceName ->
                registerAuxService(
                    auxServiceName, MapUtils.getPrefixMap(config, DOT.join(auxServiceName, ""))));
  }

Comment on lines +55 to +58
implementation(libs.hadoop2.client) {
exclude("org.apache.avro", "avro")
exclude("org.slf4j", "slf4j-log4j12")
}
Copy link
Member

@xunliu xunliu Sep 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @yunqing-wei, libs.hadoop2.client have many dependencies, I guess maybe org.apache.hadoop:hadoop-mapreduce-client-app:2.7.3, org.apache.hadoop:hadoop-mapreduce-client-core:2.7.3 (*), org.apache.hadoop:hadoop-mapreduce-client-jobclient:2.7.3, org.apache.hadoop:hadoop-yarn-api:2.7.3 (*) we didn't use it.
@sandflee Please check it. whether some JAR need to be excluded?

cd catalog-lakehouse
../gradlew dependencies

......

\--- org.apache.hadoop:hadoop-client:2.7.3
     +--- org.apache.hadoop:hadoop-common:2.7.3 (*)
     +--- org.apache.hadoop:hadoop-hdfs:2.7.3
     |    +--- com.google.guava:guava:11.0.2 -> 29.0-jre (*)
     |    +--- org.mortbay.jetty:jetty-util:6.1.26
     |    +--- commons-cli:commons-cli:1.2
     |    +--- commons-codec:commons-codec:1.4 -> 1.9
     |    +--- commons-io:commons-io:2.4
     |    +--- commons-lang:commons-lang:2.6
     |    +--- commons-logging:commons-logging:1.1.3 -> 1.2
     |    +--- log4j:log4j:1.2.17
     |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    +--- org.codehaus.jackson:jackson-core-asl:1.9.13
     |    +--- org.codehaus.jackson:jackson-mapper-asl:1.9.13 (*)
     |    +--- xmlenc:xmlenc:0.52
     |    +--- io.netty:netty:3.6.2.Final -> 3.7.0.Final
     |    +--- io.netty:netty-all:4.0.23.Final
     |    +--- xerces:xercesImpl:2.9.1
     |    |    \--- xml-apis:xml-apis:1.3.04
     |    +--- org.apache.htrace:htrace-core:3.1.0-incubating
     |    \--- org.fusesource.leveldbjni:leveldbjni-all:1.8
     +--- org.apache.hadoop:hadoop-mapreduce-client-app:2.7.3
     |    +--- org.apache.hadoop:hadoop-mapreduce-client-common:2.7.3
     |    |    +--- org.apache.hadoop:hadoop-yarn-common:2.7.3
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-api:2.7.3
     |    |    |    |    +--- commons-lang:commons-lang:2.6
     |    |    |    |    +--- com.google.guava:guava:11.0.2 -> 29.0-jre (*)
     |    |    |    |    +--- commons-logging:commons-logging:1.1.3 -> 1.2
     |    |    |    |    \--- com.google.protobuf:protobuf-java:2.5.0
     |    |    |    +--- javax.xml.bind:jaxb-api:2.2.2 (*)
     |    |    |    +--- org.apache.commons:commons-compress:1.4.1 -> 1.9
     |    |    |    +--- commons-lang:commons-lang:2.6
     |    |    |    +--- javax.servlet:servlet-api:2.5
     |    |    |    +--- commons-codec:commons-codec:1.4 -> 1.9
     |    |    |    +--- org.mortbay.jetty:jetty-util:6.1.26
     |    |    |    +--- com.sun.jersey:jersey-core:1.9
     |    |    |    +--- com.sun.jersey:jersey-client:1.9
     |    |    |    |    \--- com.sun.jersey:jersey-core:1.9
     |    |    |    +--- org.codehaus.jackson:jackson-core-asl:1.9.13
     |    |    |    +--- org.codehaus.jackson:jackson-mapper-asl:1.9.13 (*)
     |    |    |    +--- org.codehaus.jackson:jackson-jaxrs:1.9.13 (*)
     |    |    |    +--- org.codehaus.jackson:jackson-xc:1.9.13 (*)
     |    |    |    +--- com.google.guava:guava:11.0.2 -> 29.0-jre (*)
     |    |    |    +--- commons-logging:commons-logging:1.1.3 -> 1.2
     |    |    |    +--- commons-cli:commons-cli:1.2
     |    |    |    +--- org.slf4j:slf4j-api:1.7.10 -> 2.0.7
     |    |    |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    |    |    +--- commons-io:commons-io:2.4
     |    |    |    +--- com.google.inject:guice:3.0
     |    |    |    |    +--- javax.inject:javax.inject:1
     |    |    |    |    +--- aopalliance:aopalliance:1.0
     |    |    |    |    \--- org.sonatype.sisu.inject:cglib:2.2.1-v20090111
     |    |    |    |         \--- asm:asm:3.1
     |    |    |    +--- com.sun.jersey:jersey-server:1.9 (*)
     |    |    |    +--- com.sun.jersey:jersey-json:1.9 (*)
     |    |    |    +--- com.sun.jersey.contribs:jersey-guice:1.9
     |    |    |    |    +--- javax.inject:javax.inject:1
     |    |    |    |    +--- com.google.inject:guice:3.0 (*)
     |    |    |    |    \--- com.sun.jersey:jersey-server:1.9 (*)
     |    |    |    \--- log4j:log4j:1.2.17
     |    |    +--- org.apache.hadoop:hadoop-yarn-client:2.7.3
     |    |    |    +--- com.google.guava:guava:11.0.2 -> 29.0-jre (*)
     |    |    |    +--- commons-logging:commons-logging:1.1.3 -> 1.2
     |    |    |    +--- commons-lang:commons-lang:2.6
     |    |    |    +--- commons-cli:commons-cli:1.2
     |    |    |    +--- log4j:log4j:1.2.17
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-api:2.7.3 (*)
     |    |    |    \--- org.apache.hadoop:hadoop-yarn-common:2.7.3 (*)
     |    |    +--- org.apache.hadoop:hadoop-mapreduce-client-core:2.7.3
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-common:2.7.3 (*)
     |    |    |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    |    |    \--- org.slf4j:slf4j-api:1.7.10 -> 2.0.7
     |    |    +--- org.apache.hadoop:hadoop-yarn-server-common:2.7.3
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-api:2.7.3 (*)
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-common:2.7.3 (*)
     |    |    |    +--- com.google.guava:guava:11.0.2 -> 29.0-jre (*)
     |    |    |    +--- commons-logging:commons-logging:1.1.3 -> 1.2
     |    |    |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    |    |    +--- org.apache.zookeeper:zookeeper:3.4.6 (*)
     |    |    |    \--- org.fusesource.leveldbjni:leveldbjni-all:1.8
     |    |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    |    \--- org.slf4j:slf4j-api:1.7.10 -> 2.0.7
     |    +--- org.apache.hadoop:hadoop-mapreduce-client-shuffle:2.7.3
     |    |    +--- org.apache.hadoop:hadoop-yarn-server-common:2.7.3 (*)
     |    |    +--- org.apache.hadoop:hadoop-yarn-server-nodemanager:2.7.3
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-common:2.7.3 (*)
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-api:2.7.3 (*)
     |    |    |    +--- javax.xml.bind:jaxb-api:2.2.2 (*)
     |    |    |    +--- org.codehaus.jettison:jettison:1.1
     |    |    |    +--- commons-lang:commons-lang:2.6
     |    |    |    +--- javax.servlet:servlet-api:2.5
     |    |    |    +--- commons-codec:commons-codec:1.4 -> 1.9
     |    |    |    +--- com.sun.jersey:jersey-core:1.9
     |    |    |    +--- com.sun.jersey:jersey-client:1.9 (*)
     |    |    |    +--- org.mortbay.jetty:jetty-util:6.1.26
     |    |    |    +--- com.google.guava:guava:11.0.2 -> 29.0-jre (*)
     |    |    |    +--- commons-logging:commons-logging:1.1.3 -> 1.2
     |    |    |    +--- org.slf4j:slf4j-api:1.7.10 -> 2.0.7
     |    |    |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    |    |    +--- com.google.inject:guice:3.0 (*)
     |    |    |    +--- com.sun.jersey:jersey-json:1.9 (*)
     |    |    |    +--- com.sun.jersey.contribs:jersey-guice:1.9 (*)
     |    |    |    +--- org.apache.hadoop:hadoop-yarn-server-common:2.7.3 (*)
     |    |    |    \--- org.fusesource.leveldbjni:leveldbjni-all:1.8
     |    |    +--- org.apache.hadoop:hadoop-mapreduce-client-common:2.7.3 (*)
     |    |    +--- org.fusesource.leveldbjni:leveldbjni-all:1.8
     |    |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    |    \--- org.slf4j:slf4j-api:1.7.10 -> 2.0.7
     |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    \--- org.slf4j:slf4j-api:1.7.10 -> 2.0.7
     +--- org.apache.hadoop:hadoop-yarn-api:2.7.3 (*)
     +--- org.apache.hadoop:hadoop-mapreduce-client-core:2.7.3 (*)
     +--- org.apache.hadoop:hadoop-mapreduce-client-jobclient:2.7.3
     |    +--- org.apache.hadoop:hadoop-mapreduce-client-common:2.7.3 (*)
     |    +--- org.apache.hadoop:hadoop-mapreduce-client-shuffle:2.7.3 (*)
     |    +--- com.google.protobuf:protobuf-java:2.5.0
     |    \--- org.slf4j:slf4j-api:1.7.10 -> 2.0.7
     \--- org.apache.hadoop:hadoop-annotations:2.7.3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems only hadoop-hdfs, hadoop-common are needed.

Comment on lines +157 to +180
configMap.put(
AuxiliaryServiceManager.GRAVITON_AUX_SERVICE_PREFIX
+ AuxiliaryServiceManager.AUX_SERVICE_NAMES,
IcebergAuxiliaryService.SERVICE_NAME);

String icebergClassPath = Paths.get("catalog-lakehouse", "build", "libs").toString();
configMap.put(
AuxiliaryServiceManager.GRAVITON_AUX_SERVICE_PREFIX
+ IcebergAuxiliaryService.SERVICE_NAME
+ "."
+ AuxiliaryServiceManager.AUX_SERVICE_CLASSPATH,
icebergClassPath);
configMap.put(
AuxiliaryServiceManager.GRAVITON_AUX_SERVICE_PREFIX
+ IcebergAuxiliaryService.SERVICE_NAME
+ "."
+ IcebergRESTConfig.ICEBERG_REST_SERVER_HTTP_PORT.getKey(),
String.valueOf(RESTUtils.findAvailablePort(3000, 4000)));
configMap.put(
AuxiliaryServiceManager.GRAVITON_AUX_SERVICE_PREFIX
+ IcebergAuxiliaryService.SERVICE_NAME
+ "."
+ IcebergRESTConfig.CATALOG_IMPL.getKey(),
"hive");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These codes are only used for catalog-Iceberg, I think, we may need to move these codes to CatalogIcebergIT.

I think we can add a customizeCatalogConfig() interface in the customizeConfigFile() function. different catalog through customizeCatalogConfig() set different config.

Copy link
Contributor

@FANNG1 FANNG1 Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, but startIntegrationTest is static which means all tests share one MiniGraviton, could we start sevral MiniGravtion servers concurrently? the logic is implemented in #427, let's move there

@FANNG1
Copy link
Contributor

FANNG1 commented Sep 24, 2023

this pr contains the #427 , and is not ready to review, maybe we could change the status to Draft, and change the title to something like Support Iceberg HiveCatalog&JDBCCatalog

*/
private void loadFromMap(Map<String, String> map) {
public void loadFromMap(Map<String, String> map, boolean checkPrefix) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest you replace the checkPrefix with Predicate to make the function more generic
like

Suggested change
public void loadFromMap(Map<String, String> map, boolean checkPrefix) {
public void loadFromMap(Map<String, String> map, Predicate<String> condition) ;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I remember @sandflee has already added a method with the same function, you can contact him to confirm.


public class IcebergAuxiliaryService implements GravitonAuxiliaryService {

Logger LOG = LoggerFactory.getLogger(IcebergAuxiliaryService.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private static final?

public static final ConfigEntry<String> CATALOG_IMPL =
new ConfigBuilder("catalogImpl")
.doc("Choose the implementation of the iceberg catalog")
.version("0.1.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.1.0 --> 0.2.0 and this also applied in line 16.

// todo, use JettyServer when it's moved to graviton common package
int port = restConfig.get(IcebergRESTConfig.ICEBERG_REST_SERVER_HTTP_PORT);
LOG.info("Iceberg REST service http port:{}", port);
Server server = new Server(port);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd better change the name of server here, because it will hide the field server in class IcebergAuxiliaryService

IcebergRESTConfig icebergConfig = new IcebergRESTConfig();
icebergConfig.loadFromMap(properties, false);
server = initServer(icebergConfig);
LOG.info("Iceberg REST service inited");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not advised to use short-name inited

.doc("Choose the implementation of the iceberg catalog")
.version("0.1.0")
.stringConf()
.createWithDefault("memory");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose the implementation of the iceberg catalog

As the default value is memory, you mean all iceberg catalog data will be stored in memory, I not very clear about the value of memory.

@FANNG1
Copy link
Contributor

FANNG1 commented Sep 26, 2023

@yunqing-wei , could we close this pr ? since this's mainly for test and some person still reviews it.

@Clearvive Clearvive self-assigned this Oct 9, 2023
@Clearvive Clearvive added this to the Graviton v0.2.0 milestone Oct 9, 2023
@Clearvive Clearvive closed this Oct 12, 2023
@Clearvive Clearvive deleted the rest branch October 27, 2023 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants