| Summary: | [DB] Crash restore exception in DBStore for Postgres SQL | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Christophe Bouhier <dzonekl> |
| Component: | cdo.db | Assignee: | Stefan Winkler <stefan> |
| Status: | CLOSED DUPLICATE | QA Contact: | Eike Stepper <stepper> |
| Severity: | normal | ||
| Priority: | P3 | CC: | stepper |
| Version: | 4.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Christophe Bouhier
Stefan, can you have a look what Postgres is messing up here? It seems to be a PITA ;-( This change to ObjectTypeTable in the method below solved the problem. (Adding autocommit to the connection).
I found later versions of Postgres, would handle this error with autocommit. It's propably not
the best solution, but at least for me it solved the issue.
public CDOID getMaxID(Connection connection, IIDHandler idHandler)
{
Statement stmt = null;
ResultSet resultSet = null;
try
{
stmt = connection.createStatement();
connection.setAutoCommit(true);
resultSet = stmt.executeQuery("SELECT MAX(" + idField + ") FROM " + table);
connection.setAutoCommit(false);
if (resultSet.next())
{
return idHandler.getCDOID(resultSet, 1);
}
return null;
}
catch (SQLException ex)
{
throw new DBException(ex);
}
finally
{
DBUtil.close(resultSet);
DBUtil.close(stmt);
}
}
Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems. Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!! Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master. (In reply to comment #2) > try > { > stmt = connection.createStatement(); > connection.setAutoCommit(true); Hmm, wouldn't it be better to do this in org.eclipse.emf.cdo.server.internal.db.DBStore.repairAfterCrash()? This bug and bug 364809 are basically duplicates but they seem to suggest different solutions. Fixed via bug 364809. *** This bug has been marked as a duplicate of bug 364809 *** Closing |