| Summary: | Wrong new offline ids after repair db | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Erwin Betschart <erwin> | ||||||
| Component: | cdo.db | Assignee: | Eike Stepper <stepper> | ||||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | ||||||||
| Version: | 4.0 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Erwin Betschart
Created attachment 184784 [details]
Proposed patch
resultSet.getLong(1);
--> delivers 0 in case MIN(NULL) was executed; MIN(NULL) if there were no offline branches in the table.
if (id > Long.MAX_VALUE / 2L && id < min)
--> Taking Long.MAX_VALUE / 2L in order to decide if the found minimum was a local or master id.
Created attachment 184886 [details]
Patch v2
I've tried to get rid of the >MAX_VALUE/2 constraint by detecting only the objects that are newly created in offline branches. This requires a JOIN with the CDO_OBJECTS table, which is always present for horizontal mapping strategies. Can you please test that and tell me if you like it?
Seems to work tested the following cases: -> Crashed db without offline changes -> max long: ok -> Crashed db with offline changes: ok Your patch needs a small change (missing whitespace): + String suffix = "AS t WHERE t." + ... to: + String suffix = " AS t WHERE t." + ... Several jdbc exceptions (Column T.CDO_ID not found) were thrown and silently irgnored but this had no impact on the computed local minimum. (In reply to comment #3) > Seems to work tested the following cases: > -> Crashed db without offline changes -> max long: ok > -> Crashed db with offline changes: ok Thank you for testing. > Your patch needs a small change (missing whitespace): > + String suffix = "AS t WHERE t." + ... > to: > + String suffix = " AS t WHERE t." + ... Oh, now I've added a space there. > Several jdbc exceptions (Column T.CDO_ID not found) were thrown and silently > irgnored but this had no impact on the computed local minimum. Yes, these exceptions are to be expected because at repair time we don't already know the real mappings and just iterate over all tables. I double checked that we don't get "false positives" with this approach. Committed to HEAD. Available in R20110608-1407 |