db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "V.Narayanan (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3551) Implement procedure SYSCS_UTIL.SYSCS_PREPARE_REPLICATION()
Date Wed, 19 Mar 2008 11:58:31 GMT

     [ https://issues.apache.org/jira/browse/DERBY-3551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

V.Narayanan updated DERBY-3551:
-------------------------------

    Attachment: Derby3551_1.stat
                Derby3551_1.diff

In trying to search for a way to enable only logging of unlogged operations and
not the archiving support available the following observations were very important

1) Logic to enable logging is found in the BaseDataFileFactory 
  (org.apache.derby.impl.store.raw.data.BaseDataFileFactory, line no 672)
2) Logic for archiving is present in LogToFile

This partitioning of logic was to the advantage of this issue and made the coding
logic very simple

Follows a brief explanation of the solution developed

When log archiving needs to be done it is enabled by using a flag in the
following way in the BaseDataFileFactory

if (logFactory.logArchived()) {
    mode &= ~(ContainerHandle.MODE_UNLOGGED | ContainerHandle.MODE_CREATE_UNLOGGED);
}

(The ContainerHandle class contains a very good explanation of the MODE_UNLOGGED, 
MODE_CREATE_UNLOGGED flags.)

Now in addition to just enabling the flags when logArchiving is required the flags need
to be enabled when replication is active too. To achieve this the above code was changed to

if (logFactory.logArchived() || logFactory.replicationLogUnlogged()) {
    mode &= ~(ContainerHandle.MODE_UNLOGGED | ContainerHandle.MODE_CREATE_UNLOGGED);
}

Doing the above solved the problem for a simple index creation, what remains to be seen
is how it works for imports.

Attaching a patch for people who might be interested in testing the solution.

Another interesting decision will be as to whether a stored procedure will be required now?
(I do not have an answer for this right now, but I surely shall be revisiting Derby-239 to
learn
more about unlogged operations being started before logging is enabled)

> Implement procedure SYSCS_UTIL.SYSCS_PREPARE_REPLICATION()
> ----------------------------------------------------------
>
>                 Key: DERBY-3551
>                 URL: https://issues.apache.org/jira/browse/DERBY-3551
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Replication
>    Affects Versions: 10.4.0.0, 10.5.0.0
>            Reporter: V.Narayanan
>            Assignee: V.Narayanan
>         Attachments: Derby3551_1.diff, Derby3551_1.stat
>
>
> Jorgen says-
> I suggest that the replication step in which the master database is frozen is replaced
by a new system procedure to solve index and import:
> Old: SYSCS_UTIL.SYSCS_FREEZE_DATABASE()
> New: SYSCS_UTIL.SYSCS_PREPARE_REPLICATION()
> The new system procedure should:
> 1) Freeze the database
> 2) Check if there are any ongoing transactions with unlogged operations. If so - unfreeze
and abort. Otherwise:
> 3) Enable logging of unlogged operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message