kgyrtkirk commented on a change in pull request #1347:
URL: https://github.com/apache/hive/pull/1347#discussion_r525173227



##########
File path: 
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/dbinstall/rules/PostgresTPCDS.java
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.metastore.dbinstall.rules;
+
+/**
+ * JUnit TestRule for Postgres metastore with TPCDS schema and stat 
information.
+ */
+public class PostgresTPCDS extends Postgres {
+  @Override
+  public String getDockerImageName() {
+    return "zabetak/postgres-tpcds-metastore:1.1";
+  }
+
+  @Override
+  public String getJdbcUrl() {
+    return "jdbc:postgresql://localhost:5432/metastore";
+  }
+
+  @Override
+  public String getHiveUser() {
+    return "hive";
+  }
+
+  @Override
+  public String getHivePassword() {
+    return "hive";
+  }
+
+  @Override
+  public void install() {
+    // Do not do anything since the postgres container contains a fully 
initialized

Review comment:
       I'm not sure about this..this will work for sure for now (and for a few 
day/weeks/months)
   
   ...but suppose we have a metastore schema change - the docker image will 
retain the old schema.
   for "master" we don't do incremental updates...so people doing MS changes 
will also need to rebuild tpcds image as well and upload a new image to 
dockerhub + change the imagename in this test?
   
   this might be cumbersome...but right now I'm still in favor of this patch if 
the above could "work"

##########
File path: 
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/dbinstall/rules/Postgres.java
##########
@@ -63,7 +67,15 @@ public String getInitialJdbcUrl() {
 
   @Override
   public boolean isContainerReady(String logOutput) {
-    return logOutput.contains("database system is ready to accept 
connections");
+    if (logOutput.contains("PostgreSQL init process complete; ready for start 
up")) {
+      try (Socket socket = new Socket()) {
+        socket.connect(new InetSocketAddress("localhost", 5432), 1000);

Review comment:
       does this mean that host system may not run a local psql server in case 
it wants to run this test?

##########
File path: 
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/dbinstall/rules/Postgres.java
##########
@@ -63,7 +67,15 @@ public String getInitialJdbcUrl() {
 
   @Override
   public boolean isContainerReady(String logOutput) {
-    return logOutput.contains("database system is ready to accept 
connections");
+    if (logOutput.contains("PostgreSQL init process complete; ready for start 
up")) {
+      try (Socket socket = new Socket()) {
+        socket.connect(new InetSocketAddress("localhost", 5432), 1000);

Review comment:
       I see now that this was "like this" before :)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to