You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by wl...@apache.org on 2017/02/24 08:11:27 UTC

incubator-hawq git commit: HAWQ-1350. Add --enable-rps option to build ranger-plugin when build hawq.

Repository: incubator-hawq
Updated Branches:
  refs/heads/master 51590b991 -> 6bc9fd7aa


HAWQ-1350. Add --enable-rps option to build ranger-plugin when build hawq.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/6bc9fd7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/6bc9fd7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/6bc9fd7a

Branch: refs/heads/master
Commit: 6bc9fd7aa837d1254d43efbe42cfbde6f1456659
Parents: 51590b9
Author: stanlyxiang <st...@gmail.com>
Authored: Thu Feb 23 16:08:30 2017 +0800
Committer: Wen Lin <wl...@pivotal.io>
Committed: Fri Feb 24 16:10:29 2017 +0800

----------------------------------------------------------------------
 GNUmakefile.in                   |   5 +
 aclocal.m4                       |   1 +
 config/tomcat.m4                 |  57 +++++++++++
 configure                        | 177 +++++++++++++++++++++++++++++++++-
 configure.in                     |  15 ++-
 ranger-plugin/.gitignore         |   2 +
 ranger-plugin/Makefile           |  59 ++++++++++++
 ranger-plugin/Makefile.global.in |  28 ++++++
 src/include/pg_config.h.in       |   3 +
 9 files changed, 345 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/GNUmakefile.in
----------------------------------------------------------------------
diff --git a/GNUmakefile.in b/GNUmakefile.in
index 6a7ca9b..081e6fe 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -17,6 +17,7 @@ all:
 	$(MAKE) -C config $@
 	$(MAKE) -C contrib $@
 	$(MAKE) -C tools $@
+	$(MAKE) -C ranger-plugin $@
 	@echo "All of HAWQ successfully made. Ready to install."
 
 install:
@@ -28,6 +29,7 @@ install:
 	$(MAKE) -C config $@
 	$(MAKE) -C contrib $@
 	$(MAKE) -C tools $@
+	$(MAKE) -C ranger-plugin $@
 	@echo "HAWQ installation complete."
 
 installdirs uninstall:
@@ -35,6 +37,7 @@ installdirs uninstall:
 	$(MAKE) -C src $@
 	$(MAKE) -C config $@
 	$(MAKE) -C contrib $@
+	$(MAKE) -C ranger-plugin $@
 
 distprep:
 #	$(MAKE) -C doc $@
@@ -60,6 +63,7 @@ clean:
 	$(MAKE) -C config $@
 	$(MAKE) -C contrib $@
 	$(MAKE) -C tools $@
+	$(MAKE) -C ranger-plugin $@
 	-$(MAKE) -C src feature-test-clean
 # Garbage from autoconf:
 	@rm -rf autom4te.cache/
@@ -76,6 +80,7 @@ distclean maintainer-clean:
 	-$(MAKE) -C tools $@
 	-$(MAKE) -C src feature-test-clean
 	-$(MAKE) -C src $@
+	-$(MAKE) -C ranger-plugin $@
 	-rm -f config.cache config.log config.status GNUmakefile
 # Garbage from autoconf:
 	@rm -rf autom4te.cache/

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/aclocal.m4
----------------------------------------------------------------------
diff --git a/aclocal.m4 b/aclocal.m4
index 80dfe03..08f4519 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -14,3 +14,4 @@ m4_include([config/java.m4])
 m4_include([config/tcl.m4])
 m4_include([config/curl.m4])
 m4_include([config/maven.m4])
