You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ri...@apache.org on 2017/03/13 20:57:42 UTC

[20/50] [abbrv] incubator-madlib git commit: Build: Use only major version for GPDB 5, HAWQ 2

Build: Use only major version for GPDB 5, HAWQ 2

GPDB, starting 5.0, and HAWQ, starting 2.0, are using semantic
versioning for releases. This implies a binary compatibility between
same major versions. Hence, we only need to compile a single MADlib
binary for the same major version, with the folder name being just the
major version instead of 'major.minor'.

Closes #79, closes #91

0e00a27 closes #76


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

Branch: refs/heads/latest_release
Commit: d65dca5450c68df00a2350648f12a72151676692
Parents: 0e00a27
Author: Rahul Iyer <ri...@apache.org>
Authored: Mon Jan 23 16:58:29 2017 -0800
Committer: Rahul Iyer <ri...@apache.org>
Committed: Wed Feb 1 13:15:31 2017 -0800

----------------------------------------------------------------------
 src/madpack/madpack.py                          | 44 +++++++++++++-------
 src/ports/greenplum/5.0/CMakeLists.txt          |  1 -
 src/ports/greenplum/5/CMakeLists.txt            |  1 +
 src/ports/greenplum/cmake/FindGreenplum_5.cmake |  2 +
 .../greenplum/cmake/FindGreenplum_5_0.cmake     |  2 -
 src/ports/hawq/2.0/CMakeLists.txt               | 20 ---------
 src/ports/hawq/2/CMakeLists.txt                 | 19 +++++++++
 src/ports/hawq/CMakeLists.txt                   |  2 +-
 src/ports/hawq/cmake/FindHAWQ_2.cmake           | 21 ++++++++++
 src/ports/hawq/cmake/FindHAWQ_2_0.cmake         | 21 ----------
 src/ports/postgres/cmake/PostgreSQLUtils.cmake  | 36 ++++++++++------
 11 files changed, 96 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/madpack/madpack.py
----------------------------------------------------------------------
diff --git a/src/madpack/madpack.py b/src/madpack/madpack.py
index e15bb4a..8b0e64d 100755
--- a/src/madpack/madpack.py
+++ b/src/madpack/madpack.py
@@ -317,13 +317,9 @@ def _get_dbver():
         if portid == 'postgres':
             match = re.search("PostgreSQL[a-zA-Z\s]*(\d+\.\d+)", versionStr)
         elif portid == 'greenplum':
-            match = re.search("Greenplum[a-zA-Z\s]*(\d+\.\d+)", versionStr)
-            # Due to the ABI incompatibility between 4.3.4 and 4.3.5,
-            # MADlib treat 4.3.5+ as DB version 4.3V2 that is different from 4.3
-            if match and match.group(1) == '4.3':
-                match_details = re.search("Greenplum[a-zA-Z\s]*(\d+\.\d+.\d+)", versionStr)
-                if _is_rev_gte(_get_rev_num(match_details.group(1)), _get_rev_num('4.3.5')):
-                    return '4.3ORCA'
+            # for Greenplum the 3rd digit is necessary to differentiate
+            # 4.3.5+ from versions < 4.3.5
+            match = re.search("Greenplum[a-zA-Z\s]*(\d+\.\d+\.\d+)", versionStr)
         elif portid == 'hawq':
             match = re.search("HAWQ[a-zA-Z\s]*(\d+\.\d+)", versionStr)
         return None if match is None else match.group(1)
@@ -1098,11 +1094,6 @@ def main(argv):
 
         # Get DB version
         dbver = _get_dbver()
-        portdir = os.path.join(maddir, "ports", portid)
-        if portid == "hawq" and _is_rev_gte(_get_rev_num(dbver), _get_rev_num('2.0')):
-            is_hawq2 = True
-        else:
-            is_hawq2 = False
 
         # Get MADlib version in DB
         dbrev = _get_madlib_dbrev(schema)
@@ -1111,12 +1102,14 @@ def main(argv):
         if portid == 'hawq' and not is_hawq2 and schema.lower() != 'madlib':
             _error("*** Installation is currently restricted only to 'madlib' schema ***", True)
 
+        portdir = os.path.join(maddir, "ports", portid)
         supportedVersions = [dirItem for dirItem in os.listdir(portdir)
                              if os.path.isdir(os.path.join(portdir, dirItem)) and
-                             re.match("^\d+\.\d+", dirItem)]
+                             re.match("^\d+", dirItem)]
         if dbver is None:
-            dbver = ".".join(map(str, max([map(int, versionStr.split('.'))
-                                           for versionStr in supportedVersions])))
+            dbver = ".".join(
+                map(str, max([versionStr.split('.')
+                              for versionStr in supportedVersions])))
             _info("Could not parse version string reported by {DBMS}. Will "
                   "default to newest supported version of {DBMS} "
                   "({version}).".format(DBMS=ports[portid]['name'],
@@ -1124,6 +1117,27 @@ def main(argv):
         else:
             _info("Detected %s version %s." % (ports[portid]['name'], dbver),
                   True)
+
+            if portid == "hawq":
+                # HAWQ (starting 2.0) and GPDB (starting 5.0) uses semantic versioning,
+                # which implies all HAWQ 2.x or GPDB 5.x versions will have binary
+                # compatibility. Hence, we can keep single folder for all 2.X / 5.X.
+                if (_is_rev_gte(_get_rev_num(dbver), _get_rev_num('2.0')) and
+                        not _is_rev_gte(_get_rev_num(dbver), _get_rev_num('3.0'))):
+                    is_hawq2 = True
+                    dbver = '2'
+            elif portid == 'greenplum':
+                # similar to HAWQ above, collapse all 5.X versions
+                if (_is_rev_gte(_get_rev_num(dbver), _get_rev_num('5.0')) and
+                        not _is_rev_gte(_get_rev_num(dbver), _get_rev_num('6.0'))):
+                    dbver = '5'
+                # Due to the ABI incompatibility between 4.3.4 and 4.3.5,
+                # MADlib treats 4.3.5+ as DB version 4.3ORCA which is different
+                # from 4.3. The name is suffixed with ORCA since optimizer (ORCA) is
+                # 'on' by default in 4.3.5
+                elif _is_rev_gte(_get_rev_num(dbver), _get_rev_num('4.3.4')):
+                    dbver = '4.3ORCA'
+
             if not os.path.isdir(os.path.join(portdir, dbver)):
                 _error("This version is not among the %s versions for which "
                        "MADlib support files have been installed (%s)." %

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/greenplum/5.0/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/ports/greenplum/5.0/CMakeLists.txt b/src/ports/greenplum/5.0/CMakeLists.txt
deleted file mode 100644
index 015d76e..0000000
--- a/src/ports/greenplum/5.0/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_current_greenplum_version()

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/greenplum/5/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/ports/greenplum/5/CMakeLists.txt b/src/ports/greenplum/5/CMakeLists.txt
new file mode 100644
index 0000000..015d76e
--- /dev/null
+++ b/src/ports/greenplum/5/CMakeLists.txt
@@ -0,0 +1 @@
+add_current_greenplum_version()

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/greenplum/cmake/FindGreenplum_5.cmake
----------------------------------------------------------------------
diff --git a/src/ports/greenplum/cmake/FindGreenplum_5.cmake b/src/ports/greenplum/cmake/FindGreenplum_5.cmake
new file mode 100644
index 0000000..fe15861
--- /dev/null
+++ b/src/ports/greenplum/cmake/FindGreenplum_5.cmake
@@ -0,0 +1,2 @@
+set(_FIND_PACKAGE_FILE "${CMAKE_CURRENT_LIST_FILE}")
+include("${CMAKE_CURRENT_LIST_DIR}/FindGreenplum.cmake")

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/greenplum/cmake/FindGreenplum_5_0.cmake
----------------------------------------------------------------------
diff --git a/src/ports/greenplum/cmake/FindGreenplum_5_0.cmake b/src/ports/greenplum/cmake/FindGreenplum_5_0.cmake
deleted file mode 100644
index fe15861..0000000
--- a/src/ports/greenplum/cmake/FindGreenplum_5_0.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-set(_FIND_PACKAGE_FILE "${CMAKE_CURRENT_LIST_FILE}")
-include("${CMAKE_CURRENT_LIST_DIR}/FindGreenplum.cmake")

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/hawq/2.0/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/ports/hawq/2.0/CMakeLists.txt b/src/ports/hawq/2.0/CMakeLists.txt
deleted file mode 100644
index 0a2eb24..0000000
--- a/src/ports/hawq/2.0/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# ------------------------------------------------------------------------------
-# 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.
-# ------------------------------------------------------------------------------
-
-add_current_hawq_version()

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/hawq/2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/ports/hawq/2/CMakeLists.txt b/src/ports/hawq/2/CMakeLists.txt
new file mode 100644
index 0000000..a024a53
--- /dev/null
+++ b/src/ports/hawq/2/CMakeLists.txt
@@ -0,0 +1,19 @@
+# ------------------------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------------------------
+add_current_hawq_version()

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/hawq/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/ports/hawq/CMakeLists.txt b/src/ports/hawq/CMakeLists.txt
index 8610238..2ba532d 100644
--- a/src/ports/hawq/CMakeLists.txt
+++ b/src/ports/hawq/CMakeLists.txt
@@ -85,7 +85,7 @@ add_sql_files(
     "../postgres/modules"
     "${CMAKE_CURRENT_BINARY_DIR}/modules"
 )
-# Add Greenplum-specific modules. Files will be appended to SQL_TARGET_FILES.
+# Add HAWQ-specific modules. Files will be appended to SQL_TARGET_FILES.
 add_sql_files(
     SQL_TARGET_FILES
     "modules"

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/hawq/cmake/FindHAWQ_2.cmake
----------------------------------------------------------------------
diff --git a/src/ports/hawq/cmake/FindHAWQ_2.cmake b/src/ports/hawq/cmake/FindHAWQ_2.cmake
new file mode 100644
index 0000000..0cdbf63
--- /dev/null
+++ b/src/ports/hawq/cmake/FindHAWQ_2.cmake
@@ -0,0 +1,21 @@
+# ------------------------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------------------------
+
+set(_FIND_PACKAGE_FILE "${CMAKE_CURRENT_LIST_FILE}")
+include("${CMAKE_CURRENT_LIST_DIR}/FindHAWQ.cmake")

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/hawq/cmake/FindHAWQ_2_0.cmake
----------------------------------------------------------------------
diff --git a/src/ports/hawq/cmake/FindHAWQ_2_0.cmake b/src/ports/hawq/cmake/FindHAWQ_2_0.cmake
deleted file mode 100644
index 0cdbf63..0000000
--- a/src/ports/hawq/cmake/FindHAWQ_2_0.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-# ------------------------------------------------------------------------------
-# 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.
-# ------------------------------------------------------------------------------
-
-set(_FIND_PACKAGE_FILE "${CMAKE_CURRENT_LIST_FILE}")
-include("${CMAKE_CURRENT_LIST_DIR}/FindHAWQ.cmake")

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/d65dca54/src/ports/postgres/cmake/PostgreSQLUtils.cmake
----------------------------------------------------------------------
diff --git a/src/ports/postgres/cmake/PostgreSQLUtils.cmake b/src/ports/postgres/cmake/PostgreSQLUtils.cmake
index e5e4228..7acdf9a 100644
--- a/src/ports/postgres/cmake/PostgreSQLUtils.cmake
+++ b/src/ports/postgres/cmake/PostgreSQLUtils.cmake
@@ -4,7 +4,7 @@ function(define_postgresql_features IN_VERSION OUT_FEATURES)
     if(NOT ${IN_VERSION} VERSION_LESS "9.0")
         list(APPEND ${OUT_FEATURES} __HAS_ORDERED_AGGREGATES__)
     endif()
-    
+
     # Pass values to caller
     set(${OUT_FEATURES} "${${OUT_FEATURES}}" PARENT_SCOPE)
 endfunction(define_postgresql_features)
@@ -54,7 +54,7 @@ endfunction(cpack_add_version_component)
 #
 function(determine_target_versions OUT_VERSIONS)
     get_subdirectories("${CMAKE_CURRENT_SOURCE_DIR}" SUPPORTED_VERSIONS)
-    get_filtered_list(SUPPORTED_VERSIONS "^[0-9]+.[0-9]+.*$" ${SUPPORTED_VERSIONS})
+    get_filtered_list(SUPPORTED_VERSIONS "^[0-9]+.*$" ${SUPPORTED_VERSIONS})
 
     foreach(VERSION ${SUPPORTED_VERSIONS})
         string(REPLACE "." "_" VERSION_UNDERSCORE "${VERSION}")
@@ -64,18 +64,28 @@ function(determine_target_versions OUT_VERSIONS)
     endforeach(VERSION)
     if(NOT DEFINED ${OUT_VERSIONS})
         find_package(${PORT})
-
         if(${PORT_UC}_FOUND)
-            # Due to the ABI incompatibility between 4.3.4 and 4.3.5,
-            # MADlib treat 4.3.5+ as DB version that is different from 4.3
-            if(${PORT_UC} STREQUAL "GREENPLUM" AND
-                    ${${PORT_UC}_VERSION_MAJOR} EQUAL 4 AND
-                    ${${PORT_UC}_VERSION_MINOR} EQUAL 3 AND
-                    ${${PORT_UC}_VERSION_PATCH} GREATER 4)
-                set(VERSION "4.3ORCA")
-            else()
-                set(VERSION "${${PORT_UC}_VERSION_MAJOR}.${${PORT_UC}_VERSION_MINOR}")
+            set(VERSION "${${PORT_UC}_VERSION_MAJOR}.${${PORT_UC}_VERSION_MINOR}")
+            if(${PORT_UC} STREQUAL "GREENPLUM")
+                # Starting GPDB 5.0, semantic versioning will be followed,
+                # implying we only need 1 folder for same major versions
+                if(${${PORT_UC}_VERSION_MAJOR} EQUAL 5)
+                    set(VERSION "5")
+
+                # Due to the ABI incompatibility between 4.3.4 and 4.3.5,
+                # MADlib treat 4.3.5+ as DB version that is different from 4.3
+                elseif(${${PORT_UC}_VERSION_MAJOR} EQUAL 4 AND
+                        ${${PORT_UC}_VERSION_MINOR} EQUAL 3 AND
+                        ${${PORT_UC}_VERSION_PATCH} GREATER 4)
+                    set(VERSION "4.3ORCA")
+                endif()
+            elseif(${PORT_UC} STREQUAL "HAWQ" AND
+                    ${${PORT_UC}_VERSION_MAJOR} EQUAL 2)
+                # Starting HAWQ 2.0, semantic versioning will be followed,
+                # implying we only need 1 folder for same major versions
+                set(VERSION "2")
             endif()
+
             list(FIND SUPPORTED_VERSIONS "${VERSION}" _POS)
             if(_POS EQUAL -1)
                 string(REPLACE ";" ", " _SUPPORTED_VERSIONS_STR "${SUPPORTED_VERSIONS}")
@@ -96,7 +106,7 @@ function(determine_target_versions OUT_VERSIONS)
             endif(_POS EQUAL -1)
         endif(${PORT_UC}_FOUND)
     endif(NOT DEFINED ${OUT_VERSIONS})
-    
+
     # Pass values to caller
     set(${OUT_VERSIONS} "${${OUT_VERSIONS}}" PARENT_SCOPE)
     # ${PORT_UC}_${_VERSION_UNDERSCORE}_PG_CONFIG might have been set earlier!