title: Duplicate row when multiple threads insert the same content in the mysql database
body: <p>I have one mysql table which looks like</p>
  
  <h2>id | property_code | property_value</h2>
  
  <p>The id is auto increment, is the primary key in this table.</p>
  
  <p>when I have multiple threads in the distributed machines, insert the same content to this table, so that a duplicate will happen.</p>
  
  <h2> 1 | code_1 | value1</h2>
  
  <h2> 2 | code_1 | value1</h2>
  
  <p>I know if I set the property_code as the primary key, it will solve this problem.
  is there any other solution to solve this problem if I don't want to change the primary key?</p>