mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Fix failing bulk launch job due to create partition race
https://github.com/ansible/awx/pull/14910/files introduced a bug where we no longer accept the right exceptions when 2 job launch at the sametime and try to create jobevent table partition 1 of the job will fail
This commit is contained in:
parent
949e7efab1
commit
a635445082
@ -1160,14 +1160,13 @@ def create_partition(tblname, start=None):
|
||||
except (ProgrammingError, IntegrityError) as e:
|
||||
cause = e.__cause__
|
||||
if cause and hasattr(cause, 'sqlstate'):
|
||||
# 42P07 = DuplicateTable
|
||||
sqlstate = cause.sqlstate
|
||||
sqlstate_str = psycopg.errors.lookup(sqlstate)
|
||||
sqlstate_cls = psycopg.errors.lookup(sqlstate)
|
||||
|
||||
if psycopg.errors.DuplicateTable == sqlstate:
|
||||
if psycopg.errors.DuplicateTable == sqlstate_cls or psycopg.errors.UniqueViolation == sqlstate_cls:
|
||||
logger.info(f'Caught known error due to partition creation race: {e}')
|
||||
else:
|
||||
logger.error('SQL Error state: {} - {}'.format(sqlstate, sqlstate_str))
|
||||
logger.error('SQL Error state: {} - {}'.format(sqlstate, sqlstate_cls))
|
||||
raise
|
||||
except DatabaseError as e:
|
||||
cause = e.__cause__
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user