Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gN9iq-0006dm-K4 for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Nov 2018 04:57:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gN9io-0005yo-88 for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Nov 2018 04:57:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gN9in-0005yh-P4 for pgsql-hackers@lists.postgresql.org; Thu, 15 Nov 2018 04:57:42 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gN9ig-0005Ep-Qf for pgsql-hackers@postgresql.org; Thu, 15 Nov 2018 04:57:41 +0000 Received: by mail-pl1-x641.google.com with SMTP id v1-v6so1744106plo.2 for ; Wed, 14 Nov 2018 20:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xRA8IWX44XUuuIMHufyHkYWyF5gfdCerGFE1CEiJPHM=; b=eld7pOzOdWvW5r8cWjwaZ9LyBvWrMuLjJCm5ZbayIskHSzWRJAur4Pu2wEJaIw9ueS E6su9ma4bNQq/5Nl2qEptrgJhcqFkEUZsNSOHRIk3ZxMHIE4pTdDMi8NppsfFonxufUK 8REBJilm0tihyKL1RbKamhb8FP9Sl9whyQxdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xRA8IWX44XUuuIMHufyHkYWyF5gfdCerGFE1CEiJPHM=; b=lWccC6bMGmycQvr4AQosn97/cTtM1eTkjaLGxjSfcRgzuuJkK4X5GRtWEMA32k4G+z sMSdYw7GD73G+lF8AKLMQ2LOnFsfzkkMkHmiOnQT2gycYT0QtHfFyNoLK+8hbK3jPFtf b8/DUe5mawP1oSf7OeTWt6Nh54FP42138Ba5/qf4IPMYRbS4QhA80vNZyfIUCp7lDul7 qT1GXoQEgwZoP+p/LS4UBqQrTCXP7DvEVYV0thNlsjKzYxvzGSW+XECHYqgGkMpvH5OD OlhLFzAlAR6WjYlmW898lUsdaHV9gpxiw2I5m+W50k00+RSVJXvNgCa1Ws6Oir1lb/ut q5HA== X-Gm-Message-State: AGRZ1gLk7hq7dsR5oReCzW1aC/dt656WIKr6VNkjK1EaYOfyY5MC5dxO X9C/pMjxGtavt5q1WMYxitkkkQ== X-Google-Smtp-Source: AJdET5e9aaeVzytEYlqUFOJzsPsx+ZaZ7qADmDuDcRGxqiYXisS5kDIYZeaxoex2jVm/cOHxdpcOTg== X-Received: by 2002:a17:902:2cc3:: with SMTP id n61-v6mr4851135plb.76.1542257851923; Wed, 14 Nov 2018 20:57:31 -0800 (PST) Received: from rfd.leadboat.com (c-73-158-248-138.hsd1.ca.comcast.net. [73.158.248.138]) by smtp.gmail.com with ESMTPSA id w66-v6sm28146970pfb.51.2018.11.14.20.57.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 20:57:30 -0800 (PST) Date: Thu, 15 Nov 2018 04:57:28 +0000 From: Noah Misch To: Andres Freund Cc: pgsql-hackers@postgresql.org Subject: Re: [RFC] Removing "magic" oids Message-ID: <20181115045728.GA1121738@rfd.leadboat.com> References: <20180930034810.ywp2c7awz7opzcfr@alap3.anarazel.de> <20181114080152.xkk6coduvfrh4ntr@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181114080152.xkk6coduvfrh4ntr@alap3.anarazel.de> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Nov 14, 2018 at 12:01:52AM -0800, Andres Freund wrote: > - one pgbench test tested concurrent insertions into a table with > oids, as some sort of stress test for lwlocks and spinlocks. I *think* > this doesn't really have to be a system oid column, and this was just > because that's how we triggered a bug on some machine. Noah, do I get > this right? The point of the test is to exercise OidGenLock by issuing many parallel GetNewOidWithIndex() and verifying absence of duplicates. There's nothing special about OidGenLock, but it is important to use an operation that takes a particular LWLock many times, quickly. If the test query spends too much time on things other than taking locks, it will catch locking races too rarely. > --- a/src/bin/pgbench/t/001_pgbench_with_server.pl > +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl > @@ -48,28 +48,26 @@ sub pgbench > return; > } > > -# Test concurrent insertion into table with UNIQUE oid column. DDL expects > -# GetNewOidWithIndex() to successfully avoid violating uniqueness for indexes > -# like pg_class_oid_index and pg_proc_oid_index. This indirectly exercises > -# LWLock and spinlock concurrency. This test makes a 5-MiB table. > +# Test concurrent insertion into table with serial column. This > +# indirectly exercises LWLock and spinlock concurrency. This test > +# makes a 5-MiB table. > > $node->safe_psql('postgres', > - 'CREATE UNLOGGED TABLE oid_tbl () WITH OIDS; ' > - . 'ALTER TABLE oid_tbl ADD UNIQUE (oid);'); > + 'CREATE UNLOGGED TABLE insert_tbl (id serial primary key); '); > > pgbench( > '--no-vacuum --client=5 --protocol=prepared --transactions=25', > 0, > [qr{processed: 125/125}], > [qr{^$}], > - 'concurrency OID generation', > + 'concurrent insert generation', > { > - '001_pgbench_concurrent_oid_generation' => > - 'INSERT INTO oid_tbl SELECT FROM generate_series(1,1000);' > + '001_pgbench_concurrent_insert' => > + 'INSERT INTO insert_tbl SELECT FROM generate_series(1,1000);' The code for sequences is quite different, so this may or may not be an effective replacement. To study that, you could remove a few barriers from lwlock.c, measure how many iterations today's test needs to catch the mutation, and then measure the same for this proposal.