Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-06 Thread Fabrízio de Royes Mello
On Wed, Aug 5, 2015 at 9:21 PM, Michael Paquier michael.paqu...@gmail.com wrote: On Thu, Aug 6, 2015 at 3:06 AM, Fabrízio de Royes Mello wrote: On Wed, Aug 5, 2015 at 9:31 AM, Robert Haas wrote: Agreed. I think we're making a mountain out of a molehill here. As long as the locks that are

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-05 Thread Robert Haas
On Tue, Aug 4, 2015 at 1:15 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: That opens up for lock escalation and deadlocks, doesn't it? You are probably thinking that it's okay to ignore those but I don't necessarily agree with that. Agreed. I think we're making a mountain out of a

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-05 Thread Fabrízio de Royes Mello
On Wed, Aug 5, 2015 at 9:31 AM, Robert Haas robertmh...@gmail.com wrote: On Tue, Aug 4, 2015 at 1:15 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: That opens up for lock escalation and deadlocks, doesn't it? You are probably thinking that it's okay to ignore those but I don't

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-05 Thread Michael Paquier
On Thu, Aug 6, 2015 at 3:06 AM, Fabrízio de Royes Mello wrote: On Wed, Aug 5, 2015 at 9:31 AM, Robert Haas wrote: Agreed. I think we're making a mountain out of a molehill here. As long as the locks that are actually used are monotonic, just use and stick a comment in there explaining that

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-04 Thread Andres Freund
On 2015-08-03 14:15:27 +0900, Michael Paquier wrote: On Sat, Aug 1, 2015 at 9:20 PM, Andres Freund wrote: On August 1, 2015 2:17:24 PM GMT+02:00, Michael Paquier wrote: For instance, if you told me to choose between ShareLock and ShareUpdateExclusiveLock I wouldn't know which one is

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-04 Thread Fabrízio de Royes Mello
On Tue, Aug 4, 2015 at 5:55 AM, Andres Freund and...@anarazel.de wrote: On 2015-08-03 14:15:27 +0900, Michael Paquier wrote: On Sat, Aug 1, 2015 at 9:20 PM, Andres Freund wrote: On August 1, 2015 2:17:24 PM GMT+02:00, Michael Paquier wrote: For instance, if you told me to choose between

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-04 Thread Michael Paquier
On Wed, Aug 5, 2015 at 2:15 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Andres Freund wrote: On 2015-08-03 14:15:27 +0900, Michael Paquier wrote: As long as this only applies on master, this may be fine... We could basically pass a LOCKMASK to the multiple layers of tablecmds.c

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-04 Thread Alvaro Herrera
Andres Freund wrote: On 2015-08-03 14:15:27 +0900, Michael Paquier wrote: As long as this only applies on master, this may be fine... We could basically pass a LOCKMASK to the multiple layers of tablecmds.c instead of LOCKMODE to track all the locks that need to be taken, and all the

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-03 Thread Fabrízio de Royes Mello
On Mon, Aug 3, 2015 at 2:15 AM, Michael Paquier michael.paqu...@gmail.com wrote: On Sat, Aug 1, 2015 at 9:20 PM, Andres Freund wrote: On August 1, 2015 2:17:24 PM GMT+02:00, Michael Paquier wrote: For instance, if you told me to choose between ShareLock and ShareUpdateExclusiveLock I

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-03 Thread Michael Paquier
On Tue, Aug 4, 2015 at 9:12 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Are you sure we need to do all this changes just to check the highest locklevel based on the reloptions? Well, by looking at the code that's what it looks as. That's a large change not that straight-forward.

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-01 Thread Michael Paquier
On Sat, Aug 1, 2015 at 5:00 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Fabrízio de Royes Mello wrote: In this patch I didn't change all lockmode comparison places previous pointed by you, but I can change it maybe adding other method called LockModeIsValid(lockmode) to do the

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-08-01 Thread Andres Freund
On August 1, 2015 2:17:24 PM GMT+02:00, Michael Paquier michael.paqu...@gmail.com wrote: On Sat, Aug 1, 2015 at 5:00 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Fabrízio de Royes Mello wrote: In this patch I didn't change all lockmode comparison places previous pointed by you, but I

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-31 Thread Michael Paquier
On Fri, Jul 31, 2015 at 10:05 PM, Simon Riggs si...@2ndquadrant.com wrote: On 31 July 2015 at 02:46, Michael Paquier michael.paqu...@gmail.com wrote: Added. I really don't know if my isolation tests are completely correct, is my first time writing this kind of tests. This patch size has

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-31 Thread Michael Paquier
On Fri, Jul 31, 2015 at 11:41 AM, Fabrízio de Royes Mello wrote: We usually don't compare lock values that way, i.e. there's not guaranteed to be a strict monotonicity between lock levels. I don't really agree with that policy, but it's nonetheless there. And how is the better way to compare

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-31 Thread Michael Paquier
On Fri, Jul 31, 2015 at 12:21 PM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Thu, Jul 30, 2015 at 10:46 PM, Michael Paquier wrote: On further notice, I would recommend not to use the same string name for the session and the query identifiers. And I think that inserting only

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-31 Thread Simon Riggs
On 31 July 2015 at 02:46, Michael Paquier michael.paqu...@gmail.com wrote: Added. I really don't know if my isolation tests are completely correct, is my first time writing this kind of tests. This patch size has increased from 16k to 157k because of the output of the isolation tests you

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-31 Thread Fabrízio de Royes Mello
On Fri, Jul 31, 2015 at 10:01 AM, Michael Paquier michael.paqu...@gmail.com wrote: On Fri, Jul 31, 2015 at 11:41 AM, Fabrízio de Royes Mello wrote: We usually don't compare lock values that way, i.e. there's not guaranteed to be a strict monotonicity between lock levels. I don't really

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-31 Thread Alvaro Herrera
Fabrízio de Royes Mello wrote: In this patch I didn't change all lockmode comparison places previous pointed by you, but I can change it maybe adding other method called LockModeIsValid(lockmode) to do the comparison lockmode = NoLock lockmode MAX_LOCKMODES used in many places. I don't

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-30 Thread Fabrízio de Royes Mello
On Thu, Jul 30, 2015 at 11:28 PM, Andres Freund and...@anarazel.de wrote: @@ -57,7 +57,8 @@ static relopt_bool boolRelOpts[] = If we go through this list, I'd rather make informed decisions about each reloption. Otherwise we're going to get patches for each of them separately over the next

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-30 Thread Michael Paquier
On Fri, Jul 31, 2015 at 11:28 AM, Andres Freund and...@anarazel.de wrote: @@ -57,7 +57,8 @@ static relopt_bool boolRelOpts[] = If we go through this list, I'd rather make informed decisions about each reloption. Otherwise we're going to get patches for each of them separately over the next

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-30 Thread Fabrízio de Royes Mello
On Thu, Jul 30, 2015 at 10:46 PM, Michael Paquier michael.paqu...@gmail.com wrote: This patch size has increased from 16k to 157k because of the output of the isolation tests you just added. This is definitely too large and actually the test coverage is rather limited. Hence I think that they

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-30 Thread Andres Freund
@@ -57,7 +57,8 @@ static relopt_bool boolRelOpts[] = If we go through this list, I'd rather make informed decisions about each reloption. Otherwise we're going to get patches for each of them separately over the next versions. @@ -73,7 +75,8 @@ static relopt_bool boolRelOpts[] =

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-30 Thread Michael Paquier
On Fri, Jul 31, 2015 at 8:30 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Fri, Jul 24, 2015 at 4:05 AM, Michael Paquier michael.paqu...@gmail.com wrote: On Fri, Jul 24, 2015 at 7:11 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Thu, Jul 2, 2015 at 2:03 PM,

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-24 Thread Michael Paquier
On Fri, Jul 24, 2015 at 7:11 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Thu, Jul 2, 2015 at 2:03 PM, Simon Riggs si...@2ndquadrant.com wrote: Looks functionally complete Need a test to show that ALTER TABLE works on views, as discussed on this thread. And confirmation that

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-23 Thread Fabrízio de Royes Mello
On Thu, Jul 2, 2015 at 2:03 PM, Simon Riggs si...@2ndquadrant.com wrote: The following review has been posted through the commitfest application: make installcheck-world: not tested Implements feature: not tested Spec compliant: not tested Documentation:not

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-07-02 Thread Simon Riggs
The following review has been posted through the commitfest application: make installcheck-world: not tested Implements feature: not tested Spec compliant: not tested Documentation:not tested Looks functionally complete Need a test to show that ALTER TABLE works on

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-04-10 Thread Fabrízio de Royes Mello
On Tue, Apr 7, 2015 at 10:57 PM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Tue, Apr 7, 2015 at 10:15 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Fabrízio de Royes Mello wrote: On Mon, Apr 6, 2015 at 12:53 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote:

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-04-07 Thread Fabrízio de Royes Mello
On Mon, Apr 6, 2015 at 12:53 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Fabrízio de Royes Mello wrote: Ok guys. The attached patch refactor the reloptions adding a new field lockmode in relopt_gen struct and a new method to determine the required lock level from an option list.

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-04-07 Thread Alvaro Herrera
Fabrízio de Royes Mello wrote: On Mon, Apr 6, 2015 at 12:53 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Fabrízio de Royes Mello wrote: Ok guys. The attached patch refactor the reloptions adding a new field lockmode in relopt_gen struct and a new method to determine the

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-04-07 Thread Fabrízio de Royes Mello
On Tue, Apr 7, 2015 at 10:15 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Fabrízio de Royes Mello wrote: On Mon, Apr 6, 2015 at 12:53 AM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Fabrízio de Royes Mello wrote: Ok guys. The attached patch refactor the reloptions

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-04-05 Thread Alvaro Herrera
Fabrízio de Royes Mello wrote: Ok guys. The attached patch refactor the reloptions adding a new field lockmode in relopt_gen struct and a new method to determine the required lock level from an option list. We need determine the appropriate lock level for each reloption: I don't think

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-04-05 Thread Fabrízio de Royes Mello
On Wed, Apr 1, 2015 at 1:45 AM, Noah Misch n...@leadboat.com wrote: On Tue, Mar 31, 2015 at 01:17:03PM -0400, Robert Haas wrote: On Tue, Mar 31, 2015 at 9:11 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Attached a very WIP patch to reduce lock level when setting autovacuum

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-03-31 Thread Fabrízio de Royes Mello
On Mon, Mar 30, 2015 at 8:14 PM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Mon, Mar 30, 2015 at 7:41 PM, Jim Nasby jim.na...@bluetreble.com wrote: On 3/27/15 2:23 PM, Fabrízio de Royes Mello wrote: Hi all, I'm tweaking some autovacuum settings in a table with high

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-03-31 Thread Noah Misch
On Tue, Mar 31, 2015 at 01:17:03PM -0400, Robert Haas wrote: On Tue, Mar 31, 2015 at 9:11 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Attached a very WIP patch to reduce lock level when setting autovacuum reloptions in ALTER TABLE .. SET ( .. ) statement. I think the first

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-03-31 Thread Robert Haas
On Tue, Mar 31, 2015 at 9:11 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Attached a very WIP patch to reduce lock level when setting autovacuum reloptions in ALTER TABLE .. SET ( .. ) statement. I think the first thing we need to here is analyze all of the options and determine

Re: [HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-03-30 Thread Jim Nasby
On 3/27/15 2:23 PM, Fabrízio de Royes Mello wrote: Hi all, I'm tweaking some autovacuum settings in a table with high write usage but with ALTER TABLE .. SET ( .. ) this task was impossible, so I did a catalog update (pg_class) to change reloptions. Maybe it's a stupid doubt, but why we need

[HACKERS] Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );

2015-03-27 Thread Fabrízio de Royes Mello
Hi all, I'm tweaking some autovacuum settings in a table with high write usage but with ALTER TABLE .. SET ( .. ) this task was impossible, so I did a catalog update (pg_class) to change reloptions. Maybe it's a stupid doubt, but why we need to get an AccessExclusiveLock on relation to set