Skip to content

Commit 7b6066b

Browse files
authored
Merge branch 'apache:main' into main
2 parents f9a2182 + 9210269 commit 7b6066b

File tree

7 files changed

+94
-22
lines changed

7 files changed

+94
-22
lines changed

devops/deploy/docker/build/rocky8/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ RUN dnf makecache && \
133133
which \
134134
zlib-devel && \
135135
dnf install -y -d0 --enablerepo=devel \
136+
liburing-devel \
136137
libuv-devel \
137138
libyaml-devel \
138139
perl-IPC-Run \

devops/deploy/docker/build/rocky9/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ RUN dnf makecache && \
136136
readline-devel \
137137
zlib-devel && \
138138
dnf install -y --enablerepo=crb \
139+
liburing-devel \
139140
libuv-devel \
140141
libyaml-devel \
141142
perl-IPC-Run \

devops/deploy/docker/build/ubuntu22.04/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ RUN apt-get update && \
113113
libreadline-dev \
114114
libssh2-1-dev \
115115
libssl-dev \
116+
liburing-dev \
116117
libuv1-dev \
117118
libxerces-c-dev \
118119
libxml2-dev \

devops/sandbox/Dockerfile.main.rockylinux9

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@
1919
# --------------------------------------------------------------------
2020
# Multi-stage Dockerfile for Apache Cloudberry Sandbox Environment
2121
# --------------------------------------------------------------------
22-
# This Dockerfile uses pre-built Apache Cloudberry build images to
23-
# compile and install Cloudberry from the main branch, then creates
24-
# a runtime environment for testing and development.
22+
# This Dockerfile supports two source modes:
23+
# - Main branch: clone the latest main from GitHub (CODEBASE_VERSION=main)
24+
# - Local source: use the repository contents from the Docker build context
25+
# (CODEBASE_VERSION=local), recommended for developers working from
26+
# their current checkout.
27+
# In both modes it compiles and installs Cloudberry, then creates a
28+
# runtime environment for testing and development.
2529
# --------------------------------------------------------------------
2630

2731
# Build stage: Use pre-built image to compile Cloudberry
32+
ARG CODEBASE_VERSION=main
2833
FROM rockylinux/rockylinux:9.6 AS builder
34+
ARG CODEBASE_VERSION
2935

3036
# Install build toolchains and development headers (avoid coreutils/curl conflicts on arm64)
3137
RUN dnf makecache && \
@@ -118,8 +124,20 @@ RUN groupadd -r gpadmin && \
118124
USER gpadmin
119125
WORKDIR /home/gpadmin
120126

121-
# Clone the latest Cloudberry source code
122-
RUN git clone --recurse-submodules --branch main --single-branch --depth=1 https://github.com/apache/cloudberry.git
127+
# Copy repository contents from build context
128+
# Note: This COPY always executes regardless of CODEBASE_VERSION due to Docker
129+
# layer caching behavior. For main branch builds, the copied content will be
130+
# removed and replaced by a fresh git clone in the RUN step below. This is an
131+
# acceptable tradeoff to keep the Dockerfile simple and maintainable.
132+
COPY --chown=gpadmin:gpadmin . /home/gpadmin/cloudberry
133+
134+
# Obtain Cloudberry source code based on build mode
135+
RUN if [ "${CODEBASE_VERSION}" = "local" ]; then \
136+
echo "Using local source from build context"; \
137+
else \
138+
rm -rf /home/gpadmin/cloudberry && \
139+
git clone --recurse-submodules --branch main --single-branch --depth=1 https://github.com/apache/cloudberry.git; \
140+
fi
123141

124142
# Build Cloudberry using the official build scripts
125143
RUN cd /home/gpadmin/cloudberry && \
@@ -188,12 +206,12 @@ COPY --from=builder /usr/local/xerces-c/lib/libxerces-c.so /usr/local/cloudberry
188206
COPY --from=builder /usr/local/xerces-c/lib/libxerces-c-3.*.so /usr/local/cloudberry-db/lib/
189207