+m4_include([config/tomcat.m4])

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/config/tomcat.m4
----------------------------------------------------------------------
diff --git a/config/tomcat.m4 b/config/tomcat.m4
new file mode 100644
index 0000000..9e122a3
--- /dev/null
+++ b/config/tomcat.m4
@@ -0,0 +1,57 @@
+dnl
+dnl tomcat.m4: Locates the Apache Tomcat/6.0.x and its scripts and jars. 
+dnl
+
+# PGAC_CATALINA_HOME
+# ------------------
+AC_DEFUN([PGAC_CATALINA_HOME],
+[
+  AC_MSG_CHECKING([CATALINA_HOME])
+
+  dnl Use $CATALINA_HOME if specifed, otherwise look for java in the likely places.
+  dnl /usr/local/Cellar/tomcat@6/6.0.45/libexec 
+  dnl /usr/lib/bigtop-tomcat
+  if test -x "${CATALINA_HOME}/bin/catalina.sh"; then
+    TOMCAT="${CATALINA_HOME}"
+  elif test -x "/usr/lib/bigtop-tomcat/bin/catalina.sh"; then
+    TOMCAT="/usr/lib/bigtop-tomcat/"
+  else
+    AC_MSG_RESULT(not found)
+    AC_MSG_ERROR([CATALINA_HOME not found])
+  fi
+  CATALINA_HOME="$TOMCAT"
+  
+  AC_MSG_RESULT(${CATALINA_HOME})
+  AC_SUBST(CATALINA_HOME)
+])
+
+# PGAC_PATH_TOMCAT
+# ----------------
+AC_DEFUN([PGAC_PATH_TOMCAT],
+[
+  CATALINA=none
+  SETCLASSPATH=none
+  
+  AC_REQUIRE([PGAC_CATALINA_HOME])
+  AC_PATH_PROGS(CATALINA,catalina.sh,,${CATALINA_HOME}/bin)
+  AC_PATH_PROGS(SETCLASSPATH,setclasspath.sh,,${CATALINA_HOME}/bin)
+])
+
+# PGAC_CHECK_TOMCAT_EMBED_SETUP
+# ----------------------------
+AC_DEFUN([PGAC_CHECK_TOMCAT_EMBED_SETUP],
+[
+  AC_REQUIRE([PGAC_PATH_TOMCAT])
+
+  # Check the current tomcat version
+  AC_MSG_CHECKING([for tomcat version])
+  version=`${CATALINA} version 2>&1 | grep "Server version" | cut -d '/' -f2`
+  AC_MSG_RESULT("$version")
+
+  if echo "$version" | sed ['s/[^0-9]/ /g'] | $AWK '{ if ([$]1 != 6) exit 0; else exit 1;}'
+  then
+    AC_MSG_ERROR([The installed version of tomcat is not compatiable to use with ranger-plugin.
+                  Apache Tomcat/6.0.x is required, but this is $version])
+  fi
+
+])

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/configure
----------------------------------------------------------------------
diff --git a/configure b/configure
index 69d68a6..b5dca4f 100755
--- a/configure
+++ b/configure
@@ -667,6 +667,9 @@ CURL_CFLAGS
 CURL_CONFIG
 R_HOME
 ZIC
+SETCLASSPATH
+CATALINA
+CATALINA_HOME
 JAVAC_FLAGS
 JAVADOC
 JAR
@@ -734,6 +737,7 @@ with_python
 with_perl
 with_tcl
 enable_thread_safety
+enable_rps
 enable_orca
 enable_email
 enable_gphdfs
@@ -846,6 +850,7 @@ enable_snmp
 enable_gphdfs
 enable_email
 enable_orca
+enable_rps
 enable_thread_safety
 enable_thread_safety_force
 with_tcl
@@ -1523,6 +1528,7 @@ disable 64-bit integer date/time support
   --enable-gphdfs        enables GPHDFS support
   --enable-email        enable email alerts
   --enable-orca        enable Pivotal Query Optimizer
+  --enable-rps         enable hawq ranger plugin
   --disable-thread-safety  Do not make client libraries thread-safe
   --enable-thread-safety-force  force thread-safety despite thread test failure
   --disable-xmltest       Do not try to compile and run a test LIBXML program
@@ -5501,6 +5507,37 @@ fi
 
 
 #
+# Enable hawq ranger plugin
+#
+
+pgac_args="$pgac_args enable_rps"
+
+# Check whether --enable-rps was given.
+if test "${enable_rps+set}" = set; then :
+  enableval=$enable_rps;
+  case $enableval in
+    yes)
+
+$as_echo "#define USE_RANGER 1" >>confdefs.h
+
+      ;;
+    no)
+      :
+      ;;
+    *)
+      as_fn_error $? "no argument expected for --enable-rps option" "$LINENO" 5
+      ;;
+  esac
+
+else
+  enable_rps=no
+
+fi
+
+
+
+
+#
 # Enable thread-safe client libraries
 #
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking allow thread-safe client libraries" >&5
@@ -8169,6 +8206,143 @@ $as_echo "yes" >&6; }
 
 fi
 
