Author: jleroux
Date: Thu Dec 22 09:19:13 2011 New Revision: 1222116 URL: http://svn.apache.org/viewvc?rev=1222116&view=rev Log: "Applied fix from trunk for revision: 1222105 " (conflicts easily handled by hand) ------------------------------------------------------------------------ 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/release4.0/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java Modified: ofbiz/branches/release4.0/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java?rev=1222116&r1=1222115&r2=1222116&view=diff ============================================================================== --- ofbiz/branches/release4.0/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java (original) +++ ofbiz/branches/release4.0/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java Thu Dec 22 09:19:13 2011 @@ -356,7 +356,7 @@ public class EntitySyncContext { long valuesPerEntity = 0; while ((nextValue = (GenericValue) 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() && ((GenericValue) valuesToCreate.get(insertBefore)).getTimestamp(ModelEntity.CREATE_STAMP_TX_FIELD).before(nextValue.getTimestamp(ModelEntity.CREATE_STAMP_TX_FIELD))) { insertBefore++; } @@ -447,6 +447,12 @@ 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; } @@ -591,6 +597,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; } @@ -664,8 +676,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; } } } @@ -708,6 +720,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; } |
Free forum by Nabble | Edit this page |