|
|
|
| Re: [CDO] Usage of MySQL adapter with InnoDB [message #1715501 is a reply to message #1715499] |
Tue, 24 November 2015 07:37   |
|
Am 24.11.2015 um 07:45 schrieb Thorsten Schlathölter:
> I have to correct my above statement. The relevant tables and indizes are written when
>
> TransactionCommitContext.write()
>
>
> is called.
>
> A solution would be to commit after packages have been written
>
>
> public void writePackageUnits(InternalCDOPackageUnit[] packageUnits, OMMonitor monitor) {
> super.writePackageUnits(packageUnits, monitor);
>
> try {
> getConnection().commit();
> } catch (SQLException e) {
> OM.LOG.error(e);
> }
> }
>
>
>
> But then again a clean rollback would not be possible anymore.
Yes, that's the problem. On the other hand the worst effect in case of a later rollback would probably be that empty
tables are left in the schema. Not sure how a new attempt to create these tables would behave, but in theory CDO's
schema reconcilation mechanism should handle that case gracefully. My main problem is that only very few DBs seem to
want/need this extra commit after schema modification. If we issue this commit for all DBs that probably creates more
harm than benfit. Maybe we could delegate this behavior to the DBAdapter or make it configurable via cdo-server.xml...
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
| Re: [CDO] Usage of MySQL adapter with InnoDB [message #1715516 is a reply to message #1715504] |
Tue, 24 November 2015 08:57   |
|
Am 24.11.2015 um 08:51 schrieb Thorsten Schlathölter:
> Yes. That's exactly what I did. Since I have my own implementation for the adapters if have simply added a new
> Interface which is implemented by the MyOwnMySQLAdapter:
>
> So currently it looks like this:
>
>
> public void writePackageUnits(InternalCDOPackageUnit[] packageUnits, OMMonitor monitor) {
> super.writePackageUnits(packageUnits, monitor);
>
> IDBAdapter dbAdapter = getStore().getDBAdapter();
> if (dbAdapter instanceof IDbAdapter2 && ((IDbAdapter2) dbAdapter).commitAfterNewPackages()) {
> try {
> getConnection().commit();
> } catch (SQLException e) {
> OM.LOG.error(e);
> }
> }
> }
This approach may work for your custom case, but as the net4j.db layer doesn't know anything about CDO it's hard to
imagine how we could generalize this for everybody.
What I had in mind is more along the lines of adding a general boolean property (getter) to IDBAdapter, e.g.,
needsCommitAfterSchemaModification() and then conditionally call commit from the original writePackageUnits() method. I
don#t have the time right now to play with it, but something like that. What do you think?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> Since I intend to preregister all packages anyway I also think that the rollback issue is not so harmfull.
>
> Regards,
> Thorsten
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01710 seconds