Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d0afdc1

Browse files
committed
Disallow AQO to write into the ML-tables if can be detected that
the query must be read-only (by the flag XactReadOnly).
1 parent ce7188c commit d0afdc1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

storage.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ update_query(int qhash, int fhash,
125125
ScanKeyData key;
126126
SnapshotData snap;
127127

128+
/* Couldn't allow to write if xact must be read-only. */
129+
if (XactReadOnly)
130+
return false;
131+
128132
reloid = RelnameGetRelid("aqo_queries_query_hash_idx");
129133
if (!OidIsValid(reloid))
130134
{
@@ -225,6 +229,10 @@ add_query_text(int qhash)
225229
Oid reloid;
226230
char *text_str;
227231

232+
/* Couldn't allow to write if xact must be read-only. */
233+
if (XactReadOnly)
234+
return false;
235+
228236
reloid = RelnameGetRelid("aqo_query_texts_query_hash_idx");
229237
if (!OidIsValid(reloid))
230238
{
@@ -386,6 +394,10 @@ update_fss(int fhash, int fsshash, int nrows, int ncols,
386394
ScanKeyData key[2];
387395
bool result = true;
388396

397+
/* Couldn't allow to write if xact must be read-only. */
398+
if (XactReadOnly)
399+
return false;
400+
389401
reloid = RelnameGetRelid("aqo_fss_access_idx");
390402
if (!OidIsValid(reloid))
391403
{
@@ -575,6 +587,10 @@ update_aqo_stat(int qhash, QueryStat *stat)
575587
IndexScanDesc scan;
576588
ScanKeyData key;
577589

590+
/* Couldn't allow to write if xact must be read-only. */
591+
if (XactReadOnly)
592+
return;
593+
578594
reloid = RelnameGetRelid("aqo_query_stat_idx");
579595
if (!OidIsValid(reloid))
580596
{

0 commit comments

Comments
 (0)