190208
# Copy configuration files to their final destinations
191-
COPY ./configs/90-cbdb-limits.conf /etc/security/limits.d/90-cbdb-limits.conf
192-
COPY ./configs/90-cbdb-sysctl.conf /etc/sysctl.d/90-cbdb-sysctl.conf
193-
COPY ./configs/gpinitsystem_singlenode /tmp/gpinitsystem_singlenode
194-
COPY ./configs/gpinitsystem_multinode /tmp/gpinitsystem_multinode
195-
COPY ./configs/multinode-gpinit-hosts /tmp/multinode-gpinit-hosts
196-
COPY ./configs/init_system.sh /tmp/init_system.sh
209+
COPY devops/sandbox/configs/90-cbdb-limits.conf /etc/security/limits.d/90-cbdb-limits.conf
210+
COPY devops/sandbox/configs/90-cbdb-sysctl.conf /etc/sysctl.d/90-cbdb-sysctl.conf
211+
COPY devops/sandbox/configs/gpinitsystem_singlenode /tmp/gpinitsystem_singlenode
212+
COPY devops/sandbox/configs/gpinitsystem_multinode /tmp/gpinitsystem_multinode
213+
COPY devops/sandbox/configs/multinode-gpinit-hosts /tmp/multinode-gpinit-hosts
214+
COPY devops/sandbox/configs/init_system.sh /tmp/init_system.sh
197215

198216
# Runtime configuration
199217
RUN echo "cdw" > /tmp/gpdb-hosts && \

devops/sandbox/README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ When building and deploying Apache Cloudberry in Docker, you will have 2 differe
5454

5555
**Build Options**
5656

57-
1. Compile with the source code of the latest Apache Cloudberry (released in [Apache Cloudberry Release Page](https://github.com/apache/cloudberry/releases)). The base OS will be Rocky Linux 9 Docker image.
58-
2. Method 2 - Compile with the latest Apache Cloudberry [main](https://github.com/apache/cloudberry/tree/main) branch. The base OS will be Rocky Linux 9 Docker image.
57+
1. **Recommended for most users** – Build directly from your current local source code using `-c local`. This is the fastest way to get started as it reuses your existing checkout, avoiding the need to download the code again inside the container. It is also ideal for developers testing local changes.
58+
2. Compile with the source code of the latest Apache Cloudberry (released in [Apache Cloudberry Release Page](https://github.com/apache/cloudberry/releases)). The base OS will be Rocky Linux 9 Docker image.
59+
3. Compile with the latest Apache Cloudberry [main](https://github.com/apache/cloudberry/tree/main) branch. The base OS will be Rocky Linux 9 Docker image.
5960

6061
Build and deploy steps:
6162

@@ -69,18 +70,38 @@ Build and deploy steps:
6970

7071
3. Enter the repository and run the `run.sh` script to start the Docker container. This will start the automatic installation process. Depending on your environment, you may need to run this with 'sudo' command.
7172

73+
- **Recommended: Build from your current local source code (single container)**
74+
75+
This is the most efficient option for both new users and developers. It uses your local checkout directly, saving time by skipping the code download step inside the container. It also allows you to immediately test any local code modifications.
76+
77+
```shell
78+
cd cloudberry/devops/sandbox
79+
./run.sh -c local
80+
```
81+
82+
- **Recommended: Build from your current local source code (multi-container)**
83+
84+
Same as above, but deploys a multi-container cluster. Ideal for testing distributed features or high availability with your local code.
85+
86+
```shell
87+
cd cloudberry/devops/sandbox
88+
./run.sh -c local -m
89+
```
90+
7291
- For latest Apache Cloudberry release running on a single container
7392

7493
```shell
7594
cd cloudberry/devops/sandbox
7695
./run.sh -c 2.0.0
7796
```
97+
7898
- For latest Apache Cloudberry release running across multiple containers
7999

80100
```shell
81101
cd cloudberry/devops/sandbox
82102
./run.sh -c 2.0.0 -m
83103
```
104+
84105
- For latest main branch running on a single container
85106

86107
```shell

devops/sandbox/run.sh

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PIP_INDEX_URL_VAR="${PIP_INDEX_URL_VAR:-$DEFAULT_PIP_INDEX_URL_VAR}"
3838
# Function to display help message
3939
function usage() {
4040
echo "Usage: $0 [-o <os_version>] [-c <codebase_version>] [-b] [-m]"
41-
echo " -c Codebase version (valid values: main, or other available version like 2.0.0)"
41+
echo " -c Codebase version (valid values: main, local, or other available version like 2.0.0)"
4242
echo " -t Timezone (default: America/Los_Angeles, or set via TIMEZONE_VAR environment variable)"
4343
echo " -p Python Package Index (PyPI) (default: https://pypi.org/simple, or set via PIP_INDEX_URL_VAR environment variable)"
4444
echo " -b Build only, do not run the container (default: false, or set via BUILD_ONLY environment variable)"
@@ -101,26 +101,50 @@ case "${OS_VERSION}" in
101101
esac
102102

103103
# Validate CODEBASE_VERSION
104-
if [[ "${CODEBASE_VERSION}" != "main" && ! "${CODEBASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
104+
if [[ "${CODEBASE_VERSION}" != "main" && "${CODEBASE_VERSION}" != "local" && ! "${CODEBASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
105105
echo "Invalid codebase version: ${CODEBASE_VERSION}"
106106
usage
107107
fi
108108

109+
# Determine sandbox directory and repository root
110+
SANDBOX_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
111+
REPO_ROOT="$(cd "${SANDBOX_DIR}/../.." && pwd)"
112+
113+
# Ensure submodules are initialized for local builds
114+
if [[ "${CODEBASE_VERSION}" = "local" ]]; then
115+
if [[ -d "${REPO_ROOT}/.git" ]] && command -v git >/dev/null 2>&1; then
116+
# Check if any submodules are uninitialized (-), out of sync (+), or have conflicts (U)
117+
if (cd "${REPO_ROOT}" && git submodule status --recursive | grep -qE "^[+-U]"); then
118+
echo "Updating git submodules for local build..."
119+
(cd "${REPO_ROOT}" && git submodule update --init --recursive)
120+
else
121+
echo "Git submodules are already up to date. Skipping update."
122+
fi
123+
else
124+
echo "Warning: Skipping 'git submodule update --init --recursive' for local build because either '.git' directory or 'git' command is missing in ${REPO_ROOT}."
125+
echo "If your Cloudberry checkout relies on git submodules, please ensure they have been populated before running with '-c local'."
126+
fi
127+
fi
128+
129+
109130
# Build image
110-
if [[ "${CODEBASE_VERSION}" = "main" ]]; then
111-
DOCKERFILE=Dockerfile.${CODEBASE_VERSION}.${OS_VERSION}
131+
if [[ "${CODEBASE_VERSION}" = "main" || "${CODEBASE_VERSION}" = "local" ]]; then
132+
DOCKERFILE="${SANDBOX_DIR}/Dockerfile.main.${OS_VERSION}"
112133

113-
# Single image build
134+
# Single image build from main or local source
114135
docker build --file ${DOCKERFILE} \
115136
--build-arg TIMEZONE_VAR="${TIMEZONE_VAR}" \
116-
--tag cbdb-${CODEBASE_VERSION}:${OS_VERSION} .
137+
--build-arg CODEBASE_VERSION="${CODEBASE_VERSION}" \
138+
--tag cbdb-${CODEBASE_VERSION}:${OS_VERSION} \
139+
${REPO_ROOT}
117140
else
118-
DOCKERFILE=Dockerfile.RELEASE.${OS_VERSION}
141+
DOCKERFILE="${SANDBOX_DIR}/Dockerfile.RELEASE.${OS_VERSION}"
119142

120143
docker build --file ${DOCKERFILE} \
121144
--build-arg TIMEZONE_VAR="${TIMEZONE_VAR}" \
122145
--build-arg CODEBASE_VERSION_VAR="${CODEBASE_VERSION}" \
123-
--tag cbdb-${CODEBASE_VERSION}:${OS_VERSION} .
146+
--tag cbdb-${CODEBASE_VERSION}:${OS_VERSION} \
147+
${SANDBOX_DIR}
124148
fi
125149

126150
# Check if build only flag is set

src/backend/utils/init/postinit.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,8 +1267,14 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
12671267
* Primary function is to establish connections to the qExecs.
12681268
* This is SKIPPED when the database is in bootstrap mode or
12691269
* Is not UnderPostmaster.
1270+
*
1271+
* Also skip for auxiliary background workers (e.g., ftsprobe, global
1272+
* deadlock detector, dtx recovery, sweeper, pg_cron launcher). These
1273+
* processes don't require interconnect for data exchange and opening
1274+
* unnecessary network sockets may be considered a security issue.
12701275
*/
1271-
if (!bootstrap && IsUnderPostmaster && !IsLoginMonitorWorkerProcess())
1276+
if (!bootstrap && IsUnderPostmaster && !IsLoginMonitorWorkerProcess() &&
1277+
!amAuxiliaryBgWorker())
12721278
{
12731279
cdb_setup();
12741280
on_proc_exit( cdb_cleanup, 0 );

0 commit comments

Comments
 (0)