SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-788
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shay Banon
Reporter: Fábio Matos
Votes: 0
Watchers: 0
Operations

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

saveSnapshotAfterMirror should only be used if there was a change in the DB

Created: 25/Nov/08 04:24 AM   Updated: 08/Dec/08 04:59 AM
Component/s: None
Affects Version/s: 2.1.0 GA
Fix Version/s: 2.2.0 M1


 Description  « Hide
Now, the saveSnapshotAfterMirror boolean property is used in the end of ResultSetJdbcGpsDevice.performMirroring method.

The problem, I think, is that if the property is true, the saving of the snapshot is always performed, even if there was no created/updated/deleted rows in the DB.

This is not a problem if using RAMJdbcSnapshotPersister, but if using FSJdbcSnapshotPersister this could be a quite heavy operation to perform every time the performMirroring is called, especially if the index content is big.

So, I think the solution should be something like this:

...
if (!createdRows.isEmpty() || !updatedRows.isEmpty()) { getSnapshotEventListener().onCreateAndUpdate( new CreateAndUpdateSnapshotEvent(connection, dialect, mapping, createdRows, updatedRows, compassGps)); }
if (!deletedRows.isEmpty()) { getSnapshotEventListener().onDelete( new DeleteSnapshotEvent(connection, dialect, mapping, deletedRows, compassGps)); }
snapshot.putAliasSnapshot(newAliasSnapshot);

// >>>>>>>>>>>>>>>>>
if (isSaveSnapshotAfterMirror() && (!createdRows.isEmpty() || !updatedRows.isEmpty() || !deletedRows.isEmpty()) { getSnapshotPersister().save(snapshot); }
// <<<<<<<<<<<<<<<<
}
} catch (SQLException e) { throw new JdbcGpsDeviceException(buildMessage("Failed while mirroring data changes"), e); } finally { JdbcUtils.closeResultSet(rs); JdbcUtils.closeStatement(ps); JdbcUtils.closeConnection(connection); }
}



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Shay Banon added a comment - 25/Nov/08 02:17 PM
Fixed, you can try the trunk nightly later today and see if it works for you.

Fábio Matos added a comment - 08/Dec/08 04:59 AM
I didn't really tried it, but looking at the code its good. Thanks.