Skip to content

Commit 4738938

Browse files
committed
ivorysql compatible with documentdb
1 parent fdcbbe3 commit 4738938

13 files changed

Lines changed: 97 additions & 102 deletions

.devcontainer/Dockerfile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
FROM mcr.microsoft.com/mirror/docker/library/ubuntu:22.04
22
ARG POSTGRES_INSTALL_ARG=
3-
ARG PG_VERSION=16
3+
ARG IVORY_VERSION=4
44
ARG CITUS_VERSION=12
55

66
# declare installed PG version and Citus version
7-
ENV PG_VERSION=${PG_VERSION}
7+
ENV IVORY_VERSION=${IVORY_VERSION}
88
ENV CITUS_VERSION=${CITUS_VERSION}
99

1010
# Install build essentials - Compiler, debugger, make, etc.
@@ -35,6 +35,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
3535
libtool \
3636
libicu-dev \
3737
libssl-dev \
38+
libxml2-dev \
3839
&& rm -rf /var/lib/apt/lists/*
3940

4041
# Add pgdg repo
@@ -60,27 +61,27 @@ COPY scripts/utils.sh /tmp/install_setup/
6061

6162
# Install postgres
6263
COPY scripts/install_setup_postgres.sh /tmp/install_setup/
63-
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_postgres.sh -d \"/usr/lib/postgresql/${PG_VERSION}\" $POSTGRES_INSTALL_ARG -v ${PG_VERSION}" ]
64+
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_postgres.sh -d \"/var/local/ivorysql/ivory-${IVORY_VERSION}\" $POSTGRES_INSTALL_ARG -v ${IVORY_VERSION}" ]
6465

6566
# Install RUM from source
6667
COPY scripts/install_setup_rum_oss.sh /tmp/install_setup/
67-
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_rum_oss.sh" ]
68+
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_rum_oss.sh" ]
6869

6970
# Install citus
7071
COPY scripts/install_setup_citus_core_oss.sh /tmp/install_setup/
71-
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_citus_core_oss.sh ${CITUS_VERSION}" ]
72+
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_citus_core_oss.sh ${CITUS_VERSION}" ]
7273

7374
# Install citus-indent
7475
COPY scripts/install_citus_indent.sh /tmp/install_setup/
7576
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_citus_indent.sh" ]
7677

7778
# Install SYSTEM_ROWS
7879
COPY scripts/install_setup_system_rows.sh /tmp/install_setup/
79-
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_system_rows.sh" ]
80+
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_system_rows.sh" ]
8081

8182
# Install PG_CRON
8283
COPY scripts/install_setup_pg_cron.sh /tmp/install_setup/
83-
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_pg_cron.sh" ]
84+
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_pg_cron.sh" ]
8485

8586
# Download Decimal128 Intel library
8687
COPY scripts/install_setup_intel_decimal_math_lib.sh /tmp/install_setup/
@@ -92,7 +93,7 @@ RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_pcre2.sh" ]
9293

9394
# Install PG_VECTOR
9495
COPY scripts/install_setup_pgvector.sh /tmp/install_setup/
95-
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_pgvector.sh" ]
96+
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_pgvector.sh" ]
9697

9798
# Install PostGIS from source
9899
RUN apt-get update && \
@@ -105,7 +106,7 @@ RUN apt-get update && \
105106
&& rm -rf /var/lib/apt/lists/*
106107

107108
COPY scripts/install_setup_postgis.sh /tmp/install_setup/
108-
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_postgis.sh" ]
109+
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_postgis.sh" ]
109110

110111
# locale
111112
RUN rm -rf /var/lib/apt/lists/* \
@@ -121,10 +122,10 @@ RUN echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/no-pass-ask
121122

122123
# Add postgres to path for sudo commands.
123124
# Add path for sudoers
124-
RUN cat /etc/sudoers | grep secure_path | sed "s/\:\/bin\:/\:\/bin\:\/usr\/lib\/postgresql\/$PG_VERSION\/bin\:/" >> /etc/sudoers.d/postgres_path
125+
RUN cat /etc/sudoers | grep secure_path | sed "s/\:\/bin\:/\:\/bin\:\/var\/local\/ivorysql\/ivory-$IVORY_VERSION\/bin\:/" >> /etc/sudoers.d/postgres_path
125126

126127
# Add PG to the path
127-
ENV PATH=$PATH:/usr/lib/postgresql/$PG_VERSION/bin
128+
ENV PATH=$PATH:/var/local/ivorysql/ivory-$IVORY_VERSION/bin
128129

129130
USER documentdb
130131
WORKDIR /home/documentdb

scripts/build_and_start_gateway.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,21 @@ while [[ -L $source ]]; do
8484
done
8585
scriptDir="$(cd -P "$(dirname "$source")" && pwd)"
8686

87-
# Check if PostgreSQL is running with a timeout of 10 minutes
87+
# Check if IvorySQL is running with a timeout of 10 minutes
8888
timeout=600
8989
interval=5
9090
elapsed=0
9191

92-
echo "Waiting for PostgreSQL to be ready on $hostname:$port..."
92+
echo "Waiting for IvorySQL to be ready on $hostname:$port..."
9393
while ! pg_isready -h "$hostname" -p "$port" > /dev/null 2>&1; do
9494
if [ "$elapsed" -ge "$timeout" ]; then
95-
echo "PostgreSQL did not become ready within 10 minutes. Exiting."
95+
echo "IvorySQL did not become ready within 10 minutes. Exiting."
9696
exit 1
9797
fi
9898
sleep "$interval"
9999
elapsed=$((elapsed + interval))
100100
done
101-
echo "PostgreSQL is ready."
101+
echo "IvorySQL is ready."
102102

103103
if [ "$clean" = "true" ]; then
104104
echo "Cleaning the build directory..."

scripts/generate_extension_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if [ -f $gitIndexDir ]; then
3333
else
3434
# set GIT_VERSION with current branch's name and the short sha of the HEAD
3535
GIT_VERSION=$(git rev-parse --abbrev-ref HEAD)
36-
GIT_SHA=$(git rev-parse --short HEAD)
36+
GIT_SHA=$(git rev-parse --short=10 HEAD)
3737
fi
3838

3939
if [[ "$GIT_VERSION" == "" ]] || [[ "$GIT_SHA" == "" ]]; then

scripts/install_setup_citus_core_oss.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
2222
CITUS_REF=$(GetCitusVersion $citusVersion)
2323

2424
. $scriptDir/utils.sh
25-
if [ "${PGVERSION:-}" != "" ]; then
26-
pgPath=$(GetPostgresPath $PGVERSION)
25+
if [ "${IVORYVERSION:-}" != "" ]; then
26+
pgPath=$(GetPostgresPath $IVORYVERSION)
2727
PATH=$pgPath:$PATH
2828
fi
2929

scripts/install_setup_pg_cron.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
2020
CITUS_PG_CRON_REF=$(GetPgCronVersion)
2121

2222
. $scriptDir/utils.sh
23-
pgBinDir=$(GetPostgresPath $PGVERSION)
23+
pgBinDir=$(GetPostgresPath $IVORYVERSION)
2424
PATH=$pgBinDir:$PATH;
2525

2626
pushd $INSTALL_DEPENDENCIES_ROOT

scripts/install_setup_pgvector.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
1818
echo "scriptDir: $scriptDir"
1919

2020
. $scriptDir/utils.sh
21-
pgBinDir=$(GetPostgresPath $PGVERSION)
21+
pgBinDir=$(GetPostgresPath $IVORYVERSION)
2222
PATH=$pgBinDir:$PATH;
2323

2424
. $scriptDir/setup_versions.sh

scripts/install_setup_postgis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
2727
POSTGIS_REF=$(GetPostgisVersion)
2828

2929
. $scriptDir/utils.sh
30-
pgBinDir=$(GetPostgresPath $PGVERSION)
30+
pgBinDir=$(GetPostgresPath $IVORYVERSION)
3131

3232
POSTGIS_REPO=postgis-repo
3333
rm -rf $POSTGIS_REPO

scripts/install_setup_postgres.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ set -e
55
# fail if trying to reference a variable that is not set.
66
set -u
77

8-
postgresqlInstallDir=""
8+
ivorysqlInstallDir=""
99
debug="false"
1010
cassert="false"
1111
help="false";
12-
pgVersion=""
12+
ivyVersion=""
1313
while getopts "d:hxcv:" opt; do
1414
case $opt in
15-
d) postgresqlInstallDir="$OPTARG"
15+
d) ivorysqlInstallDir="$OPTARG"
1616
;;
1717
x) debug="true"
1818
;;
1919
c) cassert="true"
2020
;;
2121
h) help="true"
2222
;;
23-
v) pgVersion="$OPTARG"
23+
v) ivyVersion="$OPTARG"
2424
;;
2525
esac
2626

@@ -34,18 +34,18 @@ while getopts "d:hxcv:" opt; do
3434
done
3535

3636
if [ "$help" == "true" ]; then
37-
echo "downloads postgresql-14.2 sources, build and install it."
38-
echo "[-d] the directory to install postgresql to. Default: /usr/lib/postgresql/14"
37+
echo "downloads IvorySQL-14.2 sources, build and install it."
38+
echo "[-d] the directory to install IvorySQL to. Default: /usr/lib/IvorySQL/14"
3939
echo "[-x] build with debug symbols."
4040
exit 1;
4141
fi
4242

43-
if [ -z $postgresqlInstallDir ]; then
43+
if [ -z $ivorysqlInstallDir ]; then
4444
echo "Postgres Install Directory must be specified."
4545
exit 1;
4646
fi
4747

48-
if [ -z $pgVersion ]; then
48+
if [ -z $ivyVersion ]; then
4949
echo "PG Version must be specified";
5050
exit 1;
5151
fi
@@ -62,29 +62,29 @@ done
6262
scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
6363

6464
. $scriptDir/setup_versions.sh
65-
POSTGRESQL_REF=$(GetPostgresSourceRef $pgVersion)
65+
IvorySQL_REF=$(GetPostgresSourceRef $ivyVersion)
6666

6767
pushd $INSTALL_DEPENDENCIES_ROOT
6868

69-
rm -rf postgres-repo/$pgVersion
70-
mkdir -p postgres-repo/$pgVersion
71-
cd postgres-repo/$pgVersion
69+
rm -rf postgres-repo/$ivyVersion
70+
mkdir -p postgres-repo/$ivyVersion
71+
cd postgres-repo/$ivyVersion
7272

7373
git init
74-
git remote add origin https://github.com/postgres/postgres
74+
git remote add origin https://github.com/IvorySQL/IvorySQL
7575

7676
# checkout to the commit specified in the cgmanifest.json
77-
git fetch --depth 1 origin "$POSTGRESQL_REF"
77+
git fetch --depth 1 origin "$IvorySQL_REF"
7878
git checkout FETCH_HEAD
7979

80-
echo "building and installing postgresql ref $POSTGRESQL_REF and installing to $postgresqlInstallDir..."
80+
echo "building and installing IvorySQL ref $IvorySQL_REF and installing to $ivorysqlInstallDir..."
8181

8282
if [ "$debug" == "true" ]; then
83-
./configure --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer" --with-openssl --prefix="$postgresqlInstallDir" --with-icu
83+
./configure --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer" --with-openssl --prefix="$ivorysqlInstallDir" --with-icu
8484
elif [ "$cassert" == "true" ]; then
85-
./configure --enable-debug --enable-cassert --enable-tap-tests --with-openssl --prefix="$postgresqlInstallDir" --with-icu
85+
./configure --enable-debug --enable-cassert --enable-tap-tests --with-openssl --prefix="$ivorysqlInstallDir" --with-icu
8686
else
87-
./configure --enable-debug --enable-tap-tests --with-openssl --prefix="$postgresqlInstallDir" --with-icu
87+
./configure --enable-debug --enable-tap-tests --with-openssl --prefix="$ivorysqlInstallDir" --with-icu
8888
fi
8989

9090
make clean && make -sj$(cat /proc/cpuinfo | grep -c "processor") install

scripts/install_setup_rum_oss.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ echo "scriptDir: $scriptDir"
2121
RUM_REF=$(GetRumVersion)
2222

2323
. $scriptDir/utils.sh
24-
if [ "${PGVERSION:-}" != "" ]; then
25-
pgPath=$(GetPostgresPath $PGVERSION)
24+
if [ "${IVORYVERSION:-}" != "" ]; then
25+
pgPath=$(GetPostgresPath $IVORYVERSION)
2626
PATH=$pgPath:$PATH
2727
fi
2828

scripts/install_setup_system_rows.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ done
1717
scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
1818
. $scriptDir/utils.sh
1919
. $scriptDir/setup_versions.sh
20-
POSTGRESQL_REF=$(GetPostgresSourceRef $PGVERSION)
20+
POSTGRESQL_REF=$(GetPostgresSourceRef $IVORYVERSION)
2121

2222
pushd $INSTALL_DEPENDENCIES_ROOT
2323

@@ -26,13 +26,13 @@ mkdir postgres-repo-for-system-rows
2626
cd postgres-repo-for-system-rows
2727

2828
git init
29-
git remote add origin https://github.com/postgres/postgres
29+
git remote add origin https://github.com/IvorySQL/IvorySQL
3030

3131
# checkout to the commit specified in the cgmanifest.json
3232
git fetch --depth 1 origin "$POSTGRESQL_REF"
3333
git checkout FETCH_HEAD
3434

35-
pgBinDir=$(GetPostgresPath $PGVERSION)
35+
pgBinDir=$(GetPostgresPath $IVORYVERSION)
3636
PATH=$pgBinDir:$PATH;
3737

3838
echo "building and installing tsm_system_rows extension with pg path $pgBinDir ..."

0 commit comments

Comments
 (0)