+if test "$enable_rps" = yes; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking CATALINA_HOME" >&5
+$as_echo_n "checking CATALINA_HOME... " >&6; }
+
+        if test -x "${CATALINA_HOME}/bin/catalina.sh"; then
+    TOMCAT="${CATALINA_HOME}"
+  elif test -x "/usr/local/Cellar/tomcat@6/6.0.45/libexec/bin/catalina.sh"; then
+    TOMCAT="/usr/local/Cellar/tomcat@6/6.0.45/libexec/"
+  elif test -x "/usr/lib/bigtop-tomcat/bin/catalina.sh"; then
+    TOMCAT="/usr/lib/bigtop-tomcat/"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+    as_fn_error $? "CATALINA_HOME not found" "$LINENO" 5
+  fi
+  CATALINA_HOME="$TOMCAT"
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CATALINA_HOME}" >&5
+$as_echo "${CATALINA_HOME}" >&6; }
+
+
+
+  CATALINA=none
+  SETCLASSPATH=none
+
+
+  for ac_prog in catalina.sh
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_CATALINA+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CATALINA in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CATALINA="$CATALINA" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${CATALINA_HOME}/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_CATALINA="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+CATALINA=$ac_cv_path_CATALINA
+if test -n "$CATALINA"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CATALINA" >&5
+$as_echo "$CATALINA" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$CATALINA" && break
+done
+
+  for ac_prog in setclasspath.sh
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SETCLASSPATH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $SETCLASSPATH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SETCLASSPATH="$SETCLASSPATH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${CATALINA_HOME}/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SETCLASSPATH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+SETCLASSPATH=$ac_cv_path_SETCLASSPATH
+if test -n "$SETCLASSPATH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETCLASSPATH" >&5
+$as_echo "$SETCLASSPATH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$SETCLASSPATH" && break
+done
+
+
+
+
+
+  # Check the current tomcat version
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tomcat version" >&5
+$as_echo_n "checking for tomcat version... " >&6; }
+  version=`${CATALINA} version 2>&1 | grep "Server version" | cut -d '/' -f2`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$version\"" >&5
+$as_echo "\"$version\"" >&6; }
+
+  if echo "$version" | sed 's/[^0-9]/ /g' | $AWK '{ if ($1 != 6) exit 0; else exit 1;}'
+  then
+    as_fn_error $? "The installed version of tomcat is not compatiable to use with ranger-plugin.
+                  Apache Tomcat/6.0.x is required, but this is $version" "$LINENO" 5
+  fi
+
+
+fi
+
 ZIC=
 if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
   # Extract the first word of "zic", so it can be a program name with args.
@@ -16544,7 +16718,7 @@ $as_echo "done" >&6; }
 fi
 
 
-ac_config_files="$ac_config_files GNUmakefile src/VERSIONS.mk depends/thirdparty/googletest/Makefile.global depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global"
+ac_config_files="$ac_config_files GNUmakefile src/VERSIONS.mk depends/thirdparty/googletest/Makefile.global depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global ranger-plugin/Makefile.global"
 
 
 ac_config_links="$ac_config_links src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION} src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION} src/include/dynloader.h:src/backend/port/dynloader/${template}.h src/include/pg_config_os.h:src/include/port/${template}.h src/Makefile.port:src/makefiles/Makefile.${template}"
@@ -17277,6 +17451,7 @@ do
     "depends/libyarn/Makefile.global") CONFIG_FILES="$CONFIG_FILES depends/libyarn/Makefile.global" ;;
     "src/Makefile.global") CONFIG_FILES="$CONFIG_FILES src/Makefile.global" ;;
     "src/pl/pljava/src/java/Makefile.global") CONFIG_FILES="$CONFIG_FILES src/pl/pljava/src/java/Makefile.global" ;;
+    "ranger-plugin/Makefile.global") CONFIG_FILES="$CONFIG_FILES ranger-plugin/Makefile.global" ;;
     "src/backend/port/dynloader.c") CONFIG_LINKS="$CONFIG_LINKS src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c" ;;
     "src/backend/port/pg_sema.c") CONFIG_LINKS="$CONFIG_LINKS src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION}" ;;
     "src/backend/port/pg_shmem.c") CONFIG_LINKS="$CONFIG_LINKS src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION}" ;;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/configure.in
