openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2139) OpenJPA fails to recover from a broken database on startup
Date Wed, 22 Feb 2012 20:13:48 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13213960#comment-13213960
] 

Rick Curtis commented on OPENJPA-2139:
--------------------------------------

Background details : The runtime isn't able to determine which type of DB we're running against
based off any of the connection properties so we need to make a connection to figure it out.

The root problem is that when creating the first EM, in AbstractBrokerFactory we have this[1]
block of code that gets a MDR instance, and the configures it as a class listener. As part
of configuring the MDR, we get a reference to the DBDictionary[2]. While instantiating the
dictionary, we need to connect to the DB to figure out which type to create. Instantiation
of the dictionary results in an exception, which blows out of the AbstractBrokerFactory.makeReadOnly()
method. Thus we never register the MDR as a register class listener, and thus the MDR never
gets populated with metadata..

To work around the problem, I modified the MDR so that we only will instantiate a DBDictionary
when we actually use it. Mark tested this patch in his environment and it seemed to work fine.

[1] 
            MetaDataRepository repos = _conf.getMetaDataRepositoryInstance();
            repos.setValidate(MetaDataRepository.VALIDATE_RUNTIME, true);
            repos.setResolve(MetaDataModes.MODE_MAPPING_INIT, true);
            PCRegistry.addRegisterClassListener(repos);

[2] MappingRepository.endConfiguration()
                
> OpenJPA fails to recover from a broken database on startup
> ----------------------------------------------------------
>
>                 Key: OPENJPA-2139
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2139
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Critical
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2139.mdr.patch, OPENJPA-2139.patch
>
>
> The following scenario:
> 1.) turn off the database
> 2.) perform a query against the database
> 3.) turn on the database
> 4.) try to re-run the query from 2.)
> In 4.) you will get the following Exception:
> openjpa-2.2.0-r422266:1244990 nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
An error occurred while parsing the query filter "SELECT k FROM DbEnumKey AS k where k.type=:typ
ORDER BY k.ordinal". Error message: The name "DbEnumKey" is not a recognized entity or identifier.
Known entity names: []
> Basically the whole app is stale afterwards!
> Solution: caching the entities might only be done if a connection can be established.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message