Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2636ecf

Browse files
committed
Lock relation used to generate fresh data for RMV.
The relation should not be accessible to any other process, but itshould be locked for consistency. Since this is not known tocause any bug, it will not be back-patch, at least for now.Per report from Andres Freund
1 parent6331de1 commit2636ecf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/commands/matview.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include"miscadmin.h"
3131
#include"parser/parse_relation.h"
3232
#include"rewrite/rewriteHandler.h"
33+
#include"storage/lmgr.h"
3334
#include"storage/smgr.h"
3435
#include"tcop/tcopprot.h"
3536
#include"utils/builtins.h"
@@ -240,9 +241,14 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
240241

241242
heap_close(matviewRel,NoLock);
242243

243-
/* Create the transient table that will receive the regenerated data. */
244+
/*
245+
* Create the transient table that will receive the regenerated data.
246+
* Lock it against access by any other process until commit (by which time
247+
* it will be gone).
248+
*/
244249
OIDNewHeap=make_new_heap(matviewOid,tableSpace,concurrent,
245250
ExclusiveLock);
251+
LockRelationOid(OIDNewHeap,AccessExclusiveLock);
246252
dest=CreateTransientRelDestReceiver(OIDNewHeap);
247253

248254
/* Generate the data, if wanted. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp