Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#21775 closed New feature (fixed)

No facility to specify the datafile of a django test Oracle tablespace

Reported by: jarshwah Owned by: alvaro@…
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: oracle
Cc: Shai Berger, alvaro@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There is no way to customise the name of the datafile for the Oracle test database. This is required for RAC installations which use shared storage. I propose a new option to the DATABASES dict:

        'TEST_TBLSPACE_DATAFILE': '',
        'TEST_TBLSPACE_TMP_DATAFILE': '',

Without these options, it is impossible to test against RAC, so I'm classifying it as a bug rather than a new feature.

And the existing code that creates the tablespaces:

# django/db/backends/oracle/creation.py
    def _execute_test_db_creation(self, cursor, parameters, verbosity):
        if verbosity >= 2:
            print("_create_test_db(): dbname = %s" % parameters['dbname'])
        statements = [
            """CREATE TABLESPACE %(tblspace)s
               DATAFILE '%(tblspace)s.dbf' SIZE 20M
               REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 200M
            """,
            """CREATE TEMPORARY TABLESPACE %(tblspace_temp)s
               TEMPFILE '%(tblspace_temp)s.dbf' SIZE 20M
               REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 100M
            """,
        ]
        self._execute_statements(cursor, statements, parameters, verbosity)

Since not many people have access to an Oracle RAC installation, I'll throw together a patch in the near future.

Change History (9)

comment:1 by Shai Berger, 11 years ago

Cc: Shai Berger added
Keywords: oracle added
Needs documentation: set
Triage Stage: UnreviewedAccepted
Type: BugNew feature

You should be able to test even against RAC by creating (or even just using) your own tablespace, and setting TEST_CREATE = False. Of course, it is much better to allow the use of test-only tablespaces and give the user more control over where they are created; but that is an enhancement.

I have just run into a related problem myself -- the 200M size limit on the test tablespace does not allow testing the GIS oracle backend; so, I'd like to "hijack" this ticket into one which allows complete control over the creation of the test tablespaces.

While at it, I don't like much the current set of Oracle-specific-test-only parameters in the general database settings dictionary. I'd like to collect them into a TESTING entry, or maybe into the OPTIONS entry; I'll take that to the developers list.

comment:2 by alvaro@…, 11 years ago

Cc: alvaro@… added
Owner: changed from nobody to alvaro@…
Status: newassigned

I'd like to try to create a patch for this.

Could you please elaborate more on how to you imagine this patch to look like?
Thanks!

comment:3 by jarshwah, 11 years ago

Alvaro, there is a discussion happening at the moment on the django developers mailing list:

https://groups.google.com/forum/#!topic/django-developers/2aJuLbMRARU

The discussion is currently centred on cleaning up how test database settings should be structured. It'd be worth reading that, and either waiting on an outcome, or writing the patch as you think it should work and submitting for review.

Regards,

comment:4 by Tim Graham, 11 years ago

Easy pickings: unset

comment:5 by Shai Berger <shai@…>, 11 years ago

In 41afae4ce906838fc87d63962104cfb47991f68b:

Reorganized the database test settings

Change database test settings from "TEST_"-prefixed entries in the
database settings dictionary to setting in a dictionary that is itself
an entry "TEST" in the database settings.

Refs #21775

Thanks Josh Smeaton for review.

comment:6 by Josh Smeaton, 10 years ago

https://github.com/django/django/pull/3118

This patch allows specifying the DATAFILE and MAXSIZE of each tablespace (the primary and the tmp). The default maxsize has been increased from 200M to 500M to better support GIS on Oracle. This default may need to be increased to correctly support GIS as it was just a guess - Shai to confirm.

I've also changed the tablespace creation to be test_USER rather than test_NAME - which should make more sense for an Oracle deployment. NAME will be "xe" (or some other like-value) for every single django app running on the same database, which could lead to clobbering if running two different django applications on the same server. NAME will at least be linked to the actual django application under test, rather than the server.

comment:7 by Josh Smeaton, 10 years ago

Has patch: set
Version: 1.6master

comment:8 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 0eb5cde9da3252fbdbbb59ae6e421ca04814ad3c:

Fixed #21775 -- Allowed customization of datafile for Oracle tablespace

comment:9 by Shai Berger <shai@…>, 10 years ago

In 991f523753baff73b32859c906649767a2bc8061:

[1.7.x] Fixed #23969: Made Oracle default test-tablespace larger.

It seems our test suite has grown...
Refs #21775

Note: See TracTickets for help on using tickets.
Back to Top