Skip to content

Commit 9b2ea4e

Browse files
balasankarcdustinmm80
andcommitted
Merge branch 'add-postgres-14' into 'master'
Add PostgreSQL 14 builds Closes #7702 See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/6811 Merged-by: Balasankar 'Balu' C <[email protected]> Approved-by: Clemens Beck <[email protected]> Approved-by: Balasankar 'Balu' C <[email protected]> Reviewed-by: Clemens Beck <[email protected]> Co-authored-by: dustinmm80 <[email protected]>
2 parents d7106ff + 5cae179 commit 9b2ea4e

File tree

8 files changed

+106
-8
lines changed

8 files changed

+106
-8
lines changed

config/software/postgresql.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
end
3636

3737
major_version = '13'
38-
libpq = 'libpq.so.5'
3938

4039
source url: "https://ftp.postgresql.org/pub/source/v#{version}/postgresql-#{version}.tar.bz2"
4140

@@ -60,8 +59,6 @@
6059
make "world -j #{workers}", env: env
6160
make 'install-world', env: env
6261

63-
link "#{prefix}/lib/#{libpq}", "#{install_dir}/embedded/lib/#{libpq}"
64-
6562
# NOTE: There are several dependencies which require these files in these
6663
# locations and have dependency on `postgresql_new`. So when this block is
6764
# changed to be in the `postgresql` software definition for default PG

config/software/postgresql_new.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#
2+
# Copyright 2012-2014 Chef Software, Inc.
3+
# Copyright:: Copyright (c) 2016 GitLab Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name 'postgresql_new'
19+
default_version '14.8'
20+
21+
license 'PostgreSQL'
22+
license_file 'COPYRIGHT'
23+
24+
skip_transitive_dependency_licensing true
25+
26+
dependency 'zlib'
27+
dependency 'openssl' unless Build::Check.use_system_ssl?
28+
dependency 'libedit'
29+
dependency 'ncurses'
30+
dependency 'libossp-uuid'
31+
dependency 'config_guess'
32+
33+
version '14.8' do
34+
source sha256: '39d38f0030737ed03835debeefee3b37d335462ce4995e2497bc38d621ebe45a'
35+
end
36+
37+
major_version = '14'
38+
libpq = 'libpq.so.5'
39+
40+
source url: "https://ftp.postgresql.org/pub/source/v#{version}/postgresql-#{version}.tar.bz2"
41+
42+
relative_path "postgresql-#{version}"
43+
44+
build do
45+
env = with_standard_compiler_flags(with_embedded_path)
46+
47+
env['CFLAGS'] << ' -fno-omit-frame-pointer'
48+
49+
prefix = "#{install_dir}/embedded/postgresql/#{major_version}"
50+
update_config_guess(target: 'config')
51+
52+
patch source: 'no_docs.patch', target: 'GNUmakefile.in'
53+
54+
command './configure' \
55+
" --prefix=#{prefix}" \
56+
' --with-libedit-preferred' \
57+
' --with-openssl' \
58+
' --with-uuid=ossp', env: env
59+
60+
make "world -j #{workers}", env: env
61+
make 'install-world', env: env
62+
63+
link "#{prefix}/lib/#{libpq}", "#{install_dir}/embedded/lib/#{libpq}"
64+
end
65+
66+
# exclude headers and static libraries from package
67+
project.exclude "embedded/postgresql/#{major_version}/include"
68+
project.exclude "embedded/postgresql/#{major_version}/lib/*.a"
69+
project.exclude "embedded/postgresql/#{major_version}/lib/pgxs"
70+
project.exclude "embedded/postgresql/#{major_version}/lib/pkgconfig"

config/software/psycopg2.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
source git: version.remote
2828

2929
dependency 'python3'
30-
dependency 'postgresql'
30+
dependency 'postgresql_new'
3131

32-
pg_major_version = '13'
32+
pg_major_version = '14'
3333

3434
build do
3535
env = with_standard_compiler_flags(with_embedded_path)

doc/settings/database.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,19 @@ To opt out of automatic PostgreSQL upgrades during GitLab package upgrades, run:
535535
sudo touch /etc/gitlab/disable-postgresql-upgrade
536536
```
537537
538+
#### GitLab 16.2 and later
539+
540+
As of GitLab 16.2, PostgreSQL 13.11 and 14.8 are both shipped with Omnibus.
541+
During a package upgrade, the database isn't upgraded to PostgreSQL 14. If you
542+
want to upgrade to PostgreSQL 14, you must do it manually:
543+
544+
```shell
545+
sudo gitlab-ctl pg-upgrade -V 14
546+
```
547+
548+
PostgreSQL 14 isn't supported on Geo deployments and is [planned](https://gitlab.com/groups/gitlab-org/-/epics/9065)
549+
for future releases.
550+
538551
#### GitLab 16.0 and later
539552
540553
PostgreSQL version 12 is no longer supported and the binaries have been

docker/assets/wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fi
189189

190190
# This must be false when the opt-in PostgreSQL version is the default for pg-upgrade,
191191
# otherwise it must be true.
192-
ATTEMPT_AUTO_PG_UPGRADE='true'
192+
ATTEMPT_AUTO_PG_UPGRADE='false'
193193

194194
# Make sure PostgreSQL is at the latest version.
195195
# If it fails, print a message with a workaround and exit

files/gitlab-ctl-commands/pg-upgrade.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ def old_version
744744
end
745745

746746
def default_version
747-
PGVersion.parse(version_from_manifest('postgresql_new')) || PGVersion.parse(version_from_manifest('postgresql'))
747+
PGVersion.parse(version_from_manifest('postgresql'))
748748
end
749749

750750
def new_version

files/gitlab-ctl-commands/upgrade.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def patroni_detected?
344344
def attempt_auto_pg_upgrade?
345345
# This must return false when the opt-in PostgreSQL version is the default for pg-upgrade,
346346
# otherwise it must be true.
347-
true
347+
false
348348
end
349349

350350
def recommend_pg_upgrade?

spec/chef/cookbooks/postgresql/recipes/postgresql_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,24 @@
612612
end
613613
end
614614

615+
RSpec.describe 'postgresql 14' do
616+
let(:chef_run) { ChefSpec::SoloRunner.new(step_into: %w(runit_service postgresql_config)).converge('gitlab::default') }
617+
let(:postgresql_conf) { File.join(postgresql_data_dir, 'postgresql.conf') }
618+
let(:runtime_conf) { '/var/opt/gitlab/postgresql/data/runtime.conf' }
619+
620+
before do
621+
allow_any_instance_of(PgHelper).to receive(:version).and_return(PGVersion.new('14.0'))
622+
allow_any_instance_of(PgHelper).to receive(:database_version).and_return(PGVersion.new('14.0'))
623+
end
624+
625+
it 'configures wal_keep_size instead of wal_keep_segments' do
626+
expect(chef_run).to render_file(runtime_conf).with_content { |content|
627+
expect(content).to include("wal_keep_size")
628+
expect(content).not_to include("wal_keep_segments")
629+
}
630+
end
631+
end
632+
615633
RSpec.describe 'postgresql 13' do
616634
let(:chef_run) { ChefSpec::SoloRunner.new(step_into: %w(runit_service postgresql_config)).converge('gitlab::default') }
617635
let(:postgresql_conf) { File.join(postgresql_data_dir, 'postgresql.conf') }

0 commit comments

Comments
 (0)