Commit b58d9265 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com
Browse files

merge

parents 3ea85078 a6d703b7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,3 +7,4 @@ paul@central.snake.net
sasha@mysql.sashanet.com
sasha@work.mysql.com
serg@serg.mysql.com
tim@cane.mysql.fi
+22 −2
Original line number Diff line number Diff line
@@ -19895,6 +19895,7 @@ or SHOW INDEX FROM tbl_name [FROM db_name]
or SHOW TABLE STATUS [FROM db_name] [LIKE wild]
or SHOW STATUS [LIKE wild]
or SHOW VARIABLES [LIKE wild]
or SHOW LOGS
or SHOW [FULL] PROCESSLIST
or SHOW GRANTS FOR user
or SHOW CREATE TABLE table_name
@@ -19916,6 +19917,7 @@ and @samp{_} wild-card characters.
* SHOW TABLE STATUS::           
* SHOW STATUS::                 
* SHOW VARIABLES::              
* SHOW LOGS::              
* SHOW PROCESSLIST::            
* SHOW GRANTS::                 
* SHOW CREATE TABLE::           
@@ -20160,7 +20162,7 @@ your @code{mysqld} @code{sort_buffer} variables is probably too small.
tables.
@end itemize
@node SHOW VARIABLES, SHOW PROCESSLIST, SHOW STATUS, SHOW
@node SHOW VARIABLES, SHOW LOGS, SHOW STATUS, SHOW
@subsection SHOW VARIABLES
@code{SHOW VARIABLES} shows the values of some @strong{MySQL} system
@@ -20620,11 +20622,27 @@ closing it. See also @code{interactive_timeout}.
The manual section that describes tuning @strong{MySQL} contains some
information of how to tune the above variables. @xref{Server parameters}.
@node SHOW LOGS, SHOW PROCESSLIST, SHOW VARIABLES, SHOW
@subsection SHOW Information About Log Files
@code{SHOW LOGS} shows you status information about existing log
files.  It currently only displays information about Berkeley DB log
files.
@itemize @bullet
@item @code{File} shows the full path to the log file
@item @code{Type} shows the type of the log file (@code{BDB} for Berkeley
DB log files)
@item @code{Status} shows the status of the log file (@code{FREE} if the
file can be removed, or @code{IN USE} if the file is needed by the transaction
subsystem)
@end itemize
@cindex threads, display
@cindex processes, display
@findex threads
@findex PROCESSLIST
@node SHOW PROCESSLIST, SHOW GRANTS, SHOW VARIABLES, SHOW
@node SHOW PROCESSLIST, SHOW GRANTS, SHOW LOGS, SHOW
@subsection SHOW Information About Connected Threads (Processes)
@code{SHOW PROCESSLIST} shows you which threads are running.  You can
@@ -39789,6 +39807,8 @@ Fixed bug in @code{REPLACE} with BDB tables.
@code{LPAD()} and @code{RPAD()} will shorten the result string if it's longer
than the length argument.
@item
Added @code{SHOW LOGS} command.
@item
Remove not used BDB logs on shutdown.
@item
When creating a table, put @code{PRIMARY} keys first, followed by
+41 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ u_int32_t berkeley_lock_types[]=
{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM };
TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names),"",
				berkeley_lock_names};
static MEM_ROOT show_logs_root;

static void berkeley_print_error(const char *db_errpfx, char *buffer);
static byte* bdb_get_key(BDB_SHARE *share,uint *length,
@@ -210,6 +211,46 @@ int berkeley_rollback(THD *thd, void *trans)
  DBUG_RETURN(error);
}

static void *show_logs_alloc(size_t size)
{
  return alloc_root(&show_logs_root, size);
}

int berkeley_show_logs(THD *thd)
{
  char **all_logs, **free_logs;
  String *packet= &thd->packet;
  int error;
  DBUG_ENTER("berkeley_show_logs");

  init_alloc_root(&show_logs_root, 1024, 1024);
  if ((error= log_archive(db_env, &all_logs, DB_ARCH_ABS|DB_ARCH_LOG, show_logs_alloc)) ||
      (error= log_archive(db_env, &free_logs, DB_ARCH_ABS, show_logs_alloc)))
  {
    DBUG_PRINT("error", ("log_archive failed (error %d)", error));
    db_env->err(db_env, error, "log_archive: DB_ARCH_ABS");
    DBUG_RETURN(1);
  }

  for (char **a = all_logs, **f = free_logs; *a; ++a)
  {
    packet->length(0);
    net_store_data(packet,*a);
    net_store_data(packet,"BDB");
    if (f && *f && strcmp(*a, *f) == 0)
    {
      net_store_data(packet, SHOW_LOG_STATUS_FREE);
      ++f;
    }
    else
      net_store_data(packet, SHOW_LOG_STATUS_INUSE);

    if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
      DBUG_RETURN(1); /* purecov: inspected */
  }
  free_root(&show_logs_root,MYF(0));
  DBUG_RETURN(0);
}

static void berkeley_print_error(const char *db_errpfx, char *buffer)
{
+1 −0
Original line number Diff line number Diff line
@@ -168,3 +168,4 @@ bool berkeley_end(void);
bool berkeley_flush_logs(void);
int berkeley_commit(THD *thd, void *trans);
int berkeley_rollback(THD *thd, void *trans);
int berkeley_show_logs(THD *thd);
+5 −0
Original line number Diff line number Diff line
@@ -175,6 +175,10 @@ void kill_one_thread(THD *thd, ulong id);

#define BINLOG_DUMP_NON_BLOCK   1

/* sql_show.cc:show_log_files() */
#define SHOW_LOG_STATUS_FREE "FREE"
#define SHOW_LOG_STATUS_INUSE "IN USE"

/* Some portable defines */

#define portable_sizeof_char_ptr 8
@@ -354,6 +358,7 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild);
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_show_keys(THD *thd, TABLE_LIST *table);
int mysqld_show_logs(THD *thd);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1);
int mysqld_show_create(THD *thd, TABLE_LIST *table_list);
Loading