[tarantool-patches] Re: [PATCH 2/2] sql: statistics removal after dropping an index

  • From: "n.pettik" <korablev@xxxxxxxxxxxxx>
  • To: "N. Tatunov" <hollow653@xxxxxxxxx>
  • Date: Thu, 5 Apr 2018 21:01:48 +0300

Hello.

See 2 minor remarks. The rest seems to be OK.

I have noticed, that there are wrong indentations on your branch:

@@ -2415,7 +2426,7 @@ sqlite3DropTable(Parse * pParse, SrcList * pName, int 
isView, int noErr)
         */
 
        sqlite3BeginWriteOperation(pParse, 1);
-       sqlite3ClearStatTables(pParse, "tbl", pTab->zName);
+    sql_clear_stat_tables(pParse, pTab->zName, NULL); 

@@ -3417,7 +3428,7 @@ sqlite3DropIndex(Parse * pParse, SrcList * pName, Token * 
pName2, int ifExists)
         * But firstly, delete statistics since schema
         * changes after DDL.
         */
-       sqlite3ClearStatTables(pParse, "idx", pIndex->zName);
+    sql_clear_stat_tables(pParse, pIndex->pTable->zName, pIndex->zName);

Please, fix them.

On 4 Apr 2018, at 19:34, Hollow111 <hollow653@xxxxxxxxx> wrote:

@@ -2210,16 +2210,17 @@ sqliteViewResetAll(sqlite3 * db)
  * Remove entries from the _sql_statN tables (for N in (1, 4))
  * after a DROP INDEX or DROP TABLE command.
  * 
- * @param table_name table to be dropped or
- *                   the table that contains index to be dropped
- * @param idx_name index to be dropped
+ * @param parse      The parsing context.
+ * @param table_name The table to be dropped or
+ *                   the table that contains index to be dropped.
+ * @param idx_name   Index to be dropped.
  */
 static void
-sql_clear_stat_tables(Parse *parse,
-               const char *table_name,
-                    const char *idx_name)
+sql_clear_stat_tables(Parse *parse, const char *table_name, 
+                      const char *idx_name
+                     )

This bracket should be on previous line.

 {
-    if(idx_name) {
+    if(idx_name != NULL) {
         sqlite3NestedParse(parse,
                     "DELETE FROM \"_sql_stat1\" WHERE (\"idx\"=%Q AND "
                     "\"tbl\"=%Q)",
 


Other related posts: