Skip to content

Commit 7d5c80e

Browse files
bvliucopybara-github
authored andcommitted
Update RelationalDB PG versions.
PiperOrigin-RevId: 839949978
1 parent fdf70aa commit 7d5c80e

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

perfkitbenchmarker/providers/aws/aws_aurora_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
FLAGS = flags.FLAGS
3030

3131
DEFAULT_MYSQL_AURORA_VERSION = '8.0'
32-
DEFAULT_POSTGRES_AURORA_VERSION = '13'
32+
DEFAULT_POSTGRES_AURORA_VERSION = '17'
3333

3434
_MAP_ENGINE_TO_DEFAULT_VERSION = {
3535
sql_engine_utils.AURORA_MYSQL: DEFAULT_MYSQL_AURORA_VERSION,

perfkitbenchmarker/providers/aws/aws_relational_db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
FLAGS = flags.FLAGS
3636

3737
DEFAULT_MYSQL_VERSION = '8'
38-
DEFAULT_POSTGRES_VERSION = '13'
38+
DEFAULT_POSTGRES_VERSION = '17'
3939
DEFAULT_SQLSERVER_VERSION = '14'
4040
IS_READY_TIMEOUT = 60 * 60 * 1 # 1 hour (RDS HA takes a long time to prepare)
4141

@@ -49,6 +49,7 @@
4949
'14',
5050
'15',
5151
'16',
52+
'17',
5253
]
5354

5455

perfkitbenchmarker/providers/azure/azure_flexible_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
ENABLE_HA = 'ZoneRedundant'
3535

3636
DEFAULT_MYSQL_VERSION = '8.0'
37-
DEFAULT_POSTGRES_VERSION = '13'
37+
DEFAULT_POSTGRES_VERSION = '17'
3838

3939
IS_READY_TIMEOUT = 60 * 60 * 1 # 1 hour (might take some time to prepare)
4040

perfkitbenchmarker/providers/gcp/gcp_alloy_db.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@
5050
upper_bound=20,
5151
)
5252

53-
SUPPORTED_ALLOYDB_ENGINE_VERSIONS = ['13']
54-
55-
DEFAULT_ENGINE_VERSION = '13'
53+
ALLOYDB_DATABASE_VERSION_MAPPING = {
54+
'14': 'POSTGRES_14',
55+
'15': 'POSTGRES_15',
56+
'16': 'POSTGRES_16',
57+
'17': 'POSTGRES_17',
58+
}
59+
60+
DEFAULT_ENGINE_VERSION = '17'
5661
CREATION_TIMEOUT = 30 * 60
5762
IS_READY_TIMEOUT = 600 # 10 minutes
5863

@@ -91,7 +96,7 @@ def GetDefaultEngineVersion(engine: str) -> str:
9196
Returns:
9297
(string): Default version for the given database engine.
9398
"""
94-
if engine not in SUPPORTED_ALLOYDB_ENGINE_VERSIONS:
99+
if engine not in ALLOYDB_DATABASE_VERSION_MAPPING:
95100
raise NotImplementedError(
96101
'Default engine not specified for engine {}'.format(engine)
97102
)
@@ -125,13 +130,17 @@ def _Create(self) -> None:
125130
Exception: if an invalid MySQL flag was used.
126131
"""
127132
# Create a database cluster
133+
database_version_string = self._GetEngineVersionString(
134+
self.spec.engine_version
135+
)
128136
cmd_string = [
129137
'clusters',
130138
'create',
131139
self.cluster_id,
132-
'--password=%s' % self.spec.database_password,
133-
'--network=%s' % self.client_vm.network.network_resource.name,
140+
f'--password={self.spec.database_password}',
141+
f'--network={self.client_vm.network.network_resource.name}',
134142
'--allocated-ip-range-name=google-service-range',
143+
f'--database-version={database_version_string}',
135144
]
136145

137146
# Continuous backup is not enabled by default when using gcloud
@@ -372,3 +381,24 @@ def _Delete(self) -> None:
372381
cmd_string = ['clusters', 'delete', self.cluster_id, '--force', '--async']
373382
cmd = self._GetAlloyDbCommand(cmd_string)
374383
cmd.Issue()
384+
385+
def _GetEngineVersionString(self, version: str) -> str:
386+
"""Returns AlloyDB-specific version string for a given database engine.
387+
388+
Args:
389+
version: engine version
390+
391+
Returns:
392+
(string): AlloyDB-specific name for the requested engine and version.
393+
394+
Raises:
395+
NotImplementedError on invalid engine / version combination.
396+
"""
397+
if version not in ALLOYDB_DATABASE_VERSION_MAPPING:
398+
valid_versions = ', '.join(ALLOYDB_DATABASE_VERSION_MAPPING.keys())
399+
raise NotImplementedError(
400+
f'Version {version} is not supported, supported versions include'
401+
f' {valid_versions}'
402+
)
403+
404+
return ALLOYDB_DATABASE_VERSION_MAPPING[version]

perfkitbenchmarker/providers/gcp/gcp_relational_db.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@
8282
}
8383

8484

85-
DEFAULT_MYSQL_VERSION = '5.7'
86-
DEFAULT_POSTGRES_VERSION = '9.6'
85+
DEFAULT_MYSQL_VERSION = '8.0'
86+
DEFAULT_POSTGRES_VERSION = '17'
8787
DEFAULT_SQL_SERVER_VERSION = '2017_Standard'
8888

8989
DEFAULT_ENGINE_VERSIONS = {

0 commit comments

Comments
 (0)