diff options
author | Vadim B. Mikheev <vadim4o@yahoo.com> | 1998-12-15 12:47:01 +0000 |
---|---|---|
committer | Vadim B. Mikheev <vadim4o@yahoo.com> | 1998-12-15 12:47:01 +0000 |
commit | 3f7fbf85dc5b42dfd33c803efe6c90533773576a (patch) | |
tree | df8f84075ae7a27fa6b7ec0d063a03898e0b1bbb /src/backend/commands/user.c | |
parent | c5a27161a188b235ce3c0afb1b12e8942ac8e963 (diff) |
Initial MVCC code.
New code for locking buffer' context.
Diffstat (limited to 'src/backend/commands/user.c')
-rw-r--r-- | src/backend/commands/user.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index e0c0e51ea13..7c4203528fa 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: user.c,v 1.22 1998/12/14 08:11:00 scrappy Exp $ + * $Id: user.c,v 1.23 1998/12/15 12:46:00 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -136,7 +136,7 @@ DefineUser(CreateUserStmt *stmt) * Secure a write lock on pg_shadow so we can be sure of what the next * usesysid should be. */ - RelationSetLockForWrite(pg_shadow_rel); + LockRelation(pg_shadow_rel, AccessExclusiveLock); scan = heap_beginscan(pg_shadow_rel, false, SnapshotNow, 0, NULL); while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) @@ -154,7 +154,7 @@ DefineUser(CreateUserStmt *stmt) if (exists) { - RelationUnsetLockForWrite(pg_shadow_rel); + UnlockRelation(pg_shadow_rel, AccessExclusiveLock); heap_close(pg_shadow_rel); UserAbortTransactionBlock(); elog(ERROR, @@ -187,7 +187,7 @@ DefineUser(CreateUserStmt *stmt) * This goes after the UpdatePgPwdFile to be certain that two backends * to not attempt to write to the pg_pwd file at the same time. */ - RelationUnsetLockForWrite(pg_shadow_rel); + UnlockRelation(pg_shadow_rel, AccessExclusiveLock); heap_close(pg_shadow_rel); if (IsTransactionBlock() && !inblock) @@ -235,14 +235,14 @@ AlterUser(AlterUserStmt *stmt) * dump of the pg_pwd file is done, there is not another backend doing * the same. */ - RelationSetLockForWrite(pg_shadow_rel); + LockRelation(pg_shadow_rel, AccessExclusiveLock); tuple = SearchSysCacheTuple(USENAME, PointerGetDatum(stmt->user), 0, 0, 0); if (!HeapTupleIsValid(tuple)) { - RelationUnsetLockForWrite(pg_shadow_rel); + UnlockRelation(pg_shadow_rel, AccessExclusiveLock); heap_close(pg_shadow_rel); UserAbortTransactionBlock(); /* needed? */ elog(ERROR, "alterUser: user \"%s\" does not exist", stmt->user); @@ -288,7 +288,7 @@ AlterUser(AlterUserStmt *stmt) UpdatePgPwdFile(sql); - RelationUnsetLockForWrite(pg_shadow_rel); + UnlockRelation(pg_shadow_rel, AccessExclusiveLock); heap_close(pg_shadow_rel); if (IsTransactionBlock() && !inblock) @@ -342,14 +342,14 @@ RemoveUser(char *user) * dump of the pg_pwd file is done, there is not another backend doing * the same. */ - RelationSetLockForWrite(pg_shadow_rel); + LockRelation(pg_shadow_rel, AccessExclusiveLock); tuple = SearchSysCacheTuple(USENAME, PointerGetDatum(user), 0, 0, 0); if (!HeapTupleIsValid(tuple)) { - RelationUnsetLockForWrite(pg_shadow_rel); + UnlockRelation(pg_shadow_rel, AccessExclusiveLock); heap_close(pg_shadow_rel); UserAbortTransactionBlock(); elog(ERROR, "removeUser: user \"%s\" does not exist", user); @@ -422,7 +422,7 @@ RemoveUser(char *user) UpdatePgPwdFile(sql); - RelationUnsetLockForWrite(pg_shadow_rel); + UnlockRelation(pg_shadow_rel, AccessExclusiveLock); heap_close(pg_shadow_rel); if (IsTransactionBlock() && !inblock) |