Skip to content

Commit

Permalink
Merge branch 'master' into debug
Browse files Browse the repository at this point in the history
  • Loading branch information
windchan7 authored Apr 4, 2018
2 parents 2a762cf + 98e12ba commit 458c350
Show file tree
Hide file tree
Showing 521 changed files with 28,786 additions and 16,909 deletions.
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ In summary (the wiki page details the rationales and provides further suggestion
contributors aren't allowed to merge themselves; in that case, we'll
do it for you.
- Direct merges using GitHub's "big green button" are avoided. Instead, we use
[bors-ng](https://bors.tech/documentation/) to manage our merges to prevent
"merge skew". When you're ready to merge, add a comment to your PR of the
form `bors r+`. Craig (our Bors bot)
will run CI on your changes, and if it passes, merge them. For more
information, see [the wiki](https://github.com/cockroachdb/cockroach/wiki/Bors-merge-bot).
## Debugging
Peeking into a running cluster can be done in several ways:
Expand Down
7 changes: 5 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 55 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ help: ## Print help for targets with comments.

# Possible values:
# <empty>: use the default toolchain
# release-linux-gnu: target Linux 2.6.32, dynamically link GLIBC 2.12.2
# release-linux-musl: target Linux 2.6.32, statically link musl 1.1.16
# release-darwin: target OS X 10.9
# release-windows: target Windows 8, statically link all non-Windows libraries
# release-linux-gnu: target Linux 2.6.32, dynamically link GLIBC 2.12.2
# release-linux-musl: target Linux 2.6.32, statically link musl 1.1.16
# release-aarch64-linux: target aarch64 Linux 3.7.10, dynamically link GLIBC 2.12.2
# release-darwin: target OS X 10.9
# release-windows: target Windows 8, statically link all non-Windows libraries
#
# All non-empty variants only work in the cockroachdb/builder docker image, as
# they depend on cross-compilation toolchains available there.
Expand Down Expand Up @@ -142,40 +143,51 @@ export CGO_LDFLAGS
override CFLAGS += $(MSAN_CPPFLAGS)
override CXXFLAGS += $(MSAN_CPPFLAGS)
override LDFLAGS += $(MSAN_LDFLAGS)
export CFLAGS
export CXXFLAGS
export LDFLAGS
else ifeq ($(TYPE),release-linux-gnu)
# We use a custom toolchain to target old Linux and glibc versions. However,
# this toolchain's libstdc++ version is quite recent and must be statically
# linked to avoid depending on the target's available libstdc++.
XHOST_TRIPLE := x86_64-unknown-linux-gnu
override LINKFLAGS += -s -w -extldflags "-static-libgcc -static-libstdc++"
override LINKFLAGS += -extldflags "-static-libgcc -static-libstdc++"
override SUFFIX := $(SUFFIX)-linux-2.6.32-gnu-amd64
BUILD_TYPE := release
else ifeq ($(TYPE),release-linux-musl)
BUILD_TYPE := release
XHOST_TRIPLE := x86_64-unknown-linux-musl
override LINKFLAGS += -s -w -extldflags "-static"
override LINKFLAGS += -extldflags "-static"
override SUFFIX := $(SUFFIX)-linux-2.6.32-musl-amd64
BUILD_TYPE := release
else ifeq ($(TYPE),release-aarch64-linux)
XGOARCH := arm64
export CGO_ENABLED := 1
XHOST_TRIPLE := aarch64-unknown-linux-gnueabi
override LINKFLAGS += -extldflags "-static-libgcc -static-libstdc++"
override SUFFIX := $(SUFFIX)-linux-3.7.10-gnu-aarch64
BUILD_TYPE := release
else ifeq ($(TYPE),release-darwin)
XGOOS := darwin
export CGO_ENABLED := 1
XHOST_TRIPLE := x86_64-apple-darwin13
override SUFFIX := $(SUFFIX)-darwin-10.9-amd64
override LINKFLAGS += -s -w
BUILD_TYPE := release
else ifeq ($(TYPE),release-windows)
XGOOS := windows
export CGO_ENABLED := 1
XHOST_TRIPLE := x86_64-w64-mingw32
override SUFFIX := $(SUFFIX)-windows-6.2-amd64
override LINKFLAGS += -s -w -extldflags "-static"
override LINKFLAGS += -extldflags "-static"
BUILD_TYPE := release
else
$(error unknown build type $(TYPE))
endif

# Build C/C++ with basic debugging information.
CFLAGS += -g1
CXXFLAGS += -g1

export CFLAGS
export CXXFLAGS
export LDFLAGS

override LINKFLAGS += -X github.com/cockroachdb/cockroach/pkg/build.typ=$(BUILD_TYPE)

GO ?= go
Expand All @@ -189,11 +201,22 @@ UI_ROOT := $(PKG_ROOT)/ui
SQLPARSER_ROOT := $(PKG_ROOT)/sql/parser

# Ensure we have an unambiguous GOPATH.
export GOPATH := $(realpath ../../../..)
# ^ ^ ^ ^~ GOPATH
# | | |~ GOPATH/src
# | |~ GOPATH/src/github.com
# |~ GOPATH/src/github.com/cockroachdb
GOPATH := $(realpath $(shell $(GO) env GOPATH))
ifeq ($(strip $(GOPATH)),)
$(error GOPATH is not set and could not be automatically determined, build cannot continue)
endif

ifneq "$(or $(findstring :,$(GOPATH)),$(findstring ;,$(GOPATH)))" ""
$(error GOPATHs with multiple entries are not supported)
endif

ifeq "$(filter $(GOPATH)%,$(CURDIR))" ""
$(error Current directory "$(CURDIR)" is not within GOPATH "$(GOPATH)")
endif

ifeq "$(GOPATH)" "/"
$(error GOPATH=/ is not supported)
endif

# Avoid printing twice if Make restarts (because a Makefile was changed) or is
# called recursively from another Makefile.
Expand Down Expand Up @@ -548,7 +571,8 @@ $(CRYPTOPP_DIR)/Makefile: $(C_DEPS_DIR)/cryptopp-rebuild | $(SUBMODULES_TARGET)
mkdir -p $(CRYPTOPP_DIR)
@# NOTE: If you change the CMake flags below, bump the version in
@# $(C_DEPS_DIR)/cryptopp-rebuild. See above for rationale.
cd $(CRYPTOPP_DIR) && cmake $(XCMAKE_FLAGS) $(CRYPTOPP_SRC_DIR)
cd $(CRYPTOPP_DIR) && cmake $(XCMAKE_FLAGS) $(CRYPTOPP_SRC_DIR) \
-DCMAKE_BUILD_TYPE=Release

$(JEMALLOC_SRC_DIR)/configure.ac: | $(SUBMODULES_TARGET)

Expand All @@ -570,36 +594,38 @@ $(PROTOBUF_DIR)/Makefile: $(C_DEPS_DIR)/protobuf-rebuild | $(SUBMODULES_TARGET)
mkdir -p $(PROTOBUF_DIR)
@# NOTE: If you change the CMake flags below, bump the version in
@# $(C_DEPS_DIR)/protobuf-rebuild. See above for rationale.
cd $(PROTOBUF_DIR) && cmake $(XCMAKE_FLAGS) -Dprotobuf_BUILD_TESTS=OFF $(PROTOBUF_SRC_DIR)/cmake
cd $(PROTOBUF_DIR) && cmake $(XCMAKE_FLAGS) -Dprotobuf_BUILD_TESTS=OFF $(PROTOBUF_SRC_DIR)/cmake \
-DCMAKE_BUILD_TYPE=Release

ifneq ($(PROTOC_DIR),$(PROTOBUF_DIR))
$(PROTOC_DIR)/Makefile: $(C_DEPS_DIR)/protobuf-rebuild | $(SUBMODULES_TARGET)
rm -rf $(PROTOC_DIR)
mkdir -p $(PROTOC_DIR)
@# NOTE: If you change the CMake flags below, bump the version in
@# $(C_DEPS_DIR)/protobuf-rebuild. See above for rationale.
cd $(PROTOC_DIR) && cmake $(CMAKE_FLAGS) -Dprotobuf_BUILD_TESTS=OFF $(PROTOBUF_SRC_DIR)/cmake
cd $(PROTOC_DIR) && cmake $(CMAKE_FLAGS) -Dprotobuf_BUILD_TESTS=OFF $(PROTOBUF_SRC_DIR)/cmake \
-DCMAKE_BUILD_TYPE=Release
endif

$(ROCKSDB_DIR)/Makefile: sse := $(if $(findstring x86_64,$(TARGET_TRIPLE)),-msse3)
$(ROCKSDB_DIR)/Makefile: $(C_DEPS_DIR)/rocksdb-rebuild | $(SUBMODULES_TARGET) libsnappy $(if $(USE_STDMALLOC),,libjemalloc)
rm -rf $(ROCKSDB_DIR)
mkdir -p $(ROCKSDB_DIR)
@# NOTE: If you change the CMake flags below, bump the version in
@# $(C_DEPS_DIR)/rocksdb-rebuild. See above for rationale.
cd $(ROCKSDB_DIR) && cmake $(XCMAKE_FLAGS) $(ROCKSDB_SRC_DIR) \
cd $(ROCKSDB_DIR) && CFLAGS+=" $(sse)" && CXXFLAGS+=" $(sse)" && cmake $(XCMAKE_FLAGS) $(ROCKSDB_SRC_DIR) \
$(if $(findstring release,$(BUILD_TYPE)),-DPORTABLE=ON) \
-DSNAPPY_LIBRARIES=$(SNAPPY_DIR)/libsnappy.a -DSNAPPY_INCLUDE_DIR="$(SNAPPY_SRC_DIR);$(SNAPPY_DIR)" -DWITH_SNAPPY=ON \
$(if $(USE_STDMALLOC),,-DJEMALLOC_LIBRARIES=$(JEMALLOC_DIR)/lib/libjemalloc.a -DJEMALLOC_INCLUDE_DIR=$(JEMALLOC_DIR)/include -DWITH_JEMALLOC=ON) \
-DCMAKE_CXX_FLAGS="$(if $(findstring x86_64,$(TARGET_TRIPLE)),-msse3) $(if $(ENABLE_ROCKSDB_ASSERTIONS),,-DNDEBUG)"
@# TODO(benesch): Tweak how we pass -DNDEBUG above when we upgrade to a
@# RocksDB release that includes https://github.com/facebook/rocksdb/pull/2300.
-DCMAKE_BUILD_TYPE=$(if $(ENABLE_ROCKSDB_ASSERTIONS),Debug,Release)

$(SNAPPY_DIR)/Makefile: $(C_DEPS_DIR)/snappy-rebuild | $(SUBMODULES_TARGET)
rm -rf $(SNAPPY_DIR)
mkdir -p $(SNAPPY_DIR)
@# NOTE: If you change the CMake flags below, bump the version in
@# $(C_DEPS_DIR)/snappy-rebuild. See above for rationale.
cd $(SNAPPY_DIR) && cmake $(XCMAKE_FLAGS) $(SNAPPY_SRC_DIR)
cd $(SNAPPY_DIR) && cmake $(XCMAKE_FLAGS) $(SNAPPY_SRC_DIR) \
-DCMAKE_BUILD_TYPE=Release

# TODO(benesch): make it possible to build libroach without CCL code. Because
# libroach and libroachccl are defined in the same CMake project, CMake requires
Expand Down Expand Up @@ -852,6 +878,10 @@ lint: override TAGS += lint
lint: ## Run all style checkers and linters.
lint: | bin/returncheck
@if [ -t 1 ]; then echo '$(yellow)NOTE: `make lint` is very slow! Perhaps `make lintshort`?$(term-reset)'; fi
@# Run 'go install' to ensure we have compiled object files available for all
@# packages. In Go 1.10, only 'go vet' recompiles on demand. For details:
@# https://groups.google.com/forum/#!msg/golang-dev/qfa3mHN4ZPA/X2UzjNV1BAAJ.
$(XGO) install -v $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LINKFLAGS)' $(PKG)
$(XGO) test $(PKG_ROOT)/testutils/lint -v $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LINKFLAGS)' -run 'TestLint/$(TESTS)'

.PHONY: lintshort
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ CockroachDB supports the PostgreSQL wire protocol, so you can use any available

We're an open source project and welcome contributions. See our [Contributing Guide](https://www.cockroachlabs.com/docs/stable/contribute-to-cockroachdb.html) for more details.

Engineering discussion takes place on our public mailing list,
[[email protected]](https://groups.google.com/forum/#!forum/cockroach-db).


## Design

Expand Down
9 changes: 9 additions & 0 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
status = [
"GitHub CI (Cockroach)"
]
pr_status = [
"license/cla"
]
block_labels = [
"do-not-merge"
]
1 change: 1 addition & 0 deletions build/archive/contents/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export GOPATH = $(CURDIR)
export BUILDCHANNEL := source-archive

.PHONY: all build buildoss check clean install test
Expand Down
2 changes: 1 addition & 1 deletion build/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -euo pipefail

image=cockroachdb/builder
version=20180220-200046
version=20180330-210116

function init() {
docker build --tag="${image}" "$(dirname "${0}")/builder"
Expand Down
21 changes: 15 additions & 6 deletions build/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,22 @@ RUN mkdir crosstool-ng \
&& cd .. \
&& rm -rf crosstool-ng

COPY x86_64-unknown-linux-gnu.defconfig x86_64-unknown-linux-musl.defconfig x86_64-w64-mingw.defconfig ./
COPY x86_64-unknown-linux-gnu.defconfig x86_64-unknown-linux-musl.defconfig x86_64-w64-mingw.defconfig aarch64-unknown-linux-gnueabi.defconfig ./
RUN mkdir src \
&& mkdir build && (cd build && DEFCONFIG=../x86_64-unknown-linux-gnu.defconfig /usr/local/ct-ng/bin/ct-ng defconfig && /usr/local/ct-ng/bin/ct-ng build) && rm -rf build \
&& mkdir build && (cd build && DEFCONFIG=../x86_64-unknown-linux-musl.defconfig /usr/local/ct-ng/bin/ct-ng defconfig && /usr/local/ct-ng/bin/ct-ng build) && rm -rf build \
&& mkdir build && (cd build && DEFCONFIG=../x86_64-w64-mingw.defconfig /usr/local/ct-ng/bin/ct-ng defconfig && /usr/local/ct-ng/bin/ct-ng build) && rm -rf build \
&& mkdir build && (cd build && DEFCONFIG=../x86_64-unknown-linux-gnu.defconfig /usr/local/ct-ng/bin/ct-ng defconfig && /usr/local/ct-ng/bin/ct-ng build) && rm -rf build \
&& mkdir build && (cd build && DEFCONFIG=../x86_64-unknown-linux-musl.defconfig /usr/local/ct-ng/bin/ct-ng defconfig && /usr/local/ct-ng/bin/ct-ng build) && rm -rf build \
&& mkdir build && (cd build && DEFCONFIG=../x86_64-w64-mingw.defconfig /usr/local/ct-ng/bin/ct-ng defconfig && /usr/local/ct-ng/bin/ct-ng build) && rm -rf build \
&& mkdir build && (cd build && DEFCONFIG=../aarch64-unknown-linux-gnueabi.defconfig /usr/local/ct-ng/bin/ct-ng defconfig && /usr/local/ct-ng/bin/ct-ng build) && rm -rf build \
&& rm -rf src

# Build & install libtinfo (terminfo) for the linux targets.
# Build & install libtinfo (terminfo) for the linux targets (x86 and arm).
# (on BSD or BSD-derived like macOS it's already built-in; on windows we don't need it.)
#
# The patch is needed to work around a bug in Debian mawk, see
# http://lists.gnu.org/archive/html/bug-ncurses/2015-08/msg00008.html
COPY ncurses.patch ./
#
# Run the two builds.
# Run the three builds.
# As per the Debian rule file for ncurses, the two configure tests for
# the type of bool and poll(2) are broken when cross-compiling, so we
# need to feed the test results manually to configure via an environment
Expand Down Expand Up @@ -98,6 +99,14 @@ RUN mkdir ncurses \
--host=x86_64-unknown-linux-gnu \
$(cat /ncurses.conf) \
&& (cd ncurses && make all && make install.tinfo)) \
&& mkdir build-aarch64-unknown-linux-gnueabi \
&& (cd build-aarch64-unknown-linux-gnueabi \
&& CC=/x-tools/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-cc \
CXX=/x-tools/aarch64-unknown-linux-gnueabi/bin/aarch64-unknown-linux-gnueabi-c++ \
../configure --prefix=/x-tools/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/sysroot/usr \
--host=aarch64-unknown-linux-gnueabi \
$(cat /ncurses.conf) \
&& (cd ncurses && make all && make install.tinfo)) \
&& cd .. \
&& rm -rf ncurses ncurses.conf ncurses.patch

Expand Down
29 changes: 29 additions & 0 deletions build/builder/aarch64-unknown-linux-gnueabi.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CT_OBSOLETE=y
CT_EXPERIMENTAL=y
CT_ALLOW_BUILD_AS_ROOT=y
CT_ALLOW_BUILD_AS_ROOT_SURE=y
CT_LOCAL_TARBALLS_DIR="/src"
CT_PREFIX_DIR="${CT_PREFIX:-/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"
CT_ARCH="arm"
CT_ARCH_arm=y
CT_ARCH_SUPPORTS_BOTH_MMU=y
CT_ARCH_DEFAULT_HAS_MMU=y
CT_ARCH_SUPPORTS_BOTH_ENDIAN=y
CT_ARCH_DEFAULT_LE=y
CT_ARCH_LE=y
CT_ARCH_ENDIAN="little"
CT_ARCH_64=y
CT_KERNEL_linux=y
# Linux 3.7 was the first to support arm64.
CT_KERNEL_V_3_7=y
# CT_KERNEL_LINUX_INSTALL_CHECK is not set
CT_BINUTILS_LINKER_LD_GOLD=y
CT_BINUTILS_GOLD_THREADS=y
CT_BINUTILS_LD_WRAPPER=y
CT_BINUTILS_PLUGINS=y
CT_LIBC_GLIBC_V_2_12_2=y
# CT_CC_GCC_ENABLE_TARGET_OPTSPACE is not set
# CT_CC_GCC_LIBMPX is not set
CT_CC_LANG_CXX=y
# CT_COMP_TOOLS_automake is not set
# CT_COMP_TOOLS_libtool is not set
2 changes: 1 addition & 1 deletion build/deploy/rhel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM registry.access.redhat.com/rhel-atomic:latest

LABEL name="cockroachdb/cockroach" \
vendor="Cockroach Labs" \
version="1.1.7" \
version="2.0.0" \
release="1" \
summary="CockroachDB is a cloud-native SQL database for building global, scalable cloud services that survive disasters." \
description="CockroachDB is a distributed SQL database that uses the PostgreSQL wire protocol, so there are a huge variety of client drivers and ORMs that you can use to talk to it. To get started, see https://www.cockroachlabs.com/docs/stable/build-an-app-with-cockroachdb.html" \
Expand Down
2 changes: 1 addition & 1 deletion build/deploy/rhel/help.1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Documentation for CockroachDB can be found at: https://www.cockroachlabs.com/docs/v1.1/
Documentation for CockroachDB can be found at: https://www.cockroachlabs.com/docs/v2.0/
To get support for a specific issue, please see: https://www.cockroachlabs.com/docs/stable/support-resources.html
65 changes: 0 additions & 65 deletions build/roachtest-nightly.sh

This file was deleted.

10 changes: 0 additions & 10 deletions build/teamcity-roachtest-nightly.sh

This file was deleted.

Loading

0 comments on commit 458c350

Please sign in to comment.