0001-sql-lock-wcs_meta-table-during-schema-update-57017.patch
wcs/sql.py | ||
---|---|---|
388 | 388 |
return get_publisher().pgconn |
389 | 389 | |
390 | 390 | |
391 |
def lock_wcs_meta(timeout=0): |
|
392 |
conn, cur = get_connection_and_cursor() |
|
393 |
do_meta_table(conn, cur, insert_current_sql_level=False) |
|
394 |
if timeout: |
|
395 |
cur.execute('SET LOCAL lock_timeout = %s', [timeout]) |
|
396 |
cur.execute('LOCK wcs_meta') |
|
397 | ||
398 | ||
391 | 399 |
def cleanup_connection(): |
392 | 400 |
if hasattr(get_publisher(), 'pgconn') and get_publisher().pgconn is not None: |
393 | 401 |
get_publisher().pgconn.close() |
... | ... | |
512 | 520 | |
513 | 521 |
@guard_postgres |
514 | 522 |
def do_formdef_tables(formdef, conn=None, cur=None, rebuild_views=False, rebuild_global_views=True): |
523 |
lock_wcs_meta(timeout=10000) |
|
524 | ||
515 | 525 |
if formdef.id is None: |
516 | 526 |
return [] |
517 | 527 | |
... | ... | |
3517 | 3527 | |
3518 | 3528 |
@guard_postgres |
3519 | 3529 |
def migrate(): |
3530 |
lock_wcs_meta() |
|
3520 | 3531 |
conn, cur = get_connection_and_cursor() |
3521 | 3532 |
sql_level = get_sql_level(conn, cur) |
3522 | 3533 |
if sql_level < 0: |
3523 |
- |