Skip to content

Commit ed2f38a

Browse files
committed
enable orioledb rewind gucs
1 parent 13fb638 commit ed2f38a

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

Dockerfile-orioledb-17

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,16 @@ RUN sed -i \
189189
RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf"
190190
#as of pg 16.4 + this db_user_namespace totally deprecated and will break the server if setting is present
191191
RUN sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf"
192-
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/supautils.conf"
193-
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf"
194-
RUN echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"
192+
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/supautils.conf"
193+
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf"
194+
RUN echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"
195+
196+
# OrioleDB rewind configuration
197+
# Enables time-based rewind capability for up to 20 minutes (1200 seconds)
198+
RUN echo "orioledb.enable_rewind = true" >> "/etc/postgresql/postgresql.conf" && \
199+
echo "orioledb.rewind_max_time = 1200" >> "/etc/postgresql/postgresql.conf" && \
200+
echo "orioledb.rewind_max_transactions = 100000" >> "/etc/postgresql/postgresql.conf" && \
201+
echo "orioledb.rewind_buffers = 13" >> "/etc/postgresql/postgresql.conf"
195202

196203

197204

ansible/tasks/stage2-setup-postgres.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,39 @@
5757
state: present
5858
when: is_psql_oriole and stage2_nix
5959
become: yes
60-
60+
61+
- name: Enable OrioleDB rewind feature
62+
ansible.builtin.lineinfile:
63+
path: /etc/postgresql/postgresql.conf
64+
line: "orioledb.enable_rewind = true"
65+
state: present
66+
when: is_psql_oriole and stage2_nix
67+
become: yes
68+
69+
- name: Set OrioleDB rewind max time (20 minutes)
70+
ansible.builtin.lineinfile:
71+
path: /etc/postgresql/postgresql.conf
72+
line: "orioledb.rewind_max_time = 1200"
73+
state: present
74+
when: is_psql_oriole and stage2_nix
75+
become: yes
76+
77+
- name: Set OrioleDB rewind max transactions
78+
ansible.builtin.lineinfile:
79+
path: /etc/postgresql/postgresql.conf
80+
line: "orioledb.rewind_max_transactions = 100000"
81+
state: present
82+
when: is_psql_oriole and stage2_nix
83+
become: yes
84+
85+
- name: Set OrioleDB rewind buffers
86+
ansible.builtin.lineinfile:
87+
path: /etc/postgresql/postgresql.conf
88+
line: "orioledb.rewind_buffers = 13"
89+
state: present
90+
when: is_psql_oriole and stage2_nix
91+
become: yes
92+
6193
- name: Add ORIOLEDB_ENABLED environment variable
6294
ansible.builtin.lineinfile:
6395
path: /etc/environment

nix/tools/run-server.sh.in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ orioledb_config_items() {
248248
sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ pgjwt,//g;' "$DATDIR/supautils.conf"
249249
sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "$DATDIR/postgresql.conf"
250250
echo "default_table_access_method = 'orioledb'" >> "$DATDIR/postgresql.conf"
251+
# OrioleDB rewind configuration (20 minute window)
252+
echo "orioledb.enable_rewind = true" >> "$DATDIR/postgresql.conf"
253+
echo "orioledb.rewind_max_time = 1200" >> "$DATDIR/postgresql.conf"
254+
echo "orioledb.rewind_max_transactions = 100000" >> "$DATDIR/postgresql.conf"
255+
echo "orioledb.rewind_buffers = 13" >> "$DATDIR/postgresql.conf"
251256
elif [[ "$1" = "orioledb-17" && "$CURRENT_SYSTEM" = "aarch64-darwin" ]]; then
252257
# macOS specific configuration
253258
echo "macOS detected, applying macOS specific configuration"
@@ -261,8 +266,13 @@ orioledb_config_items() {
261266
perl -pi -e 's/ plv8,//g' "$DATDIR/supautils.conf"
262267
perl -pi -e 's/ pgjwt,//g' "$DATDIR/supautils.conf"
263268
perl -pi -e 's/(shared_preload_libraries\s*=\s*'\''.*?)'\''/\1, orioledb'\''/' "$DATDIR/postgresql.conf"
264-
269+
265270
echo "default_table_access_method = 'orioledb'" >> "$DATDIR/postgresql.conf"
271+
# OrioleDB rewind configuration (20 minute window)
272+
echo "orioledb.enable_rewind = true" >> "$DATDIR/postgresql.conf"
273+
echo "orioledb.rewind_max_time = 1200" >> "$DATDIR/postgresql.conf"
274+
echo "orioledb.rewind_max_transactions = 100000" >> "$DATDIR/postgresql.conf"
275+
echo "orioledb.rewind_buffers = 13" >> "$DATDIR/postgresql.conf"
266276
elif [[ "$VERSION" == "17" && "$CURRENT_SYSTEM" != "aarch64-darwin" ]]; then
267277
echo "non-macos pg 17 conf"
268278
sed -i 's/ timescaledb,//g;' "$DATDIR/postgresql.conf"

0 commit comments

Comments
 (0)