Changed call AllocSetContextCreate in the online_analyze.c
[online_analyze.git] / online_analyze.c
index 3fe4da5..77c1f8b 100644 (file)
@@ -446,9 +446,10 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected)
                rstat->tableid = relOid;
                newTable = true;
        }
-       else if (operation == CK_VACUUM)
+
+       if (operation == CK_VACUUM)
        {
-               /* force reread becouse vacuum could change n_tuples */
+               /* force reread because vacuum could change n_tuples */
                rstat->rereadStat = true;
                return;
        }
@@ -457,6 +458,8 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected)
                /* only analyze */
                rstat->changes_since_analyze = 0;
                rstat->analyze_timestamp = now;
+               if (newTable)
+                       rstat->rereadStat = true;
                return;
        }
 
@@ -944,6 +947,7 @@ onlineAnalyzeHookerUtility(
 }
 #endif
 
+
 static void
 relstatsInit(void)
 {
@@ -963,17 +967,20 @@ relstatsInit(void)
        else
        {
                Assert(relstats == NULL);
+
+#if PG_VERSION_NUM < 90600
                onlineAnalyzeMemoryContext =
                        AllocSetContextCreate(CacheMemoryContext,
-                                                                 "online_analyze storage context",
-#if PG_VERSION_NUM < 90600
-                                                                 ALLOCSET_DEFAULT_MINSIZE,
-                                                                 ALLOCSET_DEFAULT_INITSIZE,
-                                                                 ALLOCSET_DEFAULT_MAXSIZE
+                       "online_analyze storage context",
+                       ALLOCSET_DEFAULT_MINSIZE,
+                       ALLOCSET_DEFAULT_INITSIZE,
+                       ALLOCSET_DEFAULT_MAXSIZE
+                       );
 #else
-                                                                 ALLOCSET_DEFAULT_SIZES
+               onlineAnalyzeMemoryContext =
+                       AllocSetContextCreate(CacheMemoryContext,
+                       "online_analyze storage context", ALLOCSET_DEFAULT_SIZES);
 #endif
-                                                                );
        }
 
        hash_ctl.hcxt = onlineAnalyzeMemoryContext;