Skip to content
Merged
8 changes: 0 additions & 8 deletions Dockerfile-orioledb-17
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,6 @@ RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf" && \
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf" && \
echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"

# OrioleDB rewind configuration
# Enables time-based rewind capability for up to 20 minutes (1200 seconds)
# Buffer size: 1280 buffers * 8KB = 10MB for transaction retention
RUN echo "orioledb.enable_rewind = true" >> "/etc/postgresql/postgresql.conf" && \
echo "orioledb.rewind_max_time = 1200" >> "/etc/postgresql/postgresql.conf" && \
echo "orioledb.rewind_max_transactions = 100000" >> "/etc/postgresql/postgresql.conf" && \
echo "orioledb.rewind_buffers = 1280" >> "/etc/postgresql/postgresql.conf"

# Include schema migrations
COPY migrations/db /docker-entrypoint-initdb.d/
COPY ansible/files/pgbouncer_config/pgbouncer_auth_schema.sql /docker-entrypoint-initdb.d/init-scripts/00-schema.sql
Expand Down
32 changes: 0 additions & 32 deletions ansible/tasks/stage2-setup-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,6 @@
path: '/etc/postgresql/postgresql.conf'
state: 'present'

- name: Enable OrioleDB rewind feature
ansible.builtin.lineinfile:
path: /etc/postgresql/postgresql.conf
line: "orioledb.enable_rewind = true"
state: present
when: is_psql_oriole and stage2_nix
become: yes

- name: Set OrioleDB rewind max time (20 minutes)
ansible.builtin.lineinfile:
path: /etc/postgresql/postgresql.conf
line: "orioledb.rewind_max_time = 1200"
state: present
when: is_psql_oriole and stage2_nix
become: yes

- name: Set OrioleDB rewind max transactions
ansible.builtin.lineinfile:
path: /etc/postgresql/postgresql.conf
line: "orioledb.rewind_max_transactions = 100000"
state: present
when: is_psql_oriole and stage2_nix
become: yes

- name: Set OrioleDB rewind buffers (1280 buffers = 10MB)
ansible.builtin.lineinfile:
path: /etc/postgresql/postgresql.conf
line: "orioledb.rewind_buffers = 1280"
state: present
when: is_psql_oriole and stage2_nix
become: yes

- name: Add ORIOLEDB_ENABLED environment variable
ansible.builtin.lineinfile:
line: 'ORIOLEDB_ENABLED=true'
Expand Down
6 changes: 3 additions & 3 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.6.0.043-orioledb"
postgres17: "17.6.1.086"
postgres15: "15.14.1.086"
postgresorioledb-17: "17.6.0.044-orioledb"
postgres17: "17.6.1.087"
postgres15: "15.14.1.087"

# Non Postgres Extensions
pgbouncer_release: 1.25.1
Expand Down
4 changes: 2 additions & 2 deletions nix/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ in
};
orioledb = {
"17" = {
version = "17_15";
hash = "sha256-1v3FGIN0UW+E4ilLwbsV3nXvef3n9O8bVmgyjRFEJsU=";
version = "17_16";
hash = "sha256-Xm9IUsvmlcayNQH8TCvHoIV23xkt/WQV0Oy4CiJkywc=";
};
};
};
Expand Down
8 changes: 4 additions & 4 deletions nix/ext/orioledb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "orioledb";
repo = "orioledb";
rev = "beta13";
sha256 = "sha256-80RQHOgkEC7Hq3+N1VhsuKEUL+SNT/WfDN5vmXpaQG4=";
rev = "982e11ae62c9e00c0d74f9f8de31d99ff383fd02";
sha256 = "sha256-Vz3vfmTGRW+O9aXZxqixHC2CpqZJf/1UCQWoENbAak4=";
};
version = "beta13";
version = "982e11ae62c9e00c0d74f9f8de31d99ff383fd02";
buildInputs = [
curl
libkrb5
Expand All @@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
openssl
];
buildPhase = ''
make USE_PGXS=1 ORIOLEDB_PATCHSET_VERSION=15
make USE_PGXS=1 ORIOLEDB_PATCHSET_VERSION=16
'';
installPhase = ''
runHook preInstall
Expand Down
73 changes: 40 additions & 33 deletions nix/ext/tests/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ let
# OrioleDB: append orioledb to shared_preload_libraries
sed -i "s/\(shared_preload_libraries.*\)'\(.*\)$/\1, orioledb'\2/" $out/postgresql.conf
echo "default_table_access_method = 'orioledb'" >> $out/postgresql.conf
echo "orioledb.enable_rewind = true" >> $out/postgresql.conf
echo "orioledb.rewind_max_time = 1200" >> $out/postgresql.conf
echo "orioledb.rewind_max_transactions = 100000" >> $out/postgresql.conf
echo "orioledb.rewind_buffers = 1280" >> $out/postgresql.conf
''
else
""
Expand Down Expand Up @@ -417,6 +413,7 @@ let
makeOrioledbSpecialisation =
{
postgresPort ? defaultPort,
extraConfig ? "",
}:
let
orioledbPkg = self.packages.${system}."psql_orioledb-17/bin";
Expand Down Expand Up @@ -446,35 +443,42 @@ let

