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 1glfvB-0007Uo-06 for pgsql-committers@arkaria.postgresql.org; Mon, 21 Jan 2019 20:11:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1glfv9-00045j-G6 for pgsql-committers@arkaria.postgresql.org; Mon, 21 Jan 2019 20:11:47 +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 1glfv8-00045b-GG for pgsql-committers@lists.postgresql.org; Mon, 21 Jan 2019 20:11:47 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glfv0-0002BN-Tz for pgsql-committers@lists.postgresql.org; Mon, 21 Jan 2019 20:11:46 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A795F28786; Mon, 21 Jan 2019 15:11:37 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 21 Jan 2019 15:11:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=r4Q9PuKS4YBDuVMt9SkbZk/lQwU a2wNm1ZcpN6Ht+y4=; b=JCapbRbSLC9JflpbGvJc6Rl9Tl1NTeryYkqbQphTcxD VWrv1OPT4KJVEYJXeyxbxUf2FgJs9zwKvdhLs3MTPft6GfAQkpcVCHOltDHkKXOF Kp3VV08McKRvwb1BSB1bLo5iWGGEyAQdiyXSbJilJT4gcXLL9Qq3N7GbouXTjxhG ULvxvbdY9bVVnVXMPQcP4SktOWJfacO0KHzp72LFRJwlCzK9LI/8d5shuD3YHl3m K37NqjJVXVwISb+h1NVNcWQ3DhHEKaAmAZY0uXR1vvDC1rJmLY5aJeNmW7MgyvJG cgnx+p13mbjIfQFCuaPblBOSaQVyAShDuFrcgSgFmzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=r4Q9Pu KS4YBDuVMt9SkbZk/lQwUa2wNm1ZcpN6Ht+y4=; b=Rux38XWHuRGyZM9SNBocxj /j0tMC/z2e/agwu+BNZ4Jfd2sWTbXVTSzwA6bJ6O/9HqdA+uU0/aqbpm0B6ME0wd gxxQ6NFmFPBZsdgCk7CheJbEjDcNfXBM128IP0Di4IS3HOszqKKxR3NMsiXFeVq7 eep91sIVg/UmE9359a78+1unfNofoNnpr4O2QvhPFkDa7i2KKYzCCI1iHSQnqful CWCeF4hr3NOJowoNvt47kPxsKXo3+zoviBS05l15VMcTLIUq6jwfp/s1gXhtokmz i9e4LXDXkK+8ZsNZf9NGjPxJRSmbB4CkeHMBevYeCzp4MiD3imB8j346xOqwCMkw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrheeigddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpe etnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeen ucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeelkedrvddutddrud egtddrudejudenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgr iigvlhdruggvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from intern.anarazel.de (c-98-210-140-171.hsd1.ca.comcast.net [98.210.140.171]) by mail.messagingengine.com (Postfix) with ESMTPA id E76D410085; Mon, 21 Jan 2019 15:11:36 -0500 (EST) Date: Mon, 21 Jan 2019 12:11:34 -0800 From: Andres Freund To: Tom Lane Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Sort the dependent objects before recursing in findDependentObje Message-ID: <20190121201134.dyx6anto6akflh5d@alap3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-01-21 18:48:25 +0000, Tom Lane wrote: > Sort the dependent objects before recursing in findDependentObjects(). > > Historically, the notices output by DROP CASCADE tended to come out > in uncertain order, and in some cases you might get different claims > about which object depends on which other one. This is because we > just traversed the dependency tree in the order in which pg_depend > entries are seen, and nbtree has never promised anything about the > order of equal-keyed index entries. We've put up with that for years, > hacking regression tests when necessary to prevent them from emitting > unstable output. However, it's a problem for pending work that will > change nbtree's behavior for equal keys, as that causes unexpected > changes in the regression test results. > > Hence, adjust findDependentObjects to sort the results of each > indexscan before processing them. The sort is on descending OID of > the dependent objects, hence more or less reverse creation order. > While this rule could still result in bogus regression test failures > if an OID wraparound occurred mid-test, that seems unlikely to happen > in any plausible development or packaging-test scenario. > > This is enough to ensure output stability for ordinary DROP CASCADE > commands, but not for DROP OWNED BY, because that has a different > code path with the same problem. We might later choose to sort in > the DROP OWNED BY code as well, but this patch doesn't do so. > > I've also not done anything about reverting the existing hacks to > suppress unstable DROP CASCADE output in specific regression tests. > It might be worth undoing those, but it seems like a distinct question. > > The first indexscan loop in findDependentObjects is not touched, > meaning there is a hazard of unstable error reports from that too. > However, said hazard is not the fault of that code: it was designed > on the assumption that there could be at most one "owning" object > to complain about, and that assumption does not seem unreasonable. > The recent patch that added the possibility of multiple > DEPENDENCY_INTERNAL_AUTO links broke that assumption, but we should > fix that situation not band-aid around it. That's a matter for > another patch, though. Seems this affects the sepgsql tests: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=rhinoceros&dt=2019-01-21%2019%3A45%3A02 --- /opt/src/pgsql-git/build-farm-root/HEAD/pgsql.build/contrib/sepgsql/expected/ddl.out 2018-11-20 21:45:02.786933457 -0800 +++ /opt/src/pgsql-git/build-farm-root/HEAD/pgsql.build/contrib/sepgsql/results/ddl.out 2019-01-21 11:51:23.178651387 -0800 @@ -421,10 +421,10 @@ LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.q" DROP TABLE regtest_table; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" -LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_x_seq" -LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" +LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_x_seq" +LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.cmax" Yay for having to fix tests blindly :( Greetings, Andres Freund