projects
/
online_analyze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
31e2328
)
Fix crashing on database-wide vacuum/analyze
author
Teodor Sigaev
<teodor@sigaev.ru>
Fri, 21 Jul 2017 14:05:28 +0000
(17:05 +0300)
committer
Teodor Sigaev
<teodor@sigaev.ru>
Fri, 21 Jul 2017 14:05:28 +0000
(17:05 +0300)
online_analyze.c
patch
|
blob
|
history
diff --git
a/online_analyze.c
b/online_analyze.c
index
53ffd20
..
b6ccf68
100644
(file)
--- a/
online_analyze.c
+++ b/
online_analyze.c
@@
-847,13
+847,38
@@
onlineAnalyzeHookerUtility(
{
VacuumStmt *vac = (VacuumStmt*)parsetree;
{
VacuumStmt *vac = (VacuumStmt*)parsetree;
- tblnames = list_make1(vac->relation);
+ if (vac->relation)
+ tblnames = list_make1(vac->relation);
if (vac->options & (VACOPT_VACUUM | VACOPT_FULL | VACOPT_FREEZE))
if (vac->options & (VACOPT_VACUUM | VACOPT_FULL | VACOPT_FREEZE))
+ {
/* optionally with analyze */
op = CK_VACUUM;
/* optionally with analyze */
op = CK_VACUUM;
+
+ /* drop all collected stat */
+ if (tblnames == NIL)
+ relstatsInit();
+ }
else if (vac->options & VACOPT_ANALYZE)
else if (vac->options & VACOPT_ANALYZE)
+ {
op = CK_ANALYZE;
op = CK_ANALYZE;
+
+ /* should reset all counters */
+ if (tblnames == NIL)
+ {
+ HASH_SEQ_STATUS hs;
+ OnlineAnalyzeTableStat *rstat;
+ TimestampTz now = GetCurrentTimestamp();
+
+ hash_seq_init(&hs, relstats);
+
+ while((rstat = hash_seq_search(&hs)) != NULL)
+ {
+ rstat->changes_since_analyze = 0;
+ rstat->analyze_timestamp = now;
+ }
+ }
+ }
else
tblnames = NIL;
}
else
tblnames = NIL;
}