summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2003-10-07 12:05:35 +0500
committerunknown <ram@gw.mysql.r18.ru>2003-10-07 12:05:35 +0500
commit118d6df516dff65bf883e2615dc4e8d1ff2db142 (patch)
tree73574bf947749c4b86b0701d1f318a9af2555f49
parent67b5aa64c94090de8129a6fcd2e68e047ce2e444 (diff)
downloadmariadb-git-118d6df516dff65bf883e2615dc4e8d1ff2db142.tar.gz
WL #562: Change format of slow log in 4.1
-rw-r--r--sql/log.cc4
-rw-r--r--sql/mysqld.cc28
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/unireg.h3
4 files changed, 25 insertions, 12 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 608a7e94431..41184615508 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1564,7 +1564,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
VOID(pthread_mutex_unlock(&LOCK_log));
return 0;
}
- if ((specialflag & SPECIAL_LONG_LOG_FORMAT) || query_start_arg)
+ if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT) || query_start_arg)
{
current_time=time(NULL);
if (current_time != last_time)
@@ -1617,7 +1617,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
// Save value if we do an insert.
if (thd->insert_id_used)
{
- if (specialflag & SPECIAL_LONG_LOG_FORMAT)
+ if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT))
{
end=strmov(end,",insert_id=");
end=longlong10_to_str((longlong) thd->last_insert_id,end,-10);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6213c43b80b..80f68388214 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -262,6 +262,8 @@ my_bool opt_log_slave_updates= 0;
my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam;
my_bool opt_readonly, use_temp_pool, relay_log_purge;
my_bool opt_secure_auth= 0;
+my_bool opt_short_log_format= 0;
+my_bool opt_log_queries_not_using_indexes= 0;
volatile bool mqh_used = 0;
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
@@ -3455,7 +3457,7 @@ enum options
OPT_SKIP_PRIOR, OPT_BIG_TABLES,
OPT_STANDALONE, OPT_ONE_THREAD,
OPT_CONSOLE, OPT_LOW_PRIORITY_UPDATES,
- OPT_SKIP_HOST_CACHE, OPT_LONG_FORMAT,
+ OPT_SKIP_HOST_CACHE, OPT_SHORT_LOG_FORMAT,
OPT_FLUSH, OPT_SAFE,
OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB,
OPT_TABLE_TYPE, OPT_INIT_FILE,
@@ -3562,7 +3564,8 @@ enum options
OPT_DEFAULT_WEEK_FORMAT,
OPT_GROUP_CONCAT_MAX_LEN,
OPT_DEFAULT_COLLATION,
- OPT_SECURE_AUTH
+ OPT_SECURE_AUTH,
+ OPT_LOG_QUERIES_NOT_USING_INDEXES
};
@@ -3769,9 +3772,17 @@ Disable with --skip-bdb (will save memory).",
"Log slow queries to this log file. Defaults logging to hostname-slow.log file.",
(gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
- {"log-long-format", OPT_LONG_FORMAT,
- "Log some extra information to update log.", 0, 0, 0, GET_NO_ARG, NO_ARG,
- 0, 0, 0, 0, 0, 0},
+ {"log-long-format", '0',
+ "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"log-short-format", OPT_SHORT_LOG_FORMAT,
+ "Don't log extra information to update and slow-query logs.",
+ (gptr*) &opt_short_log_format, (gptr*) &opt_short_log_format,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
+ "Log queries that are executed without benefit of any index.",
+ (gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
"Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.",
(gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL,
@@ -5166,9 +5177,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_SKIP_RESOLVE:
opt_specialflag|=SPECIAL_NO_RESOLVE;
break;
- case (int) OPT_LONG_FORMAT:
- opt_specialflag|=SPECIAL_LONG_LOG_FORMAT;
- break;
case (int) OPT_SKIP_NETWORKING:
opt_disable_networking=1;
mysqld_port=0;
@@ -5508,6 +5516,10 @@ static void get_options(int argc,char **argv)
keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7,
&not_used))->size);
}
+ if (opt_short_log_format)
+ opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
+ if (opt_log_queries_not_using_indexes)
+ opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2c15362d9fa..aa91e307095 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1566,7 +1566,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->variables.long_query_time ||
((thd->lex.select_lex.options &
(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) &&
- (specialflag & SPECIAL_LONG_LOG_FORMAT)))
+ (specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES)))
{
long_query_count++;
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
diff --git a/sql/unireg.h b/sql/unireg.h
index 4920d4b609a..ef6a2f44ea7 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -107,8 +107,9 @@
#define SPECIAL_NO_PRIOR 128 /* Don't prioritize threads */
#define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */
#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */
-#define SPECIAL_LONG_LOG_FORMAT 1024
+#define SPECIAL_SHORT_LOG_FORMAT 1024
#define SPECIAL_SAFE_MODE 2048
+#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Log q not using indexes */
/* Extern defines */
#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->reclength)