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
introduce history level auto, fixes #CAM-3444 #165
introduce history level auto, fixes #CAM-3444 #165
Conversation
This addresses the problem that when you configure multiple engines against one db, you have to explicitly set the right (unique) history level value, otherwise engine setup fails. WIth the new level "auto", the engine tries to guess the - new string constant "auto" - allow configuration with level "auto" to init() without choosing a historyLevel, this will be done during build() to avoid lifecycle mixup (db init ...) - during construction of the ProcessEngineImpl, it checks the already configured value via the OverwriteHistoryLevelCmd and overwrites auto/null with for example \ full/HistoryLevelFull. - afterwards, engine generation goes on as usual. - when auto is used for the first engine that creates the schema, the default fallback is "audit"
camunda BPM » camunda-bpm-platform #1545 SUCCESS |
import org.camunda.bpm.engine.impl.interceptor.CommandContext; | ||
|
||
|
||
public class OverwriteHistoryLevelCmd implements Command<Void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a good night sleep, I believe calling this "DetermineHistoryLevelCmd" and letting it return a history level would be more intuitive. We would still have to pass the list of available historyLevels, in case the use defined custom ones.
Its not a void command anymore, it returns the historyLevel
camunda BPM » camunda-bpm-platform #1548 SUCCESS |
Hi Jan, Thanks for your pull request which looks fine from a functionality point of view. I have two more things to ask: 1: Can you please adhere to our code style and use camel case instead of underscores in method names? In addition, it would be great if you could submit a pull request to the docs.camunda.org repostory adding some explanation for the AUTO level. For example, it could go here: http://docs.camunda.org/7.3/guides/user-guide/#process-engine-history-and-audit-event-log-choosing-a-history-level (source: https://github.com/camunda/docs.camunda.org/blob/master/site/src/documents/guides/user-guide/chapters/01-process-engine/06-history.html.md) Best regards, |
Hi Jan, Here is one more thing: ;) I think DetermineHistoryLevelCmd should fail when the database contains a not-null history level but the engine executing the command does not have this history level registered. With the current implementation, it would assume level AUDIT is correct (which then later fails when the history check is performed again). I think DetermineHistoryLevelCmd should already throw an exception at that point. Also, have you considered making the AUTO logic part of the command SchemaOperationsProcessEngineBuild, in particular the method checkHistoryLevel? In case of AUTO, it could just react differently by setting the retrieved level for the current engine instead of throwing an exception. That would keep the history- and database-related logic in one place. Cheers, |
* DatabaseHistoryPropertyAutoTest#usesDefaultValueAuditWhenNoValueIsConfigured() now checks if the configurations value is replaced * moved auto-init from ProcessEngineImpl#init to SchemaOperationsProcessEngineBuild#checkHistoryLevel() * minor: SchemaOperationsProcessEngineBuild is now Command<Void>, it returned null anyway
Hi Thorben. I did some changes, please check the new commit:
This should address your issues except documentation (will deal with that tomorrow). |
camunda BPM » camunda-bpm-platform #1561 SUCCESS |
Hi Jan, |
You mean, like this?
Should I really provide a PR? :-) |
Hi Jan, Yes that would be great and thanks for the regular expression. There may be some more things involved, like: when using the And: at the moment I am only speaking for myself. I am not sure the other guys agree. Daniel |
I created https://app.camunda.com/jira/browse/CAM-4301 for further discussion. Could you perhaps fix the formatting? over and out. |
Hi Jan, I am about to merge your contribution and make some small changes. I think about the case, where the history is set to "auto" and the level was fetched from the database. I would prefer only overriding the "historyLevel" property, not "history" in the engine config. Then, it is possible to determine later on whether an engine has been configured with AUTO or for example AUDIT. Is that fine for you? Cheers, |
Go ahead. I thought its best when those to attributes are in sync, but you have a good point too. One more thing while you are on it: AUDIT is an implicit default value. Right now two or three locations use it to express default. It would be better to define a HISTORY_DEFAULT constant that references AUDIT, so we have an explicit default. Would be cleaner when one day FULL becomes the new default .... |
Hi Jan, Thanks for your efforts in providing this feature and incorporating my feedback. I just merged it to master: d914d46 Thanks for the remark on the default history setting. I added a constant and a method that gets the default level. Cheers, |
Nice, thanks. How do you want to continue with documentation? new PR? |
Yes, a second pull request to https://github.com/camunda/docs.camunda.org would be nice. I'll keep the JIRA issue https://app.camunda.com/jira/browse/CAM-3444 open. |
This addresses the problem that when you configure multiple engines against one db, you have to explicitly set the right (unique) history level value, otherwise engine setup fails. WIth the new level "auto", the engine tries to guess the
full/HistoryLevelFull.