Issue 17619

Writing to unique names & citation table not thread safe

17619
Reporter: mdoering
Assignee: mdoering
Type: Bug
Summary: Writing to unique names & citation table not thread safe
Priority: Critical
Resolution: Fixed
Status: Resolved
Created: 2015-06-10 14:02:33.355
Updated: 2015-06-12 17:17:55.295
Resolved: 2015-06-12 17:17:55.254
        
Description: As the mybatis service might be used with multiple instances in multi threaded environments like the CLB importing CLI it is possible to insert duplicate values for names or citation strings. The current getOrCreate method could be synchronized, but that does not help across different JVMs:
https://github.com/gbif/checklistbank/blob/master/checklistbank-mybatis-service/src/main/java/org/gbif/checklistbank/service/mybatis/ParsedNameServiceMyBatis.java#L35

Make sure we have unique name and citation tables as we otherwise run into other sql issues down the line. Consider transaction locks within postgres or adding a unique constraint and catching write exceptions.]]>
    


Author: mdoering@gbif.org
Comment: https://github.com/gbif/checklistbank/commit/dae863eaf132fc9634db65aaffa959839ceff99c
Created: 2015-06-12 17:17:55.277
Updated: 2015-06-12 17:17:55.277