Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351078

Summary: [DB] Support raw replication in HorizontalBranchingMappingStrategyWithRanges
Product: [Modeling] EMF Reporter: Cyril Jaquier <cyril.jaquier>
Component: cdo.dbAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: enhancement    
Priority: P3 CC: pascal.lehmann, stefan, stepper, szbardy
Version: 4.1Flags: stepper: review-
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: Lighter, Faster and Better
Attachments:
Description Flags
Patch v1
none
Patch v2 - ready to be committed
none
Patch v3
none
Patch 2 (incremental) none

Description Cyril Jaquier CLA 2011-07-04 08:13:30 EDT
Build Identifier: 4.0 GA

HorizontalBranchingMappingStrategyWithRanges does not implement:

rawImportUnreviseNewRevisions
rawImportReviseOldRevisions

and thus raw replication is not working with this mapping strategy.

Reproducible: Always
Comment 1 Eike Stepper CLA 2011-07-04 08:24:04 EDT
Hi Stefan, this may have to be implemented by me, but I have almost no knowledge about the ranges baes mapping strategies...
Comment 2 Eike Stepper CLA 2011-09-12 23:22:40 EDT
Committed revision 9062:
- trunk/plugins/org.eclipse.emf.cdo.server.db
Comment 3 Eike Stepper CLA 2011-09-12 23:39:24 EDT
Committed revision 9063:
- trunk/plugins/org.eclipse.emf.cdo.tests
Comment 4 Eike Stepper CLA 2011-09-12 23:52:15 EDT
Created attachment 203203 [details]
Patch v1

1) UnsupportedOperationExceptions because rawImportUnreviseNewRevisions() and rawImportReviseOldRevisions() are not properly overridden. I fixed this by changing the inheritance hierarchy from

		AbstractHorizontalMappingStrategy
			HorizontalAuditMappingStrategy
			HorizontalAuditMappingStrategyWithRanges
			HorizontalBranchingMappingStrategy
			HorizontalBranchingMappingStrategyWithRanges

to
			
		AbstractHorizontalMappingStrategy
			HorizontalAuditMappingStrategy
				HorizontalAuditMappingStrategyWithRanges
			HorizontalBranchingMappingStrategy
				HorizontalBranchingMappingStrategyWithRanges
			
2) The list joins for range-based list mappings are different

3) The main challenge is that the range-based list mappings change DB values (namely the CDO_VERSION_REMOVED field) in the *past*. This has no precendence in replicated scenarios and causes deep impact especially in:
		a) DBUtil.deserializeTable (a new row handler for post processing is needed, additional serializeTable/deserializeTable methods are needed to keep APIs compatible) and in 
		b) all DBTypes (the transferred values must be returned for possible post processing, entire new methods are needed to keep APIs compatible, i.e. readValueWithResult/writeValueWithResult).
Comment 5 Eike Stepper CLA 2011-09-12 23:58:12 EDT
Stefan, please review. I'll try to hunt down a new regression in OfflineTest.testDisconnectAndSyncAddition(). All other tests are passing...
Comment 6 Eike Stepper CLA 2011-09-13 00:20:33 EDT
Created attachment 203205 [details]
Patch v2 - ready to be committed

Regression fixed.
Comment 7 Eike Stepper CLA 2011-09-13 01:47:19 EDT
Created attachment 203208 [details]
Patch v3
Comment 8 Eike Stepper CLA 2011-09-13 01:49:39 EDT
Committed revision 9067:
- trunk/plugins/org.eclipse.emf.cdo.server.db
- trunk/plugins/org.eclipse.emf.cdo.tests
- trunk/plugins/org.eclipse.emf.cdo.tests.db
- trunk/plugins/org.eclipse.net4j.db
- trunk/plugins/org.eclipse.net4j.tests
Comment 9 Eike Stepper CLA 2011-09-13 01:50:55 EDT
I've committed patch v3 because I need a clean workspace and all tests are now passing. Stefan, I'm not resolving this bug until after your review ;-)
Comment 10 Eike Stepper CLA 2011-09-13 11:26:15 EDT
After talking to Stefan it turned out that my implementation does not yet consider index positions that have been removed entirely, as opposed to those that have been just added or moved within the list. Will work on a fix tomorrow...
Comment 11 Eike Stepper CLA 2011-09-15 23:52:11 EDT
Committed revision 9120:
- trunk/plugins/org.eclipse.emf.cdo.tests
Comment 12 Eike Stepper CLA 2011-09-16 00:44:41 EDT
Committed revision 9121:
- trunk/plugins/org.eclipse.emf.cdo.tests
Comment 13 Eike Stepper CLA 2011-09-30 04:49:20 EDT
Our original assumption that we can ignore the null-valued VERSION_REMOVED fields turned out to be wrong. Working on a fix...
Comment 14 Eike Stepper CLA 2011-10-08 00:31:07 EDT
Created attachment 204783 [details]
Patch 2 (incremental)

The tests in WithRanges scenarios now validate the results on table level. The patch fixes the resulting 6 failures by postprocessing the VERSION_REMOVED column.
Comment 15 Eike Stepper CLA 2011-10-08 00:31:32 EDT
Committed revision 9464:
- trunk/plugins/org.eclipse.emf.cdo.server.db
- trunk/plugins/org.eclipse.emf.cdo.tests
- trunk/plugins/org.eclipse.emf.cdo.tests.db
Comment 16 Eike Stepper CLA 2011-10-08 00:31:48 EDT
Fixed
Comment 17 Eike Stepper CLA 2012-09-21 07:17:31 EDT
Closing.