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

Commit425ac40

Browse files
committed
Add catched error rethrow during an AQO service relations writing + small code improvement.
1 parent9f1001e commit425ac40

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

‎postprocessing.c‎

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -506,18 +506,8 @@ StoreToQueryContext(QueryDesc *queryDesc)
506506
enr->md.reliddesc=InvalidOid;
507507
enr->md.tupdesc=NULL;
508508

509-
if (query_context.adding_query)
510-
{
511-
Assert(query_text!=NULL);
512-
enr->reldata=palloc0(qcsize+strlen(query_text)+1);
513-
memcpy(enr->reldata,&query_context,qcsize);
514-
memcpy((char*)(enr->reldata)+qcsize,query_text,strlen(query_text)+1);
515-
}
516-
else
517-
{
518-
enr->reldata=palloc0(qcsize);
519-
memcpy(enr->reldata,&query_context,qcsize);
520-
}
509+
enr->reldata=palloc0(qcsize);
510+
memcpy(enr->reldata,&query_context,qcsize);
521511

522512
register_ENR(queryDesc->queryEnv,enr);
523513
MemoryContextSwitchTo(oldCxt);
@@ -539,9 +529,6 @@ ExtractFromQueryContext(QueryDesc *queryDesc)
539529
enr=get_ENR(queryDesc->queryEnv,AQOPrivateData);
540530
memcpy(&query_context,enr->reldata,qcsize);
541531

542-
if (query_context.adding_query)
543-
query_text=pstrdup((char*)(enr->reldata)+qcsize);
544-
545532
MemoryContextSwitchTo(oldCxt);
546533
}
547534

‎storage.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,12 @@ add_query(int query_hash, bool learn_aqo, bool use_aqo,
144144
}
145145
PG_CATCH();
146146
{
147+
/*
148+
* Main goal is to catch deadlock errors during the index insertion.
149+
*/
147150
CommandCounterIncrement();
148151
simple_heap_delete(aqo_queries_heap,&(tuple->t_self));
152+
PG_RE_THROW();
149153
}
150154
PG_END_TRY();
151155

@@ -289,6 +293,7 @@ add_query_text(int query_hash, const char *query_text)
289293
{
290294
CommandCounterIncrement();
291295
simple_heap_delete(aqo_query_texts_heap,&(tuple->t_self));
296+
PG_RE_THROW();
292297
}
293298
PG_END_TRY();
294299

@@ -481,6 +486,7 @@ update_fss(int fss_hash, int nrows, int ncols,
481486
{
482487
CommandCounterIncrement();
483488
simple_heap_delete(aqo_data_heap,&(tuple->t_self));
489+
PG_RE_THROW();
484490
}
485491
PG_END_TRY();
486492
}
@@ -677,6 +683,7 @@ update_aqo_stat(int query_hash, QueryStat *stat)
677683
{
678684
CommandCounterIncrement();
679685
simple_heap_delete(aqo_stat_heap,&(tuple->t_self));
686+
PG_RE_THROW();
680687
}
681688
PG_END_TRY();
682689
}
@@ -865,7 +872,8 @@ my_index_insert(Relation indexRelation,
865872
heapRelation,checkUnique);
866873
#else
867874
returnindex_insert(indexRelation,values,isnull,heap_t_ctid,
868-
heapRelation,checkUnique,NULL);
875+
heapRelation,checkUnique,
876+
BuildIndexInfo(indexRelation));
869877
#endif
870878
}
871879

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp