Code

Opened 3 months ago

Last modified 6 weeks ago

#21775 assigned New feature

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

Reported by: smeatonj Owned by: alvaro@…
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords: oracle
Cc: shai, alvaro@… Triage Stage: Accepted
Has patch: no 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.

Attachments (0)

Change History (5)

comment:1 Changed 3 months ago by shai

  • Cc shai added
  • Keywords oracle added
  • Needs documentation set
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Bug to New 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 Changed 3 months ago by alvaro@…

  • Cc alvaro@… added
  • Owner changed from nobody to alvaro@…
  • Status changed from new to assigned

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 Changed 3 months ago by smeatonj

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 Changed 2 months ago by timo

  • Easy pickings unset

comment:5 Changed 6 weeks ago by Shai Berger <shai@…>

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from alvaro@… to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.