05-11-2017 09:36 PM
activiti uses DBIdGenerator default, when the id block used up, it will request for another block from db, and increase its
current id status, but I am wondering when will the operation of writing id back to db be performed,
if in the same transaction with other operation like update history identity_link, history_task_instance, what will occur when exception arisen? the id in DbIdGenerator wont rollback, and the new id wont commit to db, so next time it request for new block will result in using the old ids?
what I am missing?
05-11-2017 10:34 PM
According to Activiti user guide, DbIdGenerator seems to be assumed to have problems.
https://www.activiti.org/userguide/#advanced.uuid.generator
> In some (very) high concurrency load cases, the default id generator may cause exceptions due to not being able to fetch new id blocks quickly enough.
> In (very) limited use cases this can cause problems when there is a real high load.
And, you can use the alternative(the org.activiti.engine.impl.persistence.StrongUuidGenerator)
> which generates a unique UUID locally and uses that as identifier for all entities. Since the UUID is generated without the need for database access, it copes better with very high concurrency use cases.
Or, you can use your original id generator by implementing interface IdGenerator and setting processEngineConfiguration.
05-11-2017 10:48 PM
not in (very) high concurrency load cases, I mean, not because of high concurrency.
just because the operation of flushing id to db and other operations mix in one transaction,
if some exceptions arisen for business logic error, this will result in id rollback, and the id in DbIdGenerator wont rollback.
Hope this will express myself clear
05-17-2017 05:52 AM
Sorry for asking a nonexistent question.
DbIdGenerator will use a REQUIRES_NEW propagation commandConfig, the source code is in ProcessEngineConfigurationImpl.
So, why there is a "duplicate key error" happened to activiti, still don't know how this happenes!
05-19-2017 11:31 AM
Explore our Alfresco products with the links below. Use labels to filter content by product module.