Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ include_directories(SYSTEM ${MAD_THIRD_PARTY}/src/EP_eigen)

# -- Third-party dependencies: Download the Python libraries ---

find_package(PythonInterp REQUIRED)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)

set(BUILD_PYTHON_LIBDIR "${CMAKE_BINARY_DIR}/src/lib/python")

Expand Down
10 changes: 2 additions & 8 deletions src/madpack/madpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ def _check_db_port(portid):
row = _internal_run_query("SELECT version() AS version", True)
except:
error_(this, "Cannot validate DB platform type", True)
if portid == 'greenplum' and row[0]['version'].lower().find('greengage') >= 0:
return True
if row and row[0]['version'].lower().find(portid) >= 0:
if portid == 'postgres':
if row[0]['version'].lower().find('greenplum') < 0:
Expand Down Expand Up @@ -775,14 +777,6 @@ def _execute_per_module_unit_test_algo(module, pyfile, cur_tmpdir):
# runenv = os.environ
runenv = os.environ.copy()

# GPDB6 python3 support is provided by an additional package.
# To access it, we will have to set environment variables.
if dbver == '6':
gphome = runenv["GPHOME"]
runenv["LD_LIBRARY_PATH"] = "{0}/ext/python3.9/lib:".format(gphome) + runenv["LD_LIBRARY_PATH"]
runenv["PATH"] = "{0}/ext/python3.9/bin:".format(gphome) + runenv["PATH"]
runenv["PYTHONHOME"] = "{0}/ext/python3.9".format(gphome)
runenv["PYTHONPATH"] = "{0}/ext/python3.9/lib".format(gphome)
retval = subprocess.call(runcmd, env=runenv, stdout=log, stderr=log)
run_end = datetime.datetime.now()
milliseconds = round((run_end - run_start).seconds * 1000 +
Expand Down
2 changes: 1 addition & 1 deletion src/madpack/sort-module.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import re
import sys

from . import configyml
import configyml


def get_modules_in_order():
Expand Down
4 changes: 2 additions & 2 deletions src/madpack/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def get_dbver(con_args, portid):
elif portid == 'greenplum':
# 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)
return None if match is None else match.group(1)
match = re.search("Green(plum|gage)[a-zA-Z\s]*(\d+\.\d+\.\d+)", versionStr)
return None if match is None else match.group(2)
except Exception:
error_(this, "Failed reading database version", True)
# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/ports/greenplum/cmake/FindGreenplum.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(NOT DEFINED _FIND_PACKAGE_FILE)
endif(NOT DEFINED _FIND_PACKAGE_FILE)

# Set parameters for calling FindPostgreSQL.cmake
set(_NEEDED_PG_CONFIG_PACKAGE_NAME "Greenplum Database")
set(_NEEDED_PG_CONFIG_PACKAGE_NAME "Green(plum|gage) Database")
set(_PG_CONFIG_VERSION_NUM_MACRO "GP_VERSION_NUM")
set(_PG_CONFIG_VERSION_MACRO "GP_VERSION")
set(_SEARCH_PATH_HINTS
Expand Down
2 changes: 1 addition & 1 deletion src/ports/postgres/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ function(add_extension_support)
add_custom_command(OUTPUT ${EXTENSION_SQL}
COMMAND awk 'FNR==1{print \"\"}1' ${EXTENSION_SQL_BASE}
`cd ${CMAKE_BINARY_DIR}/src/madpack &&
python sort-module.py ${MODULE_SQL_POST_FILES}` >${EXTENSION_SQL}
python3 sort-module.py ${MODULE_SQL_POST_FILES}` >${EXTENSION_SQL}
DEPENDS ${MODULE_SQL_POST_FILES} madpackFiles configFiles pythonFiles_${DBMS} madlib_${DBMS}
COMMENT "Concatenating into ${EXTENSION_SQL}"
)
Expand Down
6 changes: 3 additions & 3 deletions src/ports/postgres/cmake/FindPostgreSQL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ if(${PKG_NAME}_PG_CONFIG AND ${PKG_NAME}_SERVER_INCLUDE_DIR)
"server include dir (${${PKG_NAME}_SERVER_INCLUDE_DIR}).")
endif(EXISTS ${CONFIG_FILE})

if(_PACKAGE_NAME STREQUAL "${_NEEDED_PG_CONFIG_PACKAGE_NAME}")
if(_PACKAGE_NAME MATCHES "${_NEEDED_PG_CONFIG_PACKAGE_NAME}")
if((NOT DEFINED PACKAGE_FIND_VERSION) OR
(PACKAGE_FIND_VERSION VERSION_EQUAL
"${${PKG_NAME}_VERSION_MAJOR}.${${PKG_NAME}_VERSION_MINOR}"))
Expand Down Expand Up @@ -198,7 +198,7 @@ if(${PKG_NAME}_PG_CONFIG AND ${PKG_NAME}_SERVER_INCLUDE_DIR)
"was requested.")
endif(${PACKAGE_FIND_VERSION})
endif()
else(_PACKAGE_NAME STREQUAL "${_NEEDED_PG_CONFIG_PACKAGE_NAME}")
else(_PACKAGE_NAME MATCHES "${_NEEDED_PG_CONFIG_PACKAGE_NAME}")
if(${PACKAGE_FIND_VERSION})
# There are DBMSs derived from PostgreSQL that also contain pg_config.
# So there might be many pg_config installed on a system.
Expand All @@ -207,7 +207,7 @@ if(${PKG_NAME}_PG_CONFIG AND ${PKG_NAME}_SERVER_INCLUDE_DIR)
"where ${_NEEDED_PG_CONFIG_PACKAGE_NAME} ${PACKAGE_FIND_VERSION} "
"was requested.")
endif(${PACKAGE_FIND_VERSION})
endif(_PACKAGE_NAME STREQUAL "${_NEEDED_PG_CONFIG_PACKAGE_NAME}")
endif(_PACKAGE_NAME MATCHES "${_NEEDED_PG_CONFIG_PACKAGE_NAME}")
endif(${PKG_NAME}_PG_CONFIG AND ${PKG_NAME}_SERVER_INCLUDE_DIR)

# Checks 'REQUIRED', 'QUIET' and versions. Note that the first parameter is
Expand Down
28 changes: 14 additions & 14 deletions src/ports/postgres/madpack/SQLCommon.m4_in
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ m4_define(<!WithTracebackForwarding!>, <!
try:
$1
except Exception as e:
/* FIXME:
* Commenting out the following block since the SD/GD handling is different with python3
* The effect should be minimal since in the case of an error, the user should start a new session anyway.

global SD
global GD

for k in SD.keys():
del SD[k]
del SD
for k in GD.keys():
del GD[k]
del GD
*/
# FIXME:
# Commenting out the following block since the SD/GD handling is different with python3
# The effect should be minimal since in the case of an error, the user should start a new session anyway.

# global SD
# global GD

# for k in SD.keys():
# del SD[k]
# del SD
# for k in GD.keys():
# del GD[k]
# del GD

etype, _, tb = exc_info()
detail = ''.join(traceback.format_exception(etype, e, tb))
message = e.message + 'SegmentTraceback' + detail
Expand Down
18 changes: 9 additions & 9 deletions src/ports/postgres/modules/utilities/utilities.py_in
Original file line number Diff line number Diff line change
Expand Up @@ -667,17 +667,17 @@ class __mad_version:

def is_pg(self):
if (re.search(r"PostgreSQL", self.version) and
not re.search(r"Greenplum\s*Database", self.version)):
not re.search(r"Green(plum|gage)\s*Database", self.version)):
return True
return False

def is_gp43(self):
if re.search(r"Greenplum\s+Database\s+4\.3", self.version):
if re.search(r"Green(plum|gage)\s+Database\s+4\.3", self.version):
return True
return False

def is_gp7(self):
if re.search(r"Greenplum\s+Database\s+7", self.version):
if re.search(r"Green(plum|gage)\s+Database\s+7", self.version):
return True
return False

Expand All @@ -690,17 +690,17 @@ class __mad_version:
return False

def is_less_than_gp41(self):
regex = re.compile('Greenplum\s+Database\s*([0-9].[0-9])[0-9.]+\s+build', re.IGNORECASE)
regex = re.compile('Green(plum|gage)\s+Database\s*([0-9].[0-9])[0-9.]+\s+build', re.IGNORECASE)
version = regex.findall(self.version)
if len(version) > 0 and float(version[0]) < 4.1:
if len(version) > 0 and float(version[1]) < 4.1:
return True
else:
return False

def is_less_than_gp42(self):
regex = re.compile('Greenplum\s+Database\s*([0-9].[0-9])[0-9.]+\s+build', re.IGNORECASE)
regex = re.compile('Green(plum|gage)\s+Database\s*([0-9].[0-9])[0-9.]+\s+build', re.IGNORECASE)
version = regex.findall(self.version)
if len(version) > 0 and float(version[0]) < 4.2:
if len(version) > 0 and float(version[1]) < 4.2:
return True
else:
return False
Expand Down Expand Up @@ -731,10 +731,10 @@ class __mad_version:
format is Semantic Versioning.
examples of versions: 1.0, 2.3, 9.3.5
"""
regex = re.compile('Greenplum\s+Database\s*([0-9.]+)', re.IGNORECASE)
regex = re.compile('Green(plum|gage)\s+Database\s*([0-9.]+)', re.IGNORECASE)
version = regex.findall(self.version)
if version:
db_ver = [float(i) for i in version[0].split('.') if i.isdigit()]
db_ver = [float(i) for i in version[1].split('.') if i.isdigit()]
cmp_ver = [float(i) for i in compare_version.split('.') if i.isdigit()]
return db_ver < cmp_ver
else:
Expand Down