Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHPAM-2789] CorrelationKeyInfo table is used even without using correlation key functionality #1607

Merged
merged 1 commit into from Mar 19, 2020

Conversation

elguardian
Copy link
Member

remove select for CorrelationKeyInfo and adding unique index

@elguardian
Copy link
Member Author

This is ok to test.

assertTrue(log.getCorrelationKey().contains(":src.Process4"));
} finally {
System.clearProperty("org.jbpm.correlationkey.length");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be probably good to correct (and retain) such a test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a faulty test in my opinion due to the way of constructing the correlation key is creating keys bigger than 70.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that is the point of the test - or should be - to check if it is trimmed in case a system property is defined.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a faulty test.

persist correlation info: null
Process1
persist correlation info: 1:src.Process2:1584350223097
Process2
persist correlation info: 1:src.Process2:1584350223097:src.Process3:1584350223109
Process3
2020-03-16 10:17:03,119 [main] WARN CorrelationKey content was trimmed as it was too long (more than 70 characters)
persist correlation info: 1:src.Process2:1584350223097:src.Process3:1584350223109:src.Process4:1
2020-03-16 10:17:03,124 [main] WARN CorrelationKey content was trimmed as it was too long (more than 70 characters)
Process4
2020-03-16 10:17:03,130 [main] WARN CorrelationKey content was trimmed as it was too long (more than 70 characters)
2020-03-16 10:17:03,130 [main] WARN CorrelationKey content was trimmed as it was too long (more than 70 characters)
persist correlation info: 1:src.Process2:1584350223097:src.Process3:1584350223109:src.Process4:1
2020-03-16 10:17:03,132 [main] WARN SQL Error: 23505, SQLState: 23505

The trim is correct, the problem is that process 4 (already excceds the 70 positions) and process 5 generates the same as process 4 correlation key that is the reason it is failing now when you haven an index in database.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

than I guess we can limit it to for example to 100 and it should be fine, wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I fixed the test. just to give you the bits. The test was working because another bug in

https://github.com/kiegroup/jbpm/blob/master/jbpm-persistence/jbpm-persistence-jpa/src/main/java/org/jbpm/persistence/JpaProcessPersistenceContext.java#L118

this uses this function:
https://github.com/kiegroup/jbpm/blob/master/jbpm-persistence/jbpm-persistence-jpa/src/main/java/org/jbpm/persistence/JpaProcessPersistenceContext.java#L142

if you see it uses the externalForm of the correlation Key... the problem is that the external form is not being trimmed like the name

so it can happen that while the name is trimmed you are looking for a key not trimmed not finding the right the right one. That is the reason is a faulty test.

I did follow you recomendation and added the check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... Well, the original issue was that only process instance log were affected for the reporter of the issue, so in fact CorrelationKeyInfo class change wasn't even needed in the end and was done just for consistency (which in fact wasn't consistent as you found out :) ) Good catch!

@elguardian elguardian force-pushed the RHPAM-2789 branch 2 times, most recently from 33b927e to cd07d66 Compare March 16, 2020 10:09
@elguardian elguardian changed the title [RHAPM-2789] CorrelationKeyInfo table is used even without using correlation key functionality [RHPAM-2789] CorrelationKeyInfo table is used even without using correlation key functionality Mar 16, 2020
…elation key functionality

remove select for CorrelationKeyInfo and adding unique index
@sonarcloud
Copy link

sonarcloud bot commented Mar 16, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 1 Code Smell

85.7% 85.7% Coverage
0.0% 0.0% Duplication

@elguardian elguardian merged commit 921c1c3 into kiegroup:master Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants