svn commit: r1222110 - in /ofbiz/branches/release11.04: ./ framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1222110 - in /ofbiz/branches/release11.04: ./ framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java

jleroux@apache.org
Author: jleroux
Date: Thu Dec 22 09:08:24 2011
New Revision: 1222110

URL: http://svn.apache.org/viewvc?rev=1222110&view=rev
Log:
"Applied fix from trunk for revision: 1222105  "
------------------------------------------------------------------------
r1222105 | jleroux | 2011-12-22 10:06:18 +0100 (jeu., 22 déc. 2011) | 7 lines

A slightly modified patch from Patrick Antivackis "Entity synchronization is skipping values to create, store and remove" https://issues.apache.org/jira/browse/OFBIZ-4601

assembleValuesTocreate, assembleValuesToStore and assembleKeysToRemove are called multiple times during a synchronization (depending on the syncSplitMillis and the time period to synchronized). There is in theses methods a check to see if at the next call, the method needs to look for values. This check depends only on entity without values at the current run, which is not enough

Solving issue described and fixing the assembleKeysToRemove that was using nextUpdateTxTime instead of nextRemoveTxTime

jleroux: functional changes from patch, only formatting
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release11.04/   (props changed)
    ofbiz/branches/release11.04/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 22 09:08:24 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4:951708-952957
 /ofbiz/branches/jquery:952958-1044489
 /ofbiz/branches/multitenant20100310:921280-927264
-/ofbiz/trunk:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1133353,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139346,1139385,1139504,1139521,1140358,1140362,1140375,1140469,1144537,1144791,1153073,1153768,1158124,1158126,1158608,1159080,1163036,1163093,1163533,1165130,1166591,1167116,1167314,1167480,1167501,1167510,1167517,1167606,1172213,1172243,1174964,1175130,1175135,1175143,1177128,1178175,1178199,1180398,1181878,1182259,1182310,1182731,1182858,1183651,1184906,1184996,1184999,1185179,1187515,1187528,1187933,1187944,1188042,1188564,1189592,1189601,1190134,1194958,1196778,1199276,1199450,1200207,1201110,1201125,1201941,1203350,1203776,1206507,1206690,1208335,1209250,1209362,1210193,1210211,1212147,1214124,1220298,1221889,1221913
+/ofbiz/trunk:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1133353,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139346,1139385,1139504,1139521,1140358,1140362,1140375,1140469,1144537,1144791,1153073,1153768,1158124,1158126,1158608,1159080,1163036,1163093,1163533,1165130,1166591,1167116,1167314,1167480,1167501,1167510,1167517,1167606,1172213,1172243,1174964,1175130,1175135,1175143,1177128,1178175,1178199,1180398,1181878,1182259,1182310,1182731,1182858,1183651,1184906,1184996,1184999,1185179,1187515,1187528,1187933,1187944,1188042,1188564,1189592,1189601,1190134,1194958,1196778,1199276,1199450,1200207,1201110,1201125,1201941,1203350,1203776,1206507,1206690,1208335,1209250,1209362,1210193,1210211,1212147,1214124,1220298,1221889,1221913,1222105

Modified: ofbiz/branches/release11.04/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java?rev=1222110&r1=1222109&r2=1222110&view=diff
==============================================================================
--- ofbiz/branches/release11.04/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java (original)
+++ ofbiz/branches/release11.04/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java Thu Dec 22 09:08:24 2011
@@ -354,7 +354,7 @@ public class EntitySyncContext {
                 long valuesPerEntity = 0;
                 while ((nextValue = eli.next()) != null) {
                     // sort by the tx stamp and then the record stamp
-                    // find first value in valuesToStore list, starting with the current insertBefore value, that has a CREATE_STAMP_TX_FIELD after the nextValue.CREATE_STAMP_TX_FIELD, then do the same with CREATE_STAMP_FIELD
+                    // find first value in valuesToCreate list, starting with the current insertBefore value, that has a CREATE_STAMP_TX_FIELD after the nextValue.CREATE_STAMP_TX_FIELD, then do the same with CREATE_STAMP_FIELD
                     while (insertBefore < valuesToCreate.size() && valuesToCreate.get(insertBefore).getTimestamp(ModelEntity.CREATE_STAMP_TX_FIELD).before(nextValue.getTimestamp(ModelEntity.CREATE_STAMP_TX_FIELD))) {
                         insertBefore++;
                     }
@@ -441,7 +441,13 @@ public class EntitySyncContext {
             }
             Debug.logInfo(toCreateInfo.toString(), module);
         }
-
+        
+        // As the this.nextCreateTxTime calculation is only based on entities without values to create, if there at least one value to create returned
+        // this calculation is false, so it needs to be nullified
+        if (valuesToCreate.size() > 0) {
+            this.nextCreateTxTime = null;
+        }
+        
         return valuesToCreate;
     }
 
@@ -579,6 +585,12 @@ public class EntitySyncContext {
             }
             Debug.logInfo(toStoreInfo.toString(), module);
         }
+        
+        // As the this.nextUpdateTxTime calculation is only based on entities without values to store, if there at least one value to store returned
+        // this calculation is false, so it needs to be nullified
+        if (valuesToStore.size() > 0) {
+            this.nextUpdateTxTime = null;
+        }        
 
         return valuesToStore;
     }
@@ -653,8 +665,8 @@ public class EntitySyncContext {
                 eliNext.close();
                 if (firstVal != null) {
                     Timestamp nextTxTime = firstVal.getTimestamp(ModelEntity.STAMP_TX_FIELD);
-                    if (this.nextUpdateTxTime == null || nextTxTime.before(this.nextUpdateTxTime)) {
-                        this.nextUpdateTxTime = nextTxTime;
+                    if (this.nextRemoveTxTime == null || nextTxTime.before(this.nextRemoveTxTime)) {
+                        this.nextRemoveTxTime = nextTxTime;
                     }
                 }
             }
@@ -695,6 +707,12 @@ public class EntitySyncContext {
             Debug.logInfo(toRemoveInfo.toString(), module);
         }
 
+        // As this.nextRemoveTxTime calculation is only based on entities without keys to remove, if there at least one key to remove returned
+        // this calculation is false, so it needs to be nullified
+        if (keysToRemove.size() > 0) {
+            this.nextRemoveTxTime = null;
+        }
+        
         return keysToRemove;
     }