Jonathan Sinovassin-Naïk created UNOMI-812:
----------------------------------------------

             Summary: Profile properties sometimes overridden by old datas in 
cluster
                 Key: UNOMI-812
                 URL: https://issues.apache.org/jira/browse/UNOMI-812
             Project: Apache Unomi
          Issue Type: Bug
    Affects Versions: unomi-1.9.1, unomi-2.4.0
            Reporter: Jonathan Sinovassin-Naïk


h2. {color:#0747a6}Observed behaviour:{color}
h3. With at least two UNOMI nodes running.
When sending two events which updates profile properties at almost same time, 
it happens that some data are not stored or removed on the profile. 
It means that one of the event replaces the profile data instead of adding it 
to the existing profile.

h2. {color:#0747A6}What is causing the issue:{color}
In an environment which contains two nodes: 
- node A
- node B

and rules that calling the copyPropertiesAction.

For example with two rules:

A rule that is triggered on view event:

{code:java}
...
"actions": [
    {
      "parameterValues": {
        "rootProperty": "flattenedProperties.URLParameters",
        "singleValueStrategy": "alwaysSet",
        "mandatoryPropTypeSystemTag": [
          "urlParameter"
        ]
      },
      "type": "copyPropertiesAction"
    }
  ]
...

{code}

A rule that is triggered on login event:

{code:java}
...
"actions": [
    {
      "parameterValues": {
        "mergeProfilePropertyValue": 
"eventProperty::target.properties(j:nodename)",
        "mergeProfilePropertyName": "mergeIdentifier"
      },
      "type": "mergeProfilesOnPropertyAction"
    },
    {
      "parameterValues": {
        "singleValueStrategy": "alwaysSet"
      },
      "type": "copyPropertiesAction"
    }
  ]
...

{code}

When UNOMI will receive an event of type view, the property 
flattenedProperties.URLParameters will be set to the profile.

When UNOMI will receive an event of type login, the property j:nodename and 
some other will be set to the profile.

h3. The steps to reproduced the issue:
Send a first event trough the contextRequest that will create a profile, a view 
event for example.
The profile will be create and the id of the profile will be sent back to the 
caller.

In the next events use the profile id that you got from the first event

Send a login event to node A and a view event to node B at the same time. 
On node A the step will be 
a1 - get existing profile
a2 - merge profile
a3 - copy properties
a4 - save updated profile

On node B the steps will be 
b1 - get existing profile
b2 - copy properties
b3 - save updated profile

But if the steps are executed as the following
a1 - get existing profile
b1 - get existing profile
a2 - merge profile
a3 - copy properties
b2 - copy properties
a4 - save updated profile
b3 - save updated profile

The profile will be updated at least on node B. But as the *get existing 
profile* in step b1 happened before the save in step a4, so the profile does 
not have yet the *j:nodename* property which will be stored.
It means that the profile won't have the *j:nodename* anymore.

This happens rarely because the steps has to be executed on a specific order to 
leads to. this result. But it can cause inconsistency in the data if it happens.
h2. Expected result:
The profile should contains the properties set by all events.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to