summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-08-27 14:04:50 +0200
committerChristian Grothoff <grothoff@gnunet.org>2023-08-27 14:04:50 +0200
commit1239901f42403ce391a2853b199740f17735f421 (patch)
treeeda1cd5e026ee799ec7f70cddc0d9b762fac6000
parenta840b38627d3e63c84cf6132d2a7cd0802fbda7c (diff)
downloadsync-1239901f42403ce391a2853b199740f17735f421.tar.gz
sync-1239901f42403ce391a2853b199740f17735f421.tar.bz2
sync-1239901f42403ce391a2853b199740f17735f421.zip
-fix issue with multiple dbinit running concurrently
-rw-r--r--src/sync/sync-httpd_mhd.c2
-rw-r--r--src/syncdb/versioning.sql7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/sync/sync-httpd_mhd.c b/src/sync/sync-httpd_mhd.c
index fa2344b..54b41f2 100644
--- a/src/sync/sync-httpd_mhd.c
+++ b/src/sync/sync-httpd_mhd.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014, 2015, 2016 GNUnet e.V. and INRIA
+ Copyright (C) 2014, 2015, 2016 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
diff --git a/src/syncdb/versioning.sql b/src/syncdb/versioning.sql
index 116f409..c7fa812 100644
--- a/src/syncdb/versioning.sql
+++ b/src/syncdb/versioning.sql
@@ -146,12 +146,17 @@
BEGIN;
+-- Added by Christian Grothoff to support concurrency, see
+-- https://stackoverflow.com/questions/29900845/create-schema-if-not-exists-raises-duplicate-key-error?rq=4
+LOCK TABLE pg_catalog.pg_namespace;
+
+
-- This file adds versioning support to database it will be loaded to.
-- It requires that PL/pgSQL is already loaded - will raise exception otherwise.
-- All versioning "stuff" (tables, functions) is in "_v" schema.
-- All functions are defined as 'RETURNS SETOF INT4' to be able to make them to RETURN literally nothing (0 rows).
--- >> RETURNS VOID<< IS similar, but it still outputs "empty line" in psql when calling.
+-- >> RETURNS VOID<< IS similar, but it still outputs "empty line" in psql when calling
CREATE SCHEMA IF NOT EXISTS _v;
COMMENT ON SCHEMA _v IS 'Schema for versioning data and functionality.';