Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d2k2N-00031o-9m for pgsql-bugs@arkaria.postgresql.org; Mon, 24 Apr 2017 19:52:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d2k2M-0003EX-IQ for pgsql-bugs@arkaria.postgresql.org; Mon, 24 Apr 2017 19:52:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d2k2L-0003Dr-Jj for pgsql-bugs@postgresql.org; Mon, 24 Apr 2017 19:52:41 +0000 Received: from mail-vk0-x229.google.com ([2607:f8b0:400c:c05::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d2k2I-0005QH-VJ for pgsql-bugs@postgresql.org; Mon, 24 Apr 2017 19:52:39 +0000 Received: by mail-vk0-x229.google.com with SMTP id k4so42293896vki.1 for ; Mon, 24 Apr 2017 12:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citusdata.com; s=google; h=from:mime-version:subject:message-id:date:to; bh=7Is1Y8DBys9q8TkIRAK8xdEfGFxJIcbZBiAEHE5rCL8=; b=AxKJMvJcJc9QqCkt1ua6+0P9+GB3YYQYUrp59fsVAsyBy93Ef0x1edmvXk6YpKiv15 hczTxhh8faVlXd/RiMf1BD1b0SO3XVjDzJb7d9slu/5GRHZIGdF/OUtivyDwdZ2/uOva 9RjtdgjtjmMk5DTU4leGMxJIUSLjD8M2/GRn4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=7Is1Y8DBys9q8TkIRAK8xdEfGFxJIcbZBiAEHE5rCL8=; b=rxHRDYJ0u6L8zMQJ1YUgHyq7tzQEcSfkcz16dqVD8q3nCEc/Kb5u3TxVvEPK1TMUkY r3aMrXlKgsX4dv+4aFXCac9OvmdDVsb/jycYO4S62FDYXFNCsMMxJOSj2HQDYhNZyaTb ZUEeFLeD5rTaGjSF/4Gnt5KbRMirniy1IUIHSBgc2cAVWUXjHwsOleTqgjLvXvjESuJl qBD5EZfW3XioHlAUgGsdbFKeEoi7x6yc31hM4rk8lqjZ+mROgUzk4s0OiBJN8WVuXGr/ gNypU2D1F0ski9nDPevuD9htDuuEGbQhc9rJqklHtt8ayQXjBaE4rnhovTUORmbCsuvV ueNQ== X-Gm-Message-State: AN3rC/5r1fFDsTA55CnrhobjlIg2/alonWYohDQzwcH8GoAcFSu0Dzpe LtSinG1vNlk52s1PBIPPng== X-Received: by 10.31.218.193 with SMTP id r184mr2915086vkg.112.1493063557022; Mon, 24 Apr 2017 12:52:37 -0700 (PDT) Received: from [10.137.0.122] ([69.197.45.37]) by smtp.gmail.com with ESMTPSA id j36sm432093uad.28.2017.04.24.12.52.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Apr 2017 12:52:35 -0700 (PDT) From: Jason Petersen Content-Type: multipart/signed; boundary="Apple-Mail=_66F328CF-208A-4C78-ABE3-840DD38600E5"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Concurrent ALTER SEQUENCE RESTART Regression Message-Id: Date: Mon, 24 Apr 2017 13:52:33 -0600 To: pgsql-bugs@postgresql.org X-Mailer: Apple Mail (2.3273) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --Apple-Mail=_66F328CF-208A-4C78-ABE3-840DD38600E5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I recently found a behavior regression for ALTER SEQUENCE. Repro. Steps =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1. Create a new sequence: CREATE SEQUENCE my_seq; 2. Start this loop twice in different shells: while true; do psql -1Xtc 'ALTER SEQUENCE my_seq RESTART 1'; done Expected (pre-10) Behavior =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D Each loop should repeatedly succeed and simply print ALTER SEQUENCE over = and over. Actual (PG 10) Behavior =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The output stream is punctuated by occasional "ERROR: tuple = concurrently updated" messages. Summary =3D=3D=3D=3D=3D=3D=3D While I understand the above workload is nonsensical, given the = non-transactional behavior of ALTER SEQUENCE statements, previous = PostgreSQL versions did not produce an error. It is likely applications = have been coded with that assumption and will not deal well with the new = behavior. Having poked around the code a bit, I see the functions to access for = sequence state have changed; I=E2=80=99m assuming this is an unintended = side-effect of that change. I haven=E2=80=99t worked up a patch myself, but I have some hope someone = more familiar with the underlying changes could make quick work of this. -- Jason Petersen Software Engineer | Citus Data 303.736.9255 jason@citusdata.com --Apple-Mail=_66F328CF-208A-4C78-ABE3-840DD38600E5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJY/leCAAoJEJ8dNRDREKup0I4H/RPgPorp7M2DUHX90UbZqPjU Wx4rF2lV+1WhDuk45Dq9UeSW+qg1EZasIn3FPsOconEj+1WO/ZXihdrd86xPojuz kfdpq8PxCRZOIVovyIBpZ2ecNRtv8zqVfpXZlrCVwdxdpCbDBeMnEPGv8PSDsy1H zfEoGt8jtQY97xkB07oAVteXVbOyNSCw9UELRlwc9JOftf6jnpErdbOVG2kBUT9j B8/wzVGb7KtHpnsEr9PF2FaCadxo/40Jp8qzlZFoqadmI/v7d1vesWV6eRUl9jEU BkYb3/hvh9eUwpkxBwhTj1MRQd7V05ej8m9YBMYRdPALL/liNL/MvgFM/TWCBPs= =X1sp -----END PGP SIGNATURE----- --Apple-Mail=_66F328CF-208A-4C78-ABE3-840DD38600E5--