Fixed #28260 -- Allowed customizing the test tablespace initial and autoextend size on Oracle.

Thanks Tim Graham for the review.
This commit is contained in:
Mariusz Felisiak 2017-06-02 18:35:56 +02:00 committed by GitHub
parent 8149bd00d8
commit 516b7664dc
4 changed files with 84 additions and 8 deletions

View File

@ -189,12 +189,12 @@ class DatabaseCreation(BaseDatabaseCreation):
print("_create_test_db(): dbname = %s" % parameters['user'])
statements = [
"""CREATE TABLESPACE %(tblspace)s
DATAFILE '%(datafile)s' SIZE 20M
REUSE AUTOEXTEND ON NEXT 10M MAXSIZE %(maxsize)s
DATAFILE '%(datafile)s' SIZE %(size)s
REUSE AUTOEXTEND ON NEXT %(extsize)s MAXSIZE %(maxsize)s
""",
"""CREATE TEMPORARY TABLESPACE %(tblspace_temp)s
TEMPFILE '%(datafile_tmp)s' SIZE 20M
REUSE AUTOEXTEND ON NEXT 10M MAXSIZE %(maxsize_tmp)s
TEMPFILE '%(datafile_tmp)s' SIZE %(size_tmp)s
REUSE AUTOEXTEND ON NEXT %(extsize_tmp)s MAXSIZE %(maxsize_tmp)s
""",
]
# Ignore "tablespace already exists" error when keepdb is on.
@ -287,8 +287,12 @@ class DatabaseCreation(BaseDatabaseCreation):
'tblspace_temp': self._test_database_tblspace_tmp(),
'datafile': self._test_database_tblspace_datafile(),
'datafile_tmp': self._test_database_tblspace_tmp_datafile(),
'maxsize': self._test_database_tblspace_size(),
'maxsize_tmp': self._test_database_tblspace_tmp_size(),
'maxsize': self._test_database_tblspace_maxsize(),
'maxsize_tmp': self._test_database_tblspace_tmp_maxsize(),
'size': self._test_database_tblspace_size(),
'size_tmp': self._test_database_tblspace_tmp_size(),
'extsize': self._test_database_tblspace_extsize(),
'extsize_tmp': self._test_database_tblspace_tmp_extsize(),
}
def _test_settings_get(self, key, default=None, prefixed=None):
@ -337,12 +341,24 @@ class DatabaseCreation(BaseDatabaseCreation):
tblspace = '%s.dbf' % self._test_database_tblspace_tmp()
return self._test_settings_get('DATAFILE_TMP', default=tblspace)
def _test_database_tblspace_size(self):
def _test_database_tblspace_maxsize(self):
return self._test_settings_get('DATAFILE_MAXSIZE', default='500M')
def _test_database_tblspace_tmp_size(self):
def _test_database_tblspace_tmp_maxsize(self):
return self._test_settings_get('DATAFILE_TMP_MAXSIZE', default='500M')
def _test_database_tblspace_size(self):
return self._test_settings_get('DATAFILE_SIZE', default='50M')
def _test_database_tblspace_tmp_size(self):
return self._test_settings_get('DATAFILE_TMP_SIZE', default='50M')
def _test_database_tblspace_extsize(self):
return self._test_settings_get('DATAFILE_EXTSIZE', default='25M')
def _test_database_tblspace_tmp_extsize(self):
return self._test_settings_get('DATAFILE_TMP_EXTSIZE', default='25M')
def _get_test_db_name(self):
"""
Return the 'production' DB name to get the test DB creation machinery

View File

@ -911,6 +911,58 @@ This is an Oracle-specific setting.
The maximum size that the DATAFILE_TMP is allowed to grow to.
.. setting:: DATAFILE_SIZE
``DATAFILE_SIZE``
^^^^^^^^^^^^^^^^^
.. versionadded:: 2.0
Default: ``'50M'``
This is an Oracle-specific setting.
The initial size of the DATAFILE.
.. setting:: DATAFILE_TMP_SIZE
``DATAFILE_TMP_SIZE``
^^^^^^^^^^^^^^^^^^^^^
.. versionadded:: 2.0
Default: ``'50M'``
This is an Oracle-specific setting.
The initial size of the DATAFILE_TMP.
.. setting:: DATAFILE_EXTSIZE
``DATAFILE_EXTSIZE``
^^^^^^^^^^^^^^^^^^^^
.. versionadded:: 2.0
Default: ``'25M'``
This is an Oracle-specific setting.
The amount by which the DATAFILE is extended when more space is required.
.. setting:: DATAFILE_TMP_EXTSIZE
``DATAFILE_TMP_EXTSIZE``
^^^^^^^^^^^^^^^^^^^^^^^^
.. versionadded:: 2.0
Default: ``'25M'``
This is an Oracle-specific setting.
The amount by which the DATAFILE_TMP is extended when more space is required.
.. setting:: DATA_UPLOAD_MAX_MEMORY_SIZE
DATA_UPLOAD_MAX_MEMORY_SIZE

View File

@ -248,6 +248,10 @@ Tests
* Added threading support to :class:`~django.test.LiveServerTestCase`.
* Added settings that allow customizing the test tablespace parameters for
Oracle: :setting:`DATAFILE_SIZE`, :setting:`DATAFILE_TMP_SIZE`,
:setting:`DATAFILE_EXTSIZE`, and :setting:`DATAFILE_TMP_EXTSIZE`.
URLs
~~~~
@ -394,6 +398,9 @@ Miscellaneous
``PASSWORD_RESET_TIMEOUT_DAYS = 3``, password reset tokens are now valid for
72 hours rather than 96 hours.
* The default size of the Oracle test tablespace is increased from 20M to 50M
and the default autoextend size is increased from 10M to 25M.
.. _deprecated-features-2.0:
Features deprecated in 2.0

View File

@ -35,6 +35,7 @@ autodetector
autodiscovery
autoescape
autoescaping
autoextend
autogenerated
autoincrement
autoreload