History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRA-9492
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anton Mazkovoi [Atlassian]
Reporter: Anton Mazkovoi [Atlassian]
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
JIRA

JIRA data restore on Jetty fails

Created: 28/Feb/06 12:09 AM   Updated: 29/Nov/06 08:58 PM
Component/s: Administration
Affects Version/s: None
Fix Version/s: 3.7

Time Tracking:
Not Specified

Issue Links:
Duplicate
 
Reference
 

Participants: Andreas Knecht [Atlassian], Anton Mazkovoi [Atlassian] and Brian Nguyen
Since last comment: 76 weeks, 2 days ago
Resolution Date: 29/Nov/06 08:55 PM
Labels:


 Description  « Hide
When restoring a JIRA backup using the Jetty appserver, JIRA either freezes or throws an error.

Anton's comment:

At the momnet importing the data from XML does not work with inline-jdbc. The reason is that to speed thinsg up the import code disables local transaction handling and assumes that all connections have setAutoCommit enabled. The problem is that inline-jdbc puts connections into transactional mode.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brian Nguyen - 07/Jun/06 03:54 AM
A user found that to workaround this you can import the data using Jira Standalone, and then to switch servers:

"to get around the problem I configured a JIRA standalone to use the same database and did the inport from there. Starting JIRA in Jetty afterwards worked perfectly"


Andreas Knecht [Atlassian] - 29/Nov/06 08:55 PM

Summary

The problem was caused by a code change in the ofbiz code (a setOverriceAutoCommit()) believed to provide a performance enhancement when performing large imports. Initially we attempted to fix the problem by making the additional code changes below. Rather than just assuming that the JDBC connection was in auto-commit mode, we explicitly checked and set the connection to auto-commit. This fixed the import problems on Jetty.

As part of the performance tests we tested 3 different scenarios:

  1. A normal import (w/o the fix below)
  2. An import where the setOverrideAutoCommit was commented out (w/o the fix below)
  3. A normal import (with the fix below)

The performance tests showed that the original change in the ofbiz code which was believed to improve the performance did in fact only show improvements in one case (Tomcat with local Postgres database). In all other tests (Tomcat with remote Postgres databse, Resin with both remote and local Postgres database) performance was in fact better when running scenario 2 (where setOverrideAutoCommit() was commented out).

As a result we therefore decided to rollback the original change (i.e.: commented out setOverrideAutoCommit) and not deploy the code changes below. With this solution, Jetty imports are working again, and large imports should show slight (10-15%) performance improvements.

Code changes

We added the following code in

org.ofbiz.core.entity.jdbc.SQLProcessor.java
//allow a single thread to override the autocommit status
        if (Boolean.TRUE.equals(overrideAutoCommit.get()))
        {
            _manualTX = false;
            try
            {
                if (!_connection.getAutoCommit())
                {
                    try
                    {
                        // attempt to set autoCommit to true
                        _connection.setAutoCommit(true);
                    } catch (SQLException e)
                    {
                        // if setting auto-commit failed, then a commit will happen at the end of the transaction.
                        _manualTX = true;
                        Debug.logWarning(e, "Failed to enable autocommit on connection. Manual transactions enabled.");
                    }
                }
            }
            catch (SQLException e)
            {
                throw new GenericDataSourceException("Failed to read auto-commit status of the connection", e);
            }
        }

after line 317. This sets the connection to auto-commit if it is currently not in auto-commit mode. This made the import on Jetty work fine, however due to the performance improvements by removing the setOverrideAutoCommit() calls in JIRA this code change will not be deployed.

Performance

Three different tests were performed with data from support.atlassian.com:

  1. A normal import (without the fix above)
  2. An import where the setOverrideAutoCommit was commented out (without the fix above)
  3. A normal import (with the fix above)
Results

Results are: <TIME FOR IMPORT> mins + <TIME FOR INDEXING> mins

Run # Test #1 - Normal import Test #2 - Import with setOverrideAutoCommit commented out Test #3 - Normal import with fix above
Resin2 (Remote PSQL) 56.39 mins + 4.46 mins 46.68 mins + 4.66 mins 55.37 mins + 4.70 mins for indexing
#2 Resin2 (Remote PSQL) 54.80 mins + 4.69 mins 48.12 mins + 5.12 mins test not executed
Tomcat (Remote PSQL) 71.05 mins + 4.08 mins 56.18 mins + 4.29 mins 71.61 mins + 4.01 mins
Tomcat (Local PSQL) 61.17 mins + 4.41 mins 65.69 mins + 4.60 mins 59.31 mins + 4.51 mins
Resin2 (Local PSQL) 56.96 mins + 5.14 mins 53.80 mins + 5.21 mins 57.17 mins + 5.09 mins
#2 Tomcat (Local PSQL) 60.56 mins + 4.59 mins 66.42 mins + 4.59 mins test not executed