# Runs as postgres: initdb with OrioleDB-specific args, config deployment, validation
initScript = pkgs.pkgsLinux.writeShellScript "postgresql-orioledb-init" ''
set -euo pipefail
DATA_DIR="${newDataDir}"

if [ ! -f "$DATA_DIR/PG_VERSION" ]; then
echo "Initializing OrioleDB database at $DATA_DIR"
${orioledbPkg}/bin/initdb \
--allow-group-access --data-checksums \
--locale-provider=icu --encoding=UTF-8 --icu-locale=en_US.UTF-8 \
-U supabase_admin -D "$DATA_DIR"
fi

# Deploy processed config files with @dataDir@ substituted
for f in postgresql.conf pg_hba.conf pg_ident.conf supautils.conf read-replica.conf; do
sed "s|@dataDir@|$DATA_DIR|g" ${processedConfig}/$f > "$DATA_DIR/$f"
done

# Copy conf.d directory
rm -rf "$DATA_DIR/conf.d"
cp -r ${processedConfig}/conf.d "$DATA_DIR/conf.d"
chmod -R u+w "$DATA_DIR/conf.d"

# Copy extension-custom-scripts directory
rm -rf "$DATA_DIR/extension-custom-scripts"
cp -r ${processedConfig}/extension-custom-scripts "$DATA_DIR/extension-custom-scripts"
chmod -R u+w "$DATA_DIR/extension-custom-scripts"

# Validate config
echo "Validating PostgreSQL configuration..."
${orioledbPkg}/bin/postgres -C shared_preload_libraries -D "$DATA_DIR"
set -euo pipefail
DATA_DIR="${newDataDir}"

if [ ! -f "$DATA_DIR/PG_VERSION" ]; then
echo "Initializing OrioleDB database at $DATA_DIR"
${orioledbPkg}/bin/initdb \
--allow-group-access --data-checksums \
--locale-provider=icu --encoding=UTF-8 --icu-locale=en_US.UTF-8 \
-U supabase_admin -D "$DATA_DIR"
fi

# Deploy processed config files with @dataDir@ substituted
for f in postgresql.conf pg_hba.conf pg_ident.conf supautils.conf read-replica.conf; do
sed "s|@dataDir@|$DATA_DIR|g" ${processedConfig}/$f > "$DATA_DIR/$f"
done

# Append any extra configuration
if [ -n '${extraConfig}' ]; then
cat >> "$DATA_DIR/postgresql.conf" << 'EXTRA_CONFIG_EOF'
${extraConfig}
EXTRA_CONFIG_EOF
fi

# Copy conf.d directory
rm -rf "$DATA_DIR/conf.d"
cp -r ${processedConfig}/conf.d "$DATA_DIR/conf.d"
chmod -R u+w "$DATA_DIR/conf.d"

# Copy extension-custom-scripts directory
rm -rf "$DATA_DIR/extension-custom-scripts"
cp -r ${processedConfig}/extension-custom-scripts "$DATA_DIR/extension-custom-scripts"
chmod -R u+w "$DATA_DIR/extension-custom-scripts"

# Validate config
echo "Validating PostgreSQL configuration..."
${orioledbPkg}/bin/postgres -C shared_preload_libraries -D "$DATA_DIR"
'';

# Full db init: CREATE EXTENSION orioledb first, then init-scripts + migrations
Expand Down Expand Up @@ -549,6 +553,7 @@ let
};

# Override postgresql: new package, new data dir, new ExecStartPre for orioledb initdb
# Restart settings match production: ansible/files/postgresql_config/postgresql.service
systemd.services.postgresql = {
after = [ "postgresql-migrate.service" ];
requires = [ "postgresql-migrate.service" ];
Expand All @@ -558,6 +563,8 @@ let
initScript
];
ExecStart = lib.mkForce "${orioledbPkg}/bin/postgres -D ${newDataDir}";
Restart = "always";
RestartSec = "5";
};
environment = {
GRN_PLUGINS_DIR = lib.mkForce "${groongaPackage}/lib/groonga/plugins";
Expand Down
Loading
Loading