----------------------------------------------------------------------
diff --git a/configure.in b/configure.in
index 4f091e1..2f35e16 100644
--- a/configure.in
+++ b/configure.in
@@ -644,6 +644,14 @@ PGAC_ARG_BOOL(enable, orca, no, [  --enable-orca        enable Pivotal Query Opt
 AC_SUBST(enable_orca)
 
 #
+# Enable hawq ranger plugin
+#
+PGAC_ARG_BOOL(enable, rps, no, [  --enable-rps         enable hawq ranger plugin],
+              [AC_DEFINE([USE_RANGER], 1,
+                         [Define to 1 to build with hawq ranger plugin. (--enable-rps)])])
+AC_SUBST(enable_rps)
+
+#
 # Enable thread-safe client libraries
 #
 AC_MSG_CHECKING([allow thread-safe client libraries])
@@ -988,6 +996,11 @@ if test "$with_java" = yes; then
   PGAC_CHECK_JAVA_EMBED_SETUP
 fi
 
+if test "$enable_rps" = yes; then
+  PGAC_PATH_TOMCAT
+  PGAC_CHECK_TOMCAT_EMBED_SETUP
+fi
+
 ZIC=
 if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
   AC_PATH_PROG(ZIC, zic)
@@ -2140,7 +2153,7 @@ else
 fi
 AC_SUBST(vpath_build)
 
-AC_CONFIG_FILES([GNUmakefile src/VERSIONS.mk depends/thirdparty/googletest/Makefile.global depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global])
+AC_CONFIG_FILES([GNUmakefile src/VERSIONS.mk depends/thirdparty/googletest/Makefile.global depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global ranger-plugin/Makefile.global])
 
 AC_CONFIG_LINKS([
   src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/ranger-plugin/.gitignore
----------------------------------------------------------------------
diff --git a/ranger-plugin/.gitignore b/ranger-plugin/.gitignore
new file mode 100644
index 0000000..9f5b5c2
--- /dev/null
+++ b/ranger-plugin/.gitignore
@@ -0,0 +1,2 @@
+target/
+Makefile.global

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/ranger-plugin/Makefile
----------------------------------------------------------------------
diff --git a/ranger-plugin/Makefile b/ranger-plugin/Makefile
new file mode 100644
index 0000000..4bac4fe
--- /dev/null
+++ b/ranger-plugin/Makefile
@@ -0,0 +1,59 @@
+# 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
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+# HAWQ ranger-plugin makefile
+subdir = ranger-plugin
+top_builddir = ../
+include Makefile.global
+
+MVN_OPTS="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B -e"
+##########################################################################
+#
+.PHONY: all install distclean clean uninstall
+
+ifeq ($(enable_rps), yes)
+
+all:
+ifdef MAVEN
+	$(MAVEN) $(MVN_OPTS) clean package install
+else
+	@$(missing) mvn $< $(MVN_OPTS) clean package install
+endif
+
+install:
+	@echo "Install ranger-plugin by copy ranger-plugin to HAWQ install dir."
+	@echo "install `find $(top_builddir)$(subdir)/target -name ranger` into ${prefix}/ranger"
+	cp -r `find $(top_builddir)$(subdir)/target -name ranger` ${prefix}/
+	chmod -R 750 $(prefix)/ranger/bin
+
+uninstall:
+	rm -rf $(prefix)/ranger
+
+clean:
+ifdef MAVEN
+	$(MAVEN) $(MVN_OPTS) clean
+else
+	@$(missing) mvn $< $@
+endif
+
+distclean: clean
+
+else
+
+all install distclean clean uninstall:
+
+endif

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/ranger-plugin/Makefile.global.in
----------------------------------------------------------------------
diff --git a/ranger-plugin/Makefile.global.in b/ranger-plugin/Makefile.global.in
new file mode 100644
index 0000000..35d290f
--- /dev/null
+++ b/ranger-plugin/Makefile.global.in
@@ -0,0 +1,28 @@
+# 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
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+# -*-makefile-*-
+#------------------------------------------------------------------------------
+# A makefile that integrate building this module with hawq
+#------------------------------------------------------------------------------
+
+prefix := @prefix@
+enable_rps = @enable_rps@
+
+abs_top_srcdir = @abs_top_srcdir@
+abs_top_builddir = @abs_top_builddir@
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6bc9fd7a/src/include/pg_config.h.in
----------------------------------------------------------------------
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index d5c47d9..10cb221 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -822,6 +822,9 @@
 /* Define to 1 to build with PAM support. (--with-pam) */
 #undef USE_PAM
 
+/* Define to 1 to build with hawq ranger plugin. (--enable-rps) */
+#undef USE_RANGER
+
 /* Use replacement snprintf() functions. */
 #undef USE_REPL_SNPRINTF