Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dropping changes in LiveSync (MID-5513)
This commit fixes handling of sync token in LiveSync tasks in the presence of task suspension and unrecoverable (halting) errors. Token is either set to the last change successfully processed (for "precise token" resources) or not changed at all (for all the others). There are also some changes in error handling. But all of this is yet to be resolved, see MID-5514.
- Loading branch information
Showing
17 changed files
with
920 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
406 changes: 364 additions & 42 deletions
406
...t/src/test/java/com/evolveum/midpoint/model/intest/sync/TestLiveSyncTaskInterruption.java
Large diffs are not rendered by default.
Oops, something went wrong.
120 changes: 120 additions & 0 deletions
120
model/model-intest/src/test/resources/sync/resource-dummy-interrupted-sync-imprecise.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2010-2019 Evolveum | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<!-- Slow sync resource. Moreover it provides imprecise (CSV/LDAP-like) token values. Used to test LiveSync task interruption. --> | ||
|
||
<resource oid="e396b76e-e010-46ed-bbf5-a3da78d358ea" | ||
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" | ||
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" | ||
xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
|
||
<name>Dummy Resource Slow Sync Imprecise</name> | ||
<connectorRef type="c:ConnectorType"> | ||
<filter> | ||
<q:and> | ||
<q:equal> | ||
<q:path>connectorType</q:path> | ||
<q:value>com.evolveum.icf.dummy.connector.DummyConnector</q:value> | ||
</q:equal> | ||
<q:equal> | ||
<q:path>connectorVersion</q:path> | ||
<q:value>2.0</q:value> | ||
</q:equal> | ||
</q:and> | ||
</filter> | ||
</connectorRef> | ||
<connectorConfiguration xmlns:icfi="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.icf.dummy/com.evolveum.icf.dummy.connector.DummyConnector" | ||
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"> | ||
<icfc:configurationProperties> | ||
<icfi:instanceId>interruptedSyncImprecise</icfi:instanceId> | ||
<icfi:impreciseTokenValues>true</icfi:impreciseTokenValues> | ||
</icfc:configurationProperties> | ||
</connectorConfiguration> | ||
|
||
<schemaHandling> | ||
<objectType> | ||
<displayName>Default Account</displayName> | ||
<default>true</default> | ||
<objectClass>ri:AccountObjectClass</objectClass> | ||
<attribute> | ||
<ref>icfs:name</ref> | ||
<inbound> | ||
<expression> | ||
<script> | ||
<code> | ||
import com.evolveum.midpoint.model.intest.sync.TestLiveSyncTaskInterruption | ||
|
||
if (input == TestLiveSyncTaskInterruption.errorOn) { | ||
throw new IllegalStateException("Got error!") | ||
} else { | ||
Thread.sleep(TestLiveSyncTaskInterruption.delay) | ||
input | ||
} | ||
</code> | ||
</script> | ||
</expression> | ||
<target> | ||
<path>name</path> | ||
</target> | ||
</inbound> | ||
</attribute> | ||
</objectType> | ||
</schemaHandling> | ||
|
||
<!-- No "preciseTokenValue" capability here --> | ||
|
||
<synchronization> | ||
<objectSynchronization> | ||
<enabled>true</enabled> | ||
<correlation> | ||
<q:equal> | ||
<q:path>name</q:path> | ||
<expression> | ||
<path>$account/attributes/icfs:name</path> | ||
</expression> | ||
</q:equal> | ||
</correlation> | ||
<reaction> | ||
<situation>linked</situation> | ||
<synchronize>true</synchronize> | ||
</reaction> | ||
<reaction> | ||
<situation>deleted</situation> | ||
<action> | ||
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus</handlerUri> | ||
</action> | ||
</reaction> | ||
<reaction> | ||
<situation>unlinked</situation> | ||
<action> | ||
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri> | ||
</action> | ||
</reaction> | ||
<reaction> | ||
<situation>unmatched</situation> | ||
<action> | ||
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus</handlerUri> | ||
</action> | ||
</reaction> | ||
</objectSynchronization> | ||
</synchronization> | ||
</resource> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
model/model-intest/src/test/resources/sync/task-intsync-batched-imprecise.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2010-2019 Evolveum | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<task oid="dcfe4c53-a851-4fe1-90eb-f75d9c65d2e6" | ||
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:ext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"> | ||
|
||
<name>Live Sync Interrupted: Batched Imprecise</name> | ||
|
||
<extension> | ||
<ext:objectclass>ri:AccountObjectClass</ext:objectclass> | ||
<ext:liveSyncBatchSize>10</ext:liveSyncBatchSize> | ||
</extension> | ||
|
||
<taskIdentifier>dcfe4c53-a851-4fe1-90eb-f75d9c65d2e6</taskIdentifier> | ||
<ownerRef oid="00000000-0000-0000-0000-000000000002"/> | ||
<executionStatus>runnable</executionStatus> | ||
|
||
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3</handlerUri> | ||
<objectRef oid="e396b76e-e010-46ed-bbf5-a3da78d358ea" type="ResourceType"/> | ||
<recurrence>single</recurrence> | ||
</task> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
model/model-intest/src/test/resources/sync/task-intsync-error-imprecise.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2010-2019 Evolveum | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<task oid="c554ec0f-95c3-40ac-b069-876708d28393" | ||
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:ext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"> | ||
|
||
<name>Live Sync Interrupted: Error Imprecise</name> | ||
|
||
<extension> | ||
<ext:objectclass>ri:AccountObjectClass</ext:objectclass> | ||
<ext:retryLiveSyncErrors>true</ext:retryLiveSyncErrors> | ||
</extension> | ||
|
||
<taskIdentifier>c554ec0f-95c3-40ac-b069-876708d28393</taskIdentifier> | ||
<ownerRef oid="00000000-0000-0000-0000-000000000002"/> | ||
<executionStatus>runnable</executionStatus> | ||
|
||
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3</handlerUri> | ||
<objectRef oid="e396b76e-e010-46ed-bbf5-a3da78d358ea" type="ResourceType"/> | ||
<recurrence>single</recurrence> | ||
</task> |
37 changes: 37 additions & 0 deletions
37
model/model-intest/src/test/resources/sync/task-intsync-error.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2010-2019 Evolveum | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<task oid="b697f3a8-9d02-4924-8627-c1f216e88ed3" | ||
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:ext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"> | ||
|
||
<name>Live Sync Interrupted: Error</name> | ||
|
||
<extension> | ||
<ext:objectclass>ri:AccountObjectClass</ext:objectclass> | ||
<ext:retryLiveSyncErrors>true</ext:retryLiveSyncErrors> | ||
</extension> | ||
|
||
<taskIdentifier>b697f3a8-9d02-4924-8627-c1f216e88ed3</taskIdentifier> | ||
<ownerRef oid="00000000-0000-0000-0000-000000000002"/> | ||
<executionStatus>runnable</executionStatus> | ||
|
||
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3</handlerUri> | ||
<objectRef oid="7a58233a-1cfb-46d1-a404-08cdf4626ebb" type="ResourceType"/> | ||
<recurrence>single</recurrence> | ||
</task> |
36 changes: 36 additions & 0 deletions
36
model/model-intest/src/test/resources/sync/task-intsync-slow-model-imprecise.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2010-2019 Evolveum | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<task oid="066c6993-8b94-445c-aaff-937184bbe6ca" | ||
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:ext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3" | ||
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"> | ||
|
||
<name>Live Sync Interrupted: Slow Model Imprecise</name> | ||
|
||
<extension> | ||
<ext:objectclass>ri:AccountObjectClass</ext:objectclass> | ||
</extension> | ||
|
||
<taskIdentifier>066c6993-8b94-445c-aaff-937184bbe6ca</taskIdentifier> | ||
<ownerRef oid="00000000-0000-0000-0000-000000000002"/> | ||
<executionStatus>runnable</executionStatus> | ||
|
||
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3</handlerUri> | ||
<objectRef oid="e396b76e-e010-46ed-bbf5-a3da78d358ea" type="ResourceType"/> | ||
<recurrence>single</recurrence> | ||
</task> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.