You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2017/01/31 02:55:59 UTC
[1/2] kudu git commit: KUDU-1851 - [python] TableAlterer direct
instantiation causes SIGSEGV
Repository: kudu
Updated Branches:
refs/heads/master cf20c0e59 -> e87fb7907
KUDU-1851 - [python] TableAlterer direct instantiation causes SIGSEGV
The python client is currently crashing when a TableAlterer is directly
instantiated as opposed to instantiating via the new_table_alterer method
in the Client class. This patch addresses this issue and includes a new
unit test.
Change-Id: I074737c8f6992a7cd21f72f711337e915ffe2e82
Reviewed-on: http://gerrit.cloudera.org:8080/5822
Reviewed-by: Todd Lipcon <to...@apache.org>
Tested-by: Todd Lipcon <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/2882f0f3
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/2882f0f3
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/2882f0f3
Branch: refs/heads/master
Commit: 2882f0f3e255ed28769aa444f4d999ff796ebd7d
Parents: cf20c0e
Author: Jordan Birdsell <jt...@apache.org>
Authored: Sat Jan 28 11:17:28 2017 -0500
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Jan 31 02:25:34 2017 +0000
----------------------------------------------------------------------
python/kudu/client.pyx | 8 +++-----
python/kudu/tests/test_client.py | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/2882f0f3/python/kudu/client.pyx
----------------------------------------------------------------------
diff --git a/python/kudu/client.pyx b/python/kudu/client.pyx
index ab6a70a..c95844d 100644
--- a/python/kudu/client.pyx
+++ b/python/kudu/client.pyx
@@ -544,11 +544,7 @@ cdef class Client:
-------
alterer : TableAlterer
"""
- cdef:
- TableAlterer alterer = TableAlterer(table)
-
- alterer._init(self.cp.NewTableAlterer(tobytes(table.name)))
- return alterer
+ return TableAlterer(table)
#----------------------------------------------------------------------
@@ -2563,6 +2559,8 @@ cdef class TableAlterer:
def __cinit__(self, Table table):
self._table = table
self._new_name = None
+ self._init(self._table.parent.cp
+ .NewTableAlterer(tobytes(self._table.name)))
def __dealloc__(self):
if self._alterer != NULL:
http://git-wip-us.apache.org/repos/asf/kudu/blob/2882f0f3/python/kudu/tests/test_client.py
----------------------------------------------------------------------
diff --git a/python/kudu/tests/test_client.py b/python/kudu/tests/test_client.py
index 3183051..779cd25 100644
--- a/python/kudu/tests/test_client.py
+++ b/python/kudu/tests/test_client.py
@@ -345,6 +345,27 @@ class TestClient(KuduTestBase, unittest.TestCase):
with self.assertRaises(KeyError):
col = table['added-column']
+ def test_alter_table_direct_instantiation(self):
+ # Run the add_drop_column test with direct instantiation of
+ # the TableAlterer
+ table = self.client.table(self.ex_table)
+ alterer = kudu.client.TableAlterer(table)
+ alterer.add_column('added-column', type_='int64', default=0)
+ table = alterer.alter()
+
+ # Confirm column was added
+ expected_repr = 'Column(added-column, parent={0}, type=int64)' \
+ .format(self.ex_table)
+ self.assertEqual(expected_repr, repr(table['added-column']))
+
+ alterer = self.client.new_table_alterer(table)
+ alterer.drop_column('added-column')
+ table = alterer.alter()
+
+ # Confirm column has been dropped.
+ with self.assertRaises(KeyError):
+ col = table['added-column']
+
def test_alter_table_add_drop_partition(self):
# Add Range Partition
table = self.client.table(self.ex_table)
[2/2] kudu git commit: thirdparty: Clean up thirdparty prefix from
previous builds
Posted by mp...@apache.org.
thirdparty: Clean up thirdparty prefix from previous builds
If we are rebuilding thirdparty anyway, let's remove the artifacts from
previous builds that were previously installed, since we are going to
reinstall them anyway. This should not affect build times, since we are
not wiping out the build directory, and this will protect us against bad
artifacts left over from previous failed builds.
Change-Id: If2a7ceb3dad1acede152775611f549798723016c
Reviewed-on: http://gerrit.cloudera.org:8080/5826
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Mike Percy <mp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/e87fb790
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/e87fb790
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/e87fb790
Branch: refs/heads/master
Commit: e87fb79076d5ae2838cad6b63a78066a7853fb20
Parents: 2882f0f
Author: Mike Percy <mp...@apache.org>
Authored: Sat Jan 28 14:01:09 2017 -0800
Committer: Mike Percy <mp...@apache.org>
Committed: Tue Jan 31 02:55:40 2017 +0000
----------------------------------------------------------------------
thirdparty/build-thirdparty.sh | 48 +++++++++++++++++++++++++++++--------
thirdparty/postflight.py | 6 ++---
thirdparty/vars.sh | 4 ++--
3 files changed, 43 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/e87fb790/thirdparty/build-thirdparty.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 5626633..6d3bf06 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -68,6 +68,9 @@ else
"uninstrumented") F_UNINSTRUMENTED=1 ;;
"tsan") F_TSAN=1 ;;
+ # User requested a specific package to be built.
+ *) F_SPECIFIC_PACKAGE=1 ;& # Fall through to below cases.
+
# Dependencies.
"cmake") F_CMAKE=1 ;;
"gflags") F_GFLAGS=1 ;;
@@ -98,19 +101,39 @@ fi
################################################################################
-for PREFIX_DIR in $PREFIX_COMMON $PREFIX_DEPS $PREFIX_DEPS_TSAN; do
- mkdir -p $PREFIX_DIR/include
+init_prefix() {
+ local PREFIX_DIR=$1
+ local MAKE_LIBDIR=$2
+
+ if [ -z "$PREFIX_DIR" ]; then
+ echo "Unspecified prefix dir in init_prefix()"
+ exit 1
+ fi
+
+ rm -rf "$PREFIX_DIR"
+ mkdir -p "$PREFIX_DIR"
+ mkdir -p "$PREFIX_DIR/include"
- # PREFIX_COMMON is for header-only libraries.
- if [ "$PREFIX_DIR" != "$PREFIX_COMMON" ]; then
- mkdir -p $PREFIX_DIR/lib
+ # Some prefixes (such as common) are for non-library tools and header-only
+ # libraries. If the caller doesn't pass the second argument, we don't create
+ # and link the prefix lib dir.
+ if [ -n "$MAKE_LIBDIR" ]; then
+ mkdir -p "$PREFIX_DIR/lib"
# On some systems, autotools installs libraries to lib64 rather than lib. Fix
# this by setting up lib64 as a symlink to lib. We have to do this step first
# to handle cases where one third-party library depends on another.
ln -sf "$PREFIX_DIR/lib" "$PREFIX_DIR/lib64"
fi
-done
+}
+
+# If we are installing to a prefix for the first time, or are installing all
+# dependencies under a given prefix, initialize the whole prefix (including
+# wiping out existing files in that path) to ensure nothing remains from the
+# installation of a previous build.
+[ -n "$F_COMMON" ] && init_prefix $PREFIX_COMMON
+[ -n "$F_UNINSTRUMENTED" ] && init_prefix $PREFIX_UNINSTRUMENTED libdir
+[ -n "$F_TSAN" ] && init_prefix $PREFIX_TSAN libdir
# Incorporate the value of these standard compilation environment variables into
# the EXTRA_* environment variables.
@@ -193,7 +216,7 @@ fi
### Build C dependencies without instrumentation
-PREFIX=$PREFIX_DEPS
+PREFIX=$PREFIX_UNINSTRUMENTED
MODE_SUFFIX=""
save_env
@@ -239,7 +262,7 @@ restore_env
### Build C++ dependencies without instrumentation
# Clang is used by all builds so it is part of the 'common' library group even
-# though its LLVM libraries are installed to $PREFIX_DEPS.
+# though its LLVM libraries are installed to $PREFIX_UNINSTRUMENTED.
if [ -n "$F_COMMON" -o -n "$F_LLVM" ]; then
build_llvm normal
fi
@@ -317,7 +340,7 @@ fi
export CC=$CLANG
export CXX=$CLANGXX
-PREFIX=$PREFIX_DEPS_TSAN
+PREFIX=$PREFIX_TSAN
MODE_SUFFIX=".tsan"
save_env
@@ -434,7 +457,12 @@ fi
restore_env
# Now run the post-flight checks.
-$TP_DIR/postflight.py
+POST_FLIGHT_FLAGS=""
+if [[ -n "$F_TSAN" || -n "$F_SPECIFIC_PACKAGE" ]]; then
+ # Do the tsan postflight check any time a tsan dep might be updated.
+ POST_FLIGHT_FLAGS="$POST_FLIGHT_FLAGS tsan"
+fi
+$TP_DIR/postflight.py $POST_FLIGHT_FLAGS
echo "---------------------"
echo "Thirdparty dependencies '$ARGS_TO_PRINT' built and installed successfully"
http://git-wip-us.apache.org/repos/asf/kudu/blob/e87fb790/thirdparty/postflight.py
----------------------------------------------------------------------
diff --git a/thirdparty/postflight.py b/thirdparty/postflight.py
index e61adcb..bc0a9bb 100755
--- a/thirdparty/postflight.py
+++ b/thirdparty/postflight.py
@@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
"""
-Simple script which performs some sanity checks on the built thirdparty/.
+Script which performs some sanity checks on the built thirdparty/.
"""
import os
@@ -83,11 +83,11 @@ done
echo All TSAN dependencies checked
""".format(tp_dir=TP_DIR))
-
def main():
print("Running post-flight checks")
print("-------------------------")
- check_tsan_dependencies()
+ if "tsan" in sys.argv:
+ check_tsan_dependencies()
print("-------------------------")
print("Post-flight checks succeeded.")
return 0
http://git-wip-us.apache.org/repos/asf/kudu/blob/e87fb790/thirdparty/vars.sh
----------------------------------------------------------------------
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index b8d8b0e..9d7f4ba 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -31,8 +31,8 @@ TP_BUILD_DIR="$TP_DIR/build"
CLOUDFRONT_URL_PREFIX=http://d3dr9sfxru4sde.cloudfront.net
PREFIX_COMMON=$TP_DIR/installed/common
-PREFIX_DEPS=$TP_DIR/installed/uninstrumented
-PREFIX_DEPS_TSAN=$TP_DIR/installed/tsan
+PREFIX_UNINSTRUMENTED=$TP_DIR/installed/uninstrumented
+PREFIX_TSAN=$TP_DIR/installed/tsan
GFLAGS_VERSION=2.1.2
GFLAGS_NAME=gflags-$GFLAGS_VERSION