Re: relation ### modified while in use

From: "Vadim Mikheev" <vmikheev(at)sectorbase(dot)com>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Philip Warner" <pjw(at)rhyme(dot)com(dot)au>, "Alex Pilosov" <alex(at)pilosoft(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: relation ### modified while in use
Date: 2000-10-23 11:06:48
Message-ID: 005a01c03ce1$57a4cc20$bc7a30d0@sectorbase.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > in general. What I'm proposing is that once an xact has touched a
> > table, other xacts should not be able to apply schema updates to that
> > table until the first xact commits.
> >
>
> I agree with you.

I don't know. We discussed this issue just after 6.5 and decided to
allow concurrent schema modifications.
Oracle has disctionary locks but run each DDL statement in separate
xaction, so - no deadlock condition here. OTOH, I wouldn't worry
about deadlock - one just had to follow common anti-deadlock rules.

> I've wondered why AccessShareLock is a short term lock.

MUST BE. AccessShare-/Exclusive-Locks are *data* locks.
If one want to protect schema then new schema share/excl locks
must be inroduced. There is no conflict between data and
schema locks - they are orthogonal.

We use AccessShare-/Exclusive-Locks for schema because of...
we allow concurrent schema modifications and no true schema
locks were required.

> If we have a mechanism to acquire a share lock on a tuple,we
> could use it for managing system info generally. However the
> only allowed lock on a tuple is exclusive. Access(Share/Exclusive)

Actually, just look at lock.h:LTAG structure - lock manager supports
locking of "some objects" inside tables:

typedef struct LTAG
{
Oid relId;
Oid dbId;
union
{
BlockNumber blkno;
Transaction xid;
} objId;
...
- we could add oid to union above and lock tables by acquiring lock
on pg_class with objId.oid = table' oid. Same way we could lock indices
and whatever we want... if we want -:)

> Lock on tables would give us a restricted solution about pg_class
> tuples.
>
> Thers'a possibility of deadlock in any case but there are few
> cases when AccessExclusiveLock is really needed and we could
> acquire an AccessExclusiveLock manually from the first if
> necessary.
>
> I'm not sure about the use of AccessShareLock in parse-analyze-
> optimize phase however.

There is notion about breakable (parser) locks in Oracle documentation -:)

Vadim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 2000-10-23 11:12:35 Re: AW: relation ### modified while in use
Previous Message Zeugswetter Andreas SB 2000-10-23 09:52:06 AW: AW: relation ### modified while in use