You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2015/10/14 03:14:49 UTC

[06/11] incubator-trafodion git commit: TRAFODION-1521 Rework from review comments for PR 118

TRAFODION-1521 Rework from review comments for PR 118


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/16fc88e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/16fc88e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/16fc88e7

Branch: refs/heads/master
Commit: 16fc88e7e7eaf4c0f03530f61e563603ba4c7cc3
Parents: 77eab6b
Author: Hans Zeller <ha...@esgyn.com>
Authored: Tue Oct 13 17:13:53 2015 +0000
Committer: Hans Zeller <ha...@esgyn.com>
Committed: Tue Oct 13 17:13:53 2015 +0000

----------------------------------------------------------------------
 core/bldenvchk.sh                               |   1 +
 core/sqf/sql/scripts/get_libhdfs_files          | 132 ++++++++++++-------
 .../java/org/trafodion/dtm/TmAuditTlog.java     |  12 +-
 3 files changed, 91 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/16fc88e7/core/bldenvchk.sh
----------------------------------------------------------------------
diff --git a/core/bldenvchk.sh b/core/bldenvchk.sh
index 6c1bfd8..cb444f4 100755
--- a/core/bldenvchk.sh
+++ b/core/bldenvchk.sh
@@ -58,6 +58,7 @@ done
 # These directories should exist.
 VARDIRLIST="JAVA_HOME PERL5LIB MPI_TMPDIR"
 VARDIRLIST="$VARDIRLIST LLVM UDIS86 ICU MPICH_ROOT ZOOKEEPER_DIR PROTOBUFS"
+VARDIRLIST="$VARDIRLIST THRIFT_LIB_DIR THRIFT_INC_DIR"
 # QT_TOOLKIT is optional; if it is not set correctly then the SQL Compiler Debugger should
 # not build.
 if [ ! -d "${QT_TOOLKIT}" ]; then

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/16fc88e7/core/sqf/sql/scripts/get_libhdfs_files
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/get_libhdfs_files b/core/sqf/sql/scripts/get_libhdfs_files
index 3417c09..abe92d2 100755
--- a/core/sqf/sql/scripts/get_libhdfs_files
+++ b/core/sqf/sql/scripts/get_libhdfs_files
@@ -1,4 +1,24 @@
 #!/bin/sh
+# @@@ START COPYRIGHT @@@
+#
+# 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.
+#
+# @@@ END COPYRIGHT @@@
 
 # This script downloads and/or makes the required libhdfs files
 # to be able to build Trafodion, which acts as a libhdfs client.
@@ -24,7 +44,8 @@ HADOOP_SRC_TAR=${HADOOP_SRC_ID}.tar.gz
 
 # files to build required version of Google Protocol Buffers
 PROTOBUF_MIRROR_URL=https://github.com/google/protobuf/releases/download/v2.5.0
-PROTOBUF_ID=protobuf-2.5.0
+PROTOBUF_VERSION=2.5.0
+PROTOBUF_ID=protobuf-${PROTOBUF_VERSION}
 PROTOBUF_TAR=${PROTOBUF_ID}.tar.gz
 
 # result of protobuf build
@@ -37,9 +58,12 @@ TGT_LIB_DIR=$MY_SQROOT/export/lib${SQ_MBTYPE}
 FORCE_BUILD=false
 VERBOSE=false
 
-USAGE="Usage $0 [ -f | --force ]\
-                [ -v | --verbose ]\
-                [ -d <temp dir> | --tempDir <temp dir> ]"
+usage() {
+  echo "Usage: $0"
+  echo "    [ -f | --force ]"
+  echo "    [ -v | --verbose ]"
+  echo "    [ -d <temp dir> | --tempDir <temp dir> ]"
+}
 
 while [[ $# > 0 ]]
 do
@@ -61,11 +85,12 @@ do
          exit 1
        fi
        LIBHDFS_TEMP_DIR="$1"
+       LOGFILE=${LIBHDFS_TEMP_DIR}/build.log
        ;;
 
     *)
        echo "Unknown command line option: $arg"
-       echo "Usage $0 [ -f | --force ]"
+       usage
        exit 1
     ;;
   esac
@@ -78,62 +103,73 @@ if [[ $FORCE_BUILD == true || \
       ! -e ${TGT_INC_DIR}/hdfs.h || \
       ! -e ${TGT_LIB_DIR}/libhdfs.so ]]; then
 
-  if [ ! -d $LIBHDFS_TEMP_DIR ]; then
+  if [[ ! -d $LIBHDFS_TEMP_DIR ]]; then
     mkdir $LIBHDFS_TEMP_DIR
+    if [[ $? != 0 ]]; then
+      echo "Unable to create temp dir $LIBHDFS_TEMP_DIR"
+      exit 1
+    fi
   fi
 
   cd $LIBHDFS_TEMP_DIR
 
-  if [[ ! -f ${PROTOBUF_TAR} ]]; then
-    echo "Downloading Google Protocol Buffers..." | tee -a ${LOGFILE}
-    wget ${PROTOBUF_MIRROR_URL}/${PROTOBUF_TAR} >${LOGFILE}
-  fi
-
-  if [[ $FORCE_BUILD == true ]]; then
-    rm -rf ${LIBHDFS_TEMP_DIR}/${PROTOBUF_ID}
-    rm -rf ${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID}
-  fi
-
-  if [[ ! -d ${PROTOBUF_ID} ]]; then
-    echo "Unpacking Google Protocol Buffer tar file..." | tee -a ${LOGFILE}
-    rm -rf ${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID}
-    tar -xzf ${PROTOBUF_TAR} >>${LOGFILE}
-  fi
+  PROTOBUF_VER=`protoc --version 2>/dev/null | cut -f 2 -d ' '`
 
-  if [[ ! -d $PROTOBUF_TGT_ID ]]; then
-    cd ${PROTOBUF_ID}
-    echo "Building Google Protocol Buffers, this could take a while..." | tee -a ${LOGFILE}
-    if [[ $VERBOSE == true ]]; then
-      ./configure --prefix=${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID} 2>&1 | tee -a ${LOGFILE}
-    else
-      ./configure --prefix=${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID} 2>&1 >>${LOGFILE}
+  # download and build protoc v2.5.0 if not already in the path
+  if [[ "$PROTOBUF_VER" != "${PROTOBUF_VERSION}" ]]; then
+    if [[ ! -f ${PROTOBUF_TAR} ]]; then
+      echo "Downloading Google Protocol Buffers..." | tee -a ${LOGFILE}
+      wget ${PROTOBUF_MIRROR_URL}/${PROTOBUF_TAR} >${LOGFILE}
     fi
-    if [[ $? != 0 ]]; then
-      echo "Error during configure step, exiting" | tee -a ${LOGFILE}
-      exit 1
-    fi
-    make 2>&1 >>${LOGFILE}
-    if [[ $? != 0 ]]; then
-      echo "Error during make step, exiting" | tee -a ${LOGFILE}
-      exit 1
-    fi
-    # skip the tests
-    # make check 2>&1 >>${LOGFILE}
-    if [[ $? != 0 ]]; then
-      echo "Error during check step, exiting" | tee -a ${LOGFILE}
-      exit 1
+
+    if [[ $FORCE_BUILD == true ]]; then
+      rm -rf ${LIBHDFS_TEMP_DIR}/${PROTOBUF_ID}
+      rm -rf ${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID}
     fi
-    make install 2>&1 >>${LOGFILE}
-    if [[ $? != 0 ]]; then
-      echo "Error during install step, exiting" | tee -a ${LOGFILE}
-      # remove partial results, if any
+
+    if [[ ! -d ${PROTOBUF_ID} ]]; then
+      echo "Unpacking Google Protocol Buffer tar file..." | tee -a ${LOGFILE}
       rm -rf ${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID}
-      exit 1
+      tar -xzf ${PROTOBUF_TAR} >>${LOGFILE}
     fi
+
+    if [[ ! -d $PROTOBUF_TGT_ID ]]; then
+      cd ${PROTOBUF_ID}
+      echo "Building Google Protocol Buffers, this could take a while..." | tee -a ${LOGFILE}
+      if [[ $VERBOSE == true ]]; then
+        ./configure --prefix=${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID} 2>&1 | tee -a ${LOGFILE}
+      else
+        ./configure --prefix=${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID} 2>&1 >>${LOGFILE}
+      fi
+      if [[ $? != 0 ]]; then
+        echo "Error during configure step, exiting" | tee -a ${LOGFILE}
+        exit 1
+      fi
+      make 2>&1 >>${LOGFILE}
+      if [[ $? != 0 ]]; then
+        echo "Error during make step, exiting" | tee -a ${LOGFILE}
+        exit 1
+      fi
+      # skip the tests
+      # make check 2>&1 >>${LOGFILE}
+      # if [[ $? != 0 ]]; then
+      #   echo "Error during check step, exiting" | tee -a ${LOGFILE}
+      #   exit 1
+      # fi
+      make install 2>&1 >>${LOGFILE}
+      if [[ $? != 0 ]]; then
+        echo "Error during install step, exiting" | tee -a ${LOGFILE}
+        # remove partial results, if any
+        rm -rf ${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID}
+        exit 1
+      fi
+    fi
+
+    # Tell the Hadoop build to use our custom-built protoc
+    export HADOOP_PROTOC_PATH=${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID}/bin/protoc
   fi
 
   cd $LIBHDFS_TEMP_DIR
-  export HADOOP_PROTOC_PATH=${LIBHDFS_TEMP_DIR}/${PROTOBUF_TGT_ID}/bin/protoc
 
   if [[ ! -f ${HADOOP_SRC_TAR} ]]; then
     echo "Downloading Hadoop tar file ${HADOOP_SRC_TAR}..." | tee -a ${LOGFILE}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/16fc88e7/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/TmAuditTlog.java
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/TmAuditTlog.java b/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/TmAuditTlog.java
index fea7826..cb3ba94 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/TmAuditTlog.java
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/src/main/java/org/trafodion/dtm/TmAuditTlog.java
@@ -318,27 +318,27 @@ public class TmAuditTlog {
 
       switch (tlogNumLogs) {
         case 1:
-            tLogHashKey = 0; // 0b0;
+          tLogHashKey = 0; // 0b0;
           tLogHashShiftFactor = 63;
           break;
         case 2:
-            tLogHashKey = 1; // 0b1;
+          tLogHashKey = 1; // 0b1;
           tLogHashShiftFactor = 63;
           break;
         case 4:
-            tLogHashKey = 3; // 0b11;
+          tLogHashKey = 3; // 0b11;
           tLogHashShiftFactor = 62;
           break;
         case 8:
-            tLogHashKey = 7; // 0b111;
+          tLogHashKey = 7; // 0b111;
           tLogHashShiftFactor = 61;
           break;
         case 16:
-            tLogHashKey = 15; // 0b1111;
+          tLogHashKey = 15; // 0b1111;
           tLogHashShiftFactor = 60;
           break;
         case 32:
-            tLogHashKey = 31; // 0b11111;
+          tLogHashKey = 31; // 0b11111;
           tLogHashShiftFactor = 59;
           break;
         default : {