List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:November 16 2008 11:33am
Subject:bzr commit into mysql-6.0-backup branch (ingo.struewing:2727)
View as plain text  
#At file:///home2/mydev/bzrroot/mysql-6.0-wl4534-6/

 2727 Ingo Struewing	2008-11-16
      Eighth prototype for final design review.
      
      Changes over seventh prototype:
      - Full set of item types supported.
added:
  client/backup_stream.c
  client/backup_stream.h
  client/mysqlbackup.cc
  mysql-test/suite/backup/r/backup_client.result
  mysql-test/suite/backup/r/backup_client_binlog.result
  mysql-test/suite/backup/r/backup_client_coverage.result
  mysql-test/suite/backup/t/backup_client.test
  mysql-test/suite/backup/t/backup_client_binlog.test
  mysql-test/suite/backup/t/backup_client_coverage.test
modified:
  .bzrignore
  client/CMakeLists.txt
  client/Makefile.am
  include/my_sys.h
  mysql-test/mysql-test-run.pl
  mysys/my_malloc.c
  mysys/my_static.c
  mysys/safemalloc.c

per-file messages:
  .bzrignore
    WL#4534 - Backup client program
    Added mysqlbackup related files.
  client/CMakeLists.txt
    WL#4534 - Backup client program
    Added mysqlbackup client build requirements.
  client/Makefile.am
    WL#4534 - Backup client program
    Added mysqlbackup client build requirements.
  client/backup_stream.c
    WL#4534 - Backup client program
    Backup stream reader.
  client/backup_stream.h
    WL#4534 - Backup client program
    Backup stream reader declarations.
  client/mysqlbackup.cc
    WL#4534 - Backup client program
    The new mysqlbackup program.
  include/my_sys.h
    WL#4534 - Backup client program
    Added support for my_malloc() error injection.
  mysql-test/mysql-test-run.pl
    WL#4534 - Backup client program
    Added mysqlbackup client to the list of environment variables.
  mysql-test/suite/backup/r/backup_client.result
    WL#4534 - Backup client program
    Test result.
  mysql-test/suite/backup/r/backup_client_binlog.result
    WL#4534 - Backup client program
    Test result.
  mysql-test/suite/backup/r/backup_client_coverage.result
    WL#4534 - Backup client program
    Test result.
  mysql-test/suite/backup/t/backup_client.test
    WL#4534 - Backup client program
    New test case.
  mysql-test/suite/backup/t/backup_client_binlog.test
    WL#4534 - Backup client program
    New test case.
  mysql-test/suite/backup/t/backup_client_coverage.test
    WL#4534 - Backup client program
    New test case.
  mysys/my_malloc.c
    WL#4534 - Backup client program
    Added support for my_malloc() error injection.
  mysys/my_static.c
    WL#4534 - Backup client program
    Added support for my_malloc() error injection.
  mysys/safemalloc.c
    WL#4534 - Backup client program
    Added support for my_malloc() error injection.
=== modified file '.bzrignore'
--- a/.bzrignore	2008-10-29 14:20:12 +0000
+++ b/.bzrignore	2008-11-16 11:33:31 +0000
@@ -314,6 +314,9 @@ client/mysql_upgrade
 client/mysqladmin
 client/mysqladmin.c
 client/mysqladmin.cpp
+client/mysqlbackup
+client/stream_v1.h
+client/stream_v1_services.h
 client/mysqlbinlog
 client/mysqlbinlog.cpp
 client/mysqlcheck

=== modified file 'client/CMakeLists.txt'
--- a/client/CMakeLists.txt	2008-06-20 11:40:01 +0000
+++ b/client/CMakeLists.txt	2008-11-16 11:33:31 +0000
@@ -27,7 +27,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/
                     ${CMAKE_SOURCE_DIR}/libmysql
                     ${CMAKE_SOURCE_DIR}/regex
                     ${CMAKE_SOURCE_DIR}/sql
-                    ${CMAKE_SOURCE_DIR}/strings)
+                    ${CMAKE_SOURCE_DIR}/strings
+                    ${CMAKE_SOURCE_DIR}/sql/backup)
 
 ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
 TARGET_LINK_LIBRARIES(mysql mysqlclient_notls ws2_32)
@@ -52,6 +53,12 @@ ADD_DEPENDENCIES(mysql_upgrade GenFixPri
 ADD_EXECUTABLE(mysqlshow mysqlshow.c)
 TARGET_LINK_LIBRARIES(mysqlshow mysqlclient_notls ws2_32)
 
+ADD_EXECUTABLE(mysqlbackup mysqlbackup.cc
+                           backup_stream.c
+                           ../sql/backup/stream_v1.c
+                           ../sql/backup/stream_v1_transport.c)
+TARGET_LINK_LIBRARIES(mysqlbackup mysqlclient_notls ws2_32)
+
 ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
 			   ../mysys/mf_tempdir.c
 			   ../mysys/my_new.cc
@@ -78,6 +85,7 @@ IF(EMBED_MANIFESTS)
   MYSQL_EMBED_MANIFEST("mysqlimport" "asInvoker")
   MYSQL_EMBED_MANIFEST("mysql_upgrade" "asInvoker")
   MYSQL_EMBED_MANIFEST("mysqlshow" "asInvoker")
+  MYSQL_EMBED_MANIFEST("mysqlbackup" "asInvoker")
   MYSQL_EMBED_MANIFEST("mysqlbinlog" "asInvoker")
   MYSQL_EMBED_MANIFEST("mysqladmin" "asInvoker")
   MYSQL_EMBED_MANIFEST("echo" "asInvoker")

=== modified file 'client/Makefile.am'
--- a/client/Makefile.am	2008-09-04 18:30:34 +0000
+++ b/client/Makefile.am	2008-11-16 11:33:31 +0000
@@ -42,6 +42,7 @@ CLEANFILES =			$(BUILT_SOURCES)
 
 bin_PROGRAMS =			mysql \
 				mysqladmin \
+				mysqlbackup \
 				mysqlbinlog \
 				mysqlcheck \
 				mysqldump \
@@ -57,6 +58,12 @@ mysql_LDADD =			@readline_link@ @TERMCAP
 				$(LDADD) $(CXXLDFLAGS)
 mysqladmin_SOURCES =		mysqladmin.cc
 
+mysqlbackup_SOURCES =		mysqlbackup.cc \
+				backup_stream.c \
+				$(top_srcdir)/sql/backup/stream_v1.c \
+				$(top_srcdir)/sql/backup/stream_v1_transport.c
+mysqlbackup_LDADD =		$(LDADD) $(CXXLDFLAGS)
+
 mysqlbinlog_SOURCES =		mysqlbinlog.cc \
 				$(top_srcdir)/mysys/mf_tempdir.c \
 				$(top_srcdir)/mysys/my_new.cc \
@@ -110,6 +117,7 @@ sql_src=log_event.h mysql_priv.h rpl_con
 	rpl_record_old.h rpl_record_old.cc \
 	transaction.h
 strings_src=decimal.c dtoa.c
+backup_src=stream_v1.h stream_v1_services.h
 
 link_sources:
 	for f in $(sql_src) ; do \
@@ -120,6 +128,10 @@ link_sources:
 	  rm -f $(srcdir)/$$f; \
 	  @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
 	done; \
+	for f in $(backup_src) ; do \
+	  rm -f $(srcdir)/$$f; \
+	  @LN_CP_F@ $(top_srcdir)/sql/backup/$$f $$f; \
+	done; \
 	rm -f $(srcdir)/my_user.c; \
 	@LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c;
 	echo timestamp > link_sources;

=== added file 'client/backup_stream.c'
--- a/client/backup_stream.c	1970-01-01 00:00:00 +0000
+++ b/client/backup_stream.c	2008-11-16 11:33:31 +0000
@@ -0,0 +1,2593 @@
+/* Copyright (C) 2008 Sun Microsystems Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/*
+  MySQL Backup Image Stream reading
+*/
+
+#include "backup_stream.h"
+
+/* MY_STAT */
+#include "my_dir.h"
+
+/* strerror, memcmp */
+#include <string.h>
+
+#ifdef HAVE_COMPRESS
+/* zlib functions */
+#include "zlib.h"
+#define ZBUF_SIZE 65536 /* compression I/O buffer size */
+#endif
+
+/* bzero for Windows */
+#include "m_string.h"
+
+/*
+  Error injection. Built on DBUG.
+  This is similar to error injection in the server.
+  In case that one becomes globally available, we undefine it first.
+*/
+#ifdef ERROR_INJECT
+#undef ERROR_INJECT
+#endif
+#define ERROR_INJECT(_keyword_, _action_) \
+  DBUG_EXECUTE_IF((_keyword_), errm("ERROR_INJECT(\"%s\")\n", (_keyword_)); \
+                  DBUG_PRINT("bupstrm", ("ERROR_INJECT(\"%s\")\n",          \
+                                         (_keyword_))); _action_)
+
+/* For easier error tracking we do not pre-allocate in DBUG mode. */
+#if !defined(DBUG_OFF)
+#define DYN_ALLOC_INIT 0
+#define DYN_ALLOC_INCR 1
+#else
+#define DYN_ALLOC_INIT 1000
+#define DYN_ALLOC_INCR 1000
+#endif
+
+/*
+  ====================================================
+  Convenience functions for access to st_blob objects.
+  ====================================================
+*/
+
+/**
+  Backup blob length.
+
+  This is a function, not a macro, for better type checking.
+
+  @param[in]    blob            blob
+
+  @return       length
+*/
+
+ulong BBL(struct st_blob *blob)
+{
+  DBUG_ASSERT(blob);
+  DBUG_ASSERT(blob->end >= blob->begin);
+  return ((ulong) (blob->end - blob->begin));
+}
+
+
+/**
+  Backup blob string.
+
+  This is a function, not a macro, for better type checking.
+
+  @param[in]    blob            blob
+
+  @return       string
+*/
+
+char *BBS(struct st_blob *blob)
+{
+  DBUG_ASSERT(blob);
+  DBUG_ASSERT(blob->end >= blob->begin);
+  return ((char*) blob->begin);
+}
+
+
+/*
+  ====================================================
+  Memory allocation.
+  These are callback functions for the stream library.
+  ====================================================
+*/
+
+/**
+  Allocate given amount of memory and return pointer to it.
+
+  @param[in]    size            amount of memory to allocate
+
+  @return       pointer to allocated memory
+*/
+
+bstream_byte* bstream_alloc(unsigned long int size)
+{
+  return my_malloc(size, MYF(MY_WME));
+}
+
+
+/**
+  Free previously allocated memory.
+
+  @param[in]    ptr             pointer to allocated memory
+*/
+
+void bstream_free(bstream_byte *ptr)
+{
+  my_free(ptr, MYF(MY_ALLOW_ZERO_PTR));
+}
+
+
+/*
+  ====================================================
+  Helper functions for the stream library.
+  These are callback functions for the stream library.
+  Low-level stream access.
+  ====================================================
+*/
+
+/*
+  Helper struct for stream access functions.
+
+  The stream access functions do not read the backup image file
+  directly. They call back functions provided in st_backup_stream by the
+  application.
+
+  The struct st_stream ties together the st_backup_stream
+  with the data required by the I/O functions provided by this
+  application. Note that 'st_backup_stream' must be the first part of
+  the helper struct.
+
+  'stream_pos' is used to describe which section/chunk of a backup
+  image we have read last.
+*/
+struct st_stream
+{
+  struct st_backup_stream       bupstrm;        /* Must be first in st_stream */
+  File                          fd;             /* File descriptor */
+  my_off_t                      pos;            /* Byte position in file */
+  my_off_t                      size;           /* File size */
+  const char                    *path;          /* File name */
+  const char                    *stream_pos;    /* Verbal stream position */
+  const char                    *zalgo;         /* Compression algorithm */
+#ifdef HAVE_COMPRESS
+  uchar                         *zbuf;          /* Buffer for compressed data */
+  z_stream                      zstream;        /* zlib helper struct */
+#endif
+};
+
+
+/**
+  Read from the stream/image.
+
+  @param[in,out]    strm        stream handle, updating position
+  @param[in,out]    data        data container, updating contents and ptrs
+  @param            envelope    not used
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     BSTREAM_EOS     end of stream
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+*/
+
+static int
+str_read(struct st_stream *strm, struct st_blob *data,
+         struct st_blob envelope __attribute__((unused)))
+{
+  size_t        lgt;
+  int           rc= BSTREAM_OK;
+  DBUG_ENTER("str_read");
+  DBUG_ASSERT(strm && strm->path);
+  DBUG_ASSERT(data && data->begin && data->end);
+
+  /*
+    Compute wanted length.
+  */
+  lgt= BBL(data);
+  DBUG_PRINT("bupstrm", ("want bytes: %lu", (ulong) lgt));
+
+  /*
+    Read.
+  */
+#ifdef HAVE_COMPRESS
+  if (strm->zbuf)
+  {
+    int zerr;
+    z_stream *zstream= &strm->zstream;
+
+    /* Set output buffer pointer and size. */
+    zstream->next_out= data->begin;
+    /*
+      Zstream can process in one go a block whose size fits into uInt
+      type. If we have more space available in the buffer, we ignore the
+      extra bytes.
+    */
+    if (lgt > ~((uInt)0))
+      lgt= ~((uInt)0); /* purecov: inspected */
+    zstream->avail_out= (uInt) lgt;
+
+    lgt= 0; /* In case zbuf is empty and we are at EOF. */
+    do
+    {
+      /* If input buffer is empty, load data from compressed image. */
+      if (!zstream->avail_in)
+      {
+        zstream->avail_in= (uInt) my_read(strm->fd, strm->zbuf, ZBUF_SIZE,
+                                           MYF(0));
+        ERROR_INJECT("str_read_z_io_error",
+                     zstream->avail_in= (uInt) MY_FILE_ERROR;
+                     my_errno= EIO;);
+        ERROR_INJECT("str_read_z_eof",
+                     zstream->avail_in= 0;);
+        if (zstream->avail_in == (uInt) MY_FILE_ERROR)
+        {
+          errm("cannot read compressed image '%s': %s\n",
+               strm->path, strerror(my_errno));
+          rc= BSTREAM_ERROR;
+          goto end;
+        }
+        else if (!zstream->avail_in)
+        {
+          /* EOF. If first read, we leave with lgt == 0 here. */
+          break;
+        }
+        zstream->next_in= strm->zbuf;
+      }
+      /* Decompress, */
+      zerr= inflate(zstream, Z_NO_FLUSH);
+      ERROR_INJECT("str_read_zlib_error",
+                   zerr= Z_STREAM_ERROR;
+                   zstream->msg= (char*) "error injected";);
+      /* Set output length. */
+      lgt= zstream->next_out - data->begin;
+      if (zerr == Z_STREAM_END)
+      {
+        /* EOF. If first decompress, we leave with lgt == 0 here. */
+        break;
+      }
+      else if (zerr != Z_OK)
+      {
+        errm("cannot decompress image '%s': %d: %s\n",
+             strm->path, zerr, zstream->msg);
+        rc= BSTREAM_ERROR;
+        goto end;
+      }
+    } while (zstream->avail_out);
+    /* lgt contains the number of bytes decompressed. */
+  }
+  else
+#endif
+  {
+    lgt= my_read(strm->fd, data->begin, lgt, MYF(0));
+    ERROR_INJECT("str_read_io_error",
+                 lgt= MY_FILE_ERROR; my_errno= EIO;);
+    if (lgt == MY_FILE_ERROR)
+    {
+      errm("cannot read image '%s': %s\n", strm->path, strerror(my_errno));
+      rc= BSTREAM_ERROR;
+      goto end;
+    }
+  }
+  DBUG_PRINT("bupstrm", ("read bytes: %lu", (ulong) lgt));
+
+  /*
+    Check for end of stream.
+  */
+  if (lgt == 0)
+  {
+    rc= BSTREAM_EOS;
+    goto end;
+  }
+
+  /*
+    Update stream handle and data container.
+  */
+  strm->pos+= lgt;
+  data->begin+= lgt;
+
+ end:
+  DBUG_RETURN(rc);
+}
+
+
+#ifdef NOTUSED
+/**
+  Skip part of the stream/image.
+
+  @param[in,out]    strm        stream handle, updating position
+  @param[in,out]    len         number of bytes to skip, skipped
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+*/
+
+static int
+str_forward(struct st_stream *strm, size_t *len)
+{
+  int           rc= BSTREAM_OK;
+  DBUG_ENTER("str_forward");
+  DBUG_ASSERT(strm && strm->path);
+  DBUG_ASSERT(len);
+
+#ifdef HAVE_COMPRESS
+  if (strm->zbuf)
+  {
+    /* Need to read *len bytes from decompressed stream. */
+    z_stream    *zstream= &strm->zstream;
+    size_t      lgt= *len;
+    int         zerr;
+    uchar       iobuff[IO_SIZE];
+
+    /*
+      Zstream can process in one go a block whose size fits into uInt
+      type. If we have more space available in the buffer, we ignore
+      the extra bytes.
+    */
+    DBUG_ASSERT(IO_SIZE <= ~((uInt)0));
+
+    do
+    {
+      /* Set output buffer pointer and size. */
+      zstream->next_out= iobuff;
+      if (lgt > IO_SIZE)
+        zstream->avail_out= IO_SIZE;
+      else
+        zstream->avail_out= (uInt) lgt;
+
+      /* If input buffer is empty, load data from compressed image. */
+      if (!zstream->avail_in)
+      {
+        zstream->avail_in= (uInt) my_read(strm->fd, strm->zbuf, ZBUF_SIZE,
+                                          MYF(0));
+        if (zstream->avail_in == (uInt) MY_FILE_ERROR)
+        {
+          errm("cannot read compressed image '%s': %s\n",
+               strm->path, strerror(my_errno));
+          rc= BSTREAM_ERROR;
+          goto end;
+        }
+        else if (!zstream->avail_in)
+        {
+          /* EOF. This is an error on seek. */
+          errm("end of stream in seek on image '%s'\n", strm->path);
+          rc= BSTREAM_EOS;
+          goto end;
+        }
+        zstream->next_in= strm->zbuf;
+      }
+      /* Decompress, */
+      zerr= inflate(zstream, Z_NO_FLUSH);
+      /* Reduce wanted length by what we got. */
+      lgt-= zstream->next_out - iobuff;
+      if (zerr == Z_STREAM_END)
+      {
+        /* EOF. This is an error on seek. */
+        errm("end of stream in seek on image '%s'\n", strm->path);
+        rc= BSTREAM_EOS;
+        goto end;
+      }
+      else if (zerr != Z_OK)
+      {
+        errm("cannot decompress image '%s': %d: %s\n",
+             strm->path, zerr, zstream->msg);
+        rc= BSTREAM_ERROR;
+        goto end;
+      }
+    } while (lgt);
+
+    /* Remember current file position. */
+    strm->pos+= *len;
+  }
+  else
+#endif
+  {
+    my_off_t      off_new;
+
+#if !defined(DBUG_OFF)
+    /*
+      Check if internal counter matches real file position.
+    */
+    my_off_t off_cur= my_seek(strm->fd, (my_off_t) 0, SEEK_CUR, MYF(0));
+    if (off_cur == MY_FILEPOS_ERROR)
+    {
+      errm("cannot seek in image '%s': %s\n", strm->path, strerror(my_errno));
+      rc= BSTREAM_ERROR;
+      goto end;
+    }
+    DBUG_ASSERT(off_cur == strm->pos);
+#endif
+
+    /*
+      Advance file pointer by *len bytes.
+    */
+    off_new= my_seek(strm->fd, (my_off_t) *len, SEEK_CUR, MYF(0));
+    if (off_new == MY_FILEPOS_ERROR)
+    {
+      errm("cannot seek in image '%s': %s\n", strm->path, strerror(my_errno));
+      rc= BSTREAM_ERROR;
+      goto end;
+    }
+
+    /* Compute actual skip length from old and new file positions. */
+    *len= (size_t) (off_new - strm->pos);
+    /* Remember current file position. */
+    strm->pos= off_new;
+  }
+
+ end:
+  DBUG_RETURN(rc);
+}
+#endif /*NOTUSED*/
+
+
+/**
+  Open the stream/image for reading.
+
+  A backup stream has a prefix, consisting of 8 bytes magic number
+  and 2 bytes version number.
+
+  TODO A compressed image has a gzip magic number.
+  TODO An encrypted image has yet another magic number.
+
+  @param[in,out]    strm        stream handle, updating path, fd, bupstrm
+  @param[in]        path        image path name
+  @param[out]       version_p   detected image version
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+*/
+
+static int
+str_open_rd(struct st_stream *strm, const char *path, uint *version_p)
+{
+  MY_STAT               stat_area;
+  size_t                lgt;
+  int                   rc= BSTREAM_OK;
+  int                   errpos= 0;
+  uint16                version;
+  const unsigned char   backup_magic_bytes[8]=
+    {
+      0xE0, // ###.....
+      0xF8, // #####...
+      0x7F, // .#######
+      0x7E, // .######.
+      0x7E, // .######.
+      0x5F, // .#.#####
+      0x0F, // ....####
+      0x03  // ......##
+    };
+#ifdef HAVE_COMPRESS
+  const unsigned char   gzip_magic_bytes[3]=
+    {
+      0x1f,
+      0x8b,
+      0x08
+    };
+#endif
+  uchar  prefix[sizeof(backup_magic_bytes) + sizeof(version)];
+  DBUG_ENTER("str_open_rd");
+  DBUG_ASSERT(strm);
+  DBUG_ASSERT(path);
+  DBUG_ASSERT(version_p);
+
+  /*
+    Initialize stream struct.
+  */
+  bzero(strm, sizeof(*strm));
+
+  /*
+    Set image path name.
+  */
+  strm->path= path;
+  DBUG_PRINT("bupstrm", ("opening image file: '%s'", strm->path));
+
+  /*
+    Open the image file.
+  */
+  strm->fd= my_open(strm->path, O_RDONLY, MYF(0));
+  if (strm->fd < 0)
+  {
+    errm("cannot open backup image '%s': %s\n", strm->path, strerror(my_errno));
+    goto err;
+  }
+  errpos= 10;
+  DBUG_PRINT("bupstrm", ("opened  image file: '%s'  fd: %d",
+                         strm->path, strm->fd));
+
+  ERROR_INJECT("str_open_rd_stat_error", my_close(strm->fd, MYF(0)););
+  if (my_fstat(strm->fd, &stat_area, MYF(0)))
+  {
+    errm("cannot fstat open backup image '%s': %s\n",
+         strm->path, strerror(my_errno= errno));
+    goto err;
+  }
+  strm->size= stat_area.st_size;
+
+  /*
+    Read prefix with magic number and image version.
+  */
+  lgt= my_read(strm->fd, prefix, sizeof(prefix), MYF(0));
+  ERROR_INJECT("str_open_rd_read_error", lgt= MY_FILE_ERROR; my_errno= EIO;);
+  ERROR_INJECT("str_open_rd_read_length", lgt= sizeof(prefix) - 1;);
+  if (lgt != sizeof(prefix))
+  {
+    if (lgt == MY_FILE_ERROR)
+      errm("cannot read image '%s': %s\n", strm->path, strerror(my_errno));
+    else
+      errm("image '%s' has only %lu bytes of at least %lu required\n",
+           strm->path, (ulong) lgt, (ulong) sizeof(prefix));
+    goto err;
+  }
+  DBUG_PRINT("bupstrm", ("read magic number and version"));
+
+#ifdef HAVE_COMPRESS
+  /*
+    Check for compression.
+  */
+  if (!memcmp(prefix, gzip_magic_bytes, sizeof(gzip_magic_bytes)))
+  {
+    int                 zerr;
+    bstream_blob        blob;
+
+    ERROR_INJECT("str_open_rd_zbuf_malloc", my_malloc_error_inject= 1;);
+    strm->zbuf= (uchar*) my_malloc(ZBUF_SIZE, MYF(MY_WME));
+    if (!strm->zbuf)
+    {
+      /* Error message reported by mysys. */
+      goto err;
+    }
+    errpos= 20;
+    strm->zstream.zalloc= 0;
+    strm->zstream.zfree= 0;
+    strm->zstream.opaque= 0;
+    strm->zstream.msg= 0;
+    strm->zstream.next_in= strm->zbuf;
+    strm->zstream.avail_in= 10;
+    memcpy(strm->zbuf, prefix, 10);
+
+    zerr= inflateInit2(&strm->zstream, MAX_WBITS + 16);
+    ERROR_INJECT("str_open_rd_zlib_init",
+                 zerr= Z_STREAM_ERROR;
+                 strm->zstream.msg= (char*) "error injected";);
+    if (zerr != Z_OK)
+    {
+      errm("cannot init zlib on image '%s': %d: %s\n",
+           strm->path, zerr, strm->zstream.msg);
+      goto err;
+    }
+    errpos= 30;
+
+    blob.begin= prefix;
+    blob.end= prefix + sizeof(prefix);
+    zerr= str_read(strm, &blob, blob);
+    if (zerr == BSTREAM_EOS)
+    {
+      errm("end of stream within header on image '%s'\n", strm->path);
+      goto err;
+    }
+    if (zerr != BSTREAM_OK || (blob.begin != blob.end))
+    {
+      /* Error message reported by function. */
+      goto err;
+    }
+    strm->zalgo= "gzip";
+  }
+  else
+#endif
+    strm->zalgo= "none";
+
+  /*
+    Check magic number and image version.
+  */
+  if (memcmp(prefix, backup_magic_bytes, sizeof(backup_magic_bytes)))
+  {
+    errm("not a backup image file: '%s'. Magic number mismatch.\n", strm->path);
+    goto err;
+  }
+  ERROR_INJECT("str_open_rd_version", prefix[8]= '\0';);
+  version= uint2korr(prefix+8);
+  if (version != 1)
+  {
+    errm("backup image version %u is not supported\n", version);
+    goto err;
+  }
+  *version_p= version;
+
+  /*
+    Set callback functions in struct st_backup_stream.
+  */
+  strm->bupstrm.stream.write=   (as_write_m) NULL;
+  strm->bupstrm.stream.read=    (as_read_m) str_read;
+  strm->bupstrm.stream.forward= (as_forward_m) NULL; /* str_forward; */
+
+  /*
+    Open the stream.
+  */
+  DBUG_PRINT("bupstrm", ("opening stream: '%s'  fd: %d", strm->path, strm->fd));
+  rc= bstream_open_rd(&strm->bupstrm, sizeof(prefix));
+  if (rc != BSTREAM_OK)
+  {
+    errm("cannot open stream library on '%s'.\n", strm->path);
+    goto err;
+  }
+  DBUG_PRINT("bupstrm", ("opened  stream: '%s'  fd: %d  rc: %d",
+                         strm->path, strm->fd, rc));
+
+  goto end;
+
+err:
+  switch (errpos) {
+#ifdef HAVE_COMPRESS
+  case 30:
+    (void) inflateEnd(&strm->zstream);
+  case 20:
+    my_free(strm->zbuf, MYF(0));
+    strm->zbuf= NULL;
+#endif
+  case 10:
+    (void) my_close(strm->fd, MYF(0));
+    strm->fd= -1;
+  }
+  rc= BSTREAM_ERROR;
+
+ end:
+  DBUG_RETURN(rc);
+}
+
+
+/**
+  Close the stream/image.
+
+  @param[in]    strm            stream handle
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+*/
+
+static int
+str_close(struct st_stream *strm)
+{
+  int rc;
+  int rc1;
+  DBUG_ENTER("str_close");
+  DBUG_ASSERT(strm && strm->path);
+
+  /* Close the stream. */
+  rc= bstream_close(&strm->bupstrm);
+  ERROR_INJECT("str_close_bstream", rc= BSTREAM_ERROR;);
+  if (rc != BSTREAM_OK)
+  {
+    errm("cannot close stream library on '%s'.\n",
+         strm->path);
+  }
+
+#ifdef HAVE_COMPRESS
+  /* Close zlib. */
+  if (strm->zbuf)
+  {
+    int zerr= inflateEnd(&strm->zstream);
+    ERROR_INJECT("str_close_zlib",
+                 zerr= Z_STREAM_ERROR;
+                 strm->zstream.msg= (char*) "error injected";);
+    if (zerr != Z_OK)
+    {
+      errm("cannot close zlib on image '%s': %d: %s\n",
+           strm->path, zerr, strm->zstream.msg);
+      rc= BSTREAM_ERROR;
+    }
+    my_free(strm->zbuf, (MYF(0)));
+    strm->zbuf= NULL;
+  }
+#endif
+
+  /* Close the image file. */
+  rc1= my_close(strm->fd, MYF(0));
+  ERROR_INJECT("str_close_file", rc1= 1; my_errno= EIO;);
+  if (rc1)
+  {
+    errm("cannot close image '%s': %s\n",
+         strm->path, strerror(my_errno));
+    rc= BSTREAM_ERROR;
+  }
+  strm->fd= -1;
+
+  DBUG_RETURN(rc);
+}
+
+
+/*
+  ====================================================
+  Backup image item handling.
+  These are callback functions for the stream library.
+  ====================================================
+*/
+
+/*
+  Helper struct for iterators.
+*/
+struct st_backup_iterator
+{
+  DYNAMIC_ARRAY                 *it_array;      /* Array to iterate */
+  int                           it_index;       /* Iterator value */
+  enum enum_bstream_item_type   it_type;        /* Iterator type */
+};
+
+
+/**
+  Clear catalogue and prepare it for populating with items.
+
+  @param[in]    hdr             catalog reference
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+
+  @note This is empty because backup_catalog_allocate() initializes
+  the catalog properly.
+*/
+
+int
+bcat_reset(struct st_bstream_image_header *hdr __attribute__((unused)))
+{
+  DBUG_ENTER("bcat_reset");
+  DBUG_RETURN(BSTREAM_OK);
+}
+
+
+/**
+  Close catalogue after all items have been added to it.
+
+  This allows for finalizing operations. It is not meant for
+  deletion of the catalog. There is no "open" action. The
+  approximate counterpart to bcat_close() is bcat_reset().
+
+  @param[in]    hdr             catalog reference
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+
+  @note This is empty because there is no finalization required.
+*/
+
+int
+bcat_close(struct st_bstream_image_header *hdr __attribute__((unused)))
+{
+  DBUG_ENTER("bcat_close");
+  DBUG_RETURN(BSTREAM_OK);
+}
+
+
+/**
+  Add item to the catalog.
+
+  For items that belong to a database, the base.db element points
+  to the databases' catalog item. The stream library evaluates
+  that pointer using an iterator provided by bcat_iterator_get().
+
+  The item name is allocated by the stream library and must be freed
+  by the application later.
+
+  @param[in,out]    hdr         catalog ref, updating catalog
+  @param[in]        item        item reference
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note item->pos should be set to indicate position of the item in the
+  catalogue. This is a global position per item type. Items that belong
+  to a database are not numbered relative to the database.
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+
+  @note Global, per-table and per-database items can have independent
+  address spaces. Thus item belonging to a database is identified by its
+  position inside that database's item list. Similar for items belonging
+  to tables.
+*/
+
+int
+bcat_add_item(struct st_bstream_image_header *hdr,
+              struct st_bstream_item_info *item)
+{
+  struct st_backup_catalog      *bup_catalog= (struct st_backup_catalog*) hdr;
+  enum enum_bstream_ret_codes   brc= BSTREAM_OK;
+  int                           err;
+  DBUG_ENTER("bcat_add_item");
+  DBUG_ASSERT(hdr);
+  DBUG_ASSERT(item);
+  DBUG_PRINT("bupstrm", ("adding item: 0x%lx  pos: %lu  type: %d  name: '%.*s'",
+                         (long) item, item->pos, item->type,
+                         BBLS(&item->name)));
+
+  switch (item->type) {
+
+  case BSTREAM_IT_CHARSET:
+  case BSTREAM_IT_USER:
+  case BSTREAM_IT_TABLESPACE:
+  {
+    struct st_backup_global     *bup_global;
+    DYNAMIC_ARRAY               *array;
+
+    /* Allocate memory for the item. */
+    ERROR_INJECT("bcat_add_item_global_malloc", my_malloc_error_inject= 1;);
+    bup_global= (struct st_backup_global*)
+      my_malloc(sizeof(struct st_backup_global), MYF(MY_WME));
+    if (!bup_global)
+    {
+      /* Error message reported by mysys. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy the item struct into the allocated struct. */
+    bup_global->glb_item= *item;
+    /* Initialize other elements. */
+    bzero(&bup_global->glb_metadata, sizeof(bup_global->glb_metadata));
+
+    switch (item->type) {
+    case BSTREAM_IT_CHARSET:
+      bup_global->glb_typename= "Charset";
+      array= &bup_catalog->cat_charsets;
+      break;
+    case BSTREAM_IT_USER:
+      /* purecov: begin inspected */
+      bup_global->glb_typename= "User";
+      array= &bup_catalog->cat_users;
+      break;
+      /* purecov: end */
+    case BSTREAM_IT_TABLESPACE:
+      bup_global->glb_typename= "Tablespace";
+      array= &bup_catalog->cat_tablespaces;
+      break;
+    default: break; /* purecov: deadcode */
+    }
+
+    /* Check consistency of array position. */
+    DBUG_ASSERT(item->pos == array->elements);
+    /* Insert a reference into the catalog. */
+    ERROR_INJECT("bcat_add_item_global_insert", my_malloc_error_inject= 1;);
+    err= insert_dynamic(array, (uchar*) &bup_global);
+    if (err)
+    {
+      /* Error message reported by mysys. */
+      my_free(bup_global, MYF(0));
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    DBUG_PRINT("bupstrm",
+               ("Added %s: '%.*s'  item: 0x%lx", bup_global->glb_typename,
+                BBLS(&item->name), (long) bup_global));
+    break;
+  }
+
+  case BSTREAM_IT_DB:
+  {
+    struct st_backup_database *bup_database;
+
+    /* Allocate memory for the item. */
+    ERROR_INJECT("bcat_add_item_db_malloc", my_malloc_error_inject= 1;);
+    bup_database= (struct st_backup_database*)
+      my_malloc(sizeof(struct st_backup_database), MYF(MY_WME));
+    if (!bup_database)
+    {
+      /* Error message reported by mysys. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy the item struct into the local struct. */
+    bup_database->db_item= *((struct st_bstream_db_info*) item);
+    /* Initialize other elements. */
+    bzero(&bup_database->db_metadata, sizeof(bup_database->db_metadata));
+    /* Note that the array contains pointers only. */
+    err= my_init_dynamic_array(&bup_database->db_tables,
+                               sizeof(struct st_backup_table*),
+                               DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+    ERROR_INJECT("bcat_add_item_db_tables", if (!err) {err= TRUE;
+        delete_dynamic(&bup_database->db_tables);});
+    if (err)
+    {
+      /* Error message reported by mysys. */
+      my_free(bup_database, MYF(0));
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Note that the array contains pointers only. */
+    err= my_init_dynamic_array(&bup_database->db_perdbs,
+                               sizeof(struct st_backup_perdb*),
+                               DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+    ERROR_INJECT("bcat_add_item_db_perdbs", if (!err) {err= TRUE;
+        delete_dynamic(&bup_database->db_perdbs);});
+    if (err)
+    {
+      /* Error message reported by mysys. */
+      delete_dynamic(&bup_database->db_tables);
+      my_free(bup_database, MYF(0));
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Check consistency of array position. */
+    DBUG_ASSERT(item->pos == bup_catalog->cat_databases.elements);
+    /* Insert a reference into the catalog. */
+    ERROR_INJECT("bcat_add_item_db_insert", my_malloc_error_inject= 1;);
+    err= insert_dynamic(&bup_catalog->cat_databases, (uchar*) &bup_database);
+    if (err)
+    {
+      /* Error message reported by mysys. */
+      delete_dynamic(&bup_database->db_perdbs);
+      delete_dynamic(&bup_database->db_tables);
+      my_free(bup_database, MYF(0));
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    DBUG_PRINT("bupstrm",
+               ("added database: '%.*s'  item: 0x%lx", BBLS(&item->name),
+                (long) bup_database));
+    break;
+  }
+
+  case BSTREAM_IT_TABLE:
+  {
+    struct st_backup_table      *bup_table;
+    struct st_backup_database   *bup_database;
+    struct st_backup_snapshot   *bup_snapshot;
+    uint                        snap_num;
+
+    /* Allocate memory for the item. */
+    ERROR_INJECT("bcat_add_item_table_malloc", my_malloc_error_inject= 1;);
+    bup_table= (struct st_backup_table*)
+      my_malloc(sizeof(struct st_backup_table), MYF(MY_WME));
+    if (!bup_table)
+    {
+      /* Error message reported by mysys. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy the item struct into the local struct. */
+    bup_table->tbl_item= *((struct st_bstream_table_info*) item);
+    /* Initialize other elements. */
+    bzero(&bup_table->tbl_metadata, sizeof(bup_table->tbl_metadata));
+    bup_table->tbl_data_size= 0;
+    /* Get the database reference from the item. */
+    bup_database= (struct st_backup_database*) bup_table->tbl_item.base.db;
+    DBUG_PRINT("bupstrm",
+               ("referred db item: 0x%lx  pos: %lu  type: %d  name: '%.*s'",
+                (long) bup_database, bup_database->db_item.base.pos,
+                bup_database->db_item.base.type,
+                BBLS(&bup_database->db_item.base.name)));
+    /* No consistency check of item->pos. It doesn't count per database. */
+    /* Insert a reference into its database's array. */
+    ERROR_INJECT("bcat_add_item_table_insert", my_malloc_error_inject= 1;);
+    err= insert_dynamic(&bup_database->db_tables, (uchar*) &bup_table);
+    if (err)
+    {
+      /* Error message reported by mysys. */
+      my_free(bup_table, MYF(0));
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Check plausibility of array position. */
+    snap_num= bup_table->tbl_item.snap_num;
+    DBUG_ASSERT(snap_num < bup_catalog->cat_snapshots.elements);
+    /* Get a reference to the snapshot information. */
+    bup_snapshot= *((struct st_backup_snapshot**)
+                    dynamic_array_ptr(&bup_catalog->cat_snapshots, snap_num));
+    /*
+      Check consistency of array position.
+      Table items are not numbered per database, but per snapshot.
+    */
+    DBUG_ASSERT(item->pos == bup_snapshot->snap_index_pos_to_table.elements);
+    /* Insert a reference into the snapshot's index array. */
+    ERROR_INJECT("bcat_add_item_table_index", my_malloc_error_inject= 1;);
+    err= insert_dynamic(&bup_snapshot->snap_index_pos_to_table,
+                        (uchar*) &bup_table);
+    if (err)
+    {
+      /* Error message reported by mysys. */
+      /* Do not free bup_table here. It's in the database array already. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    DBUG_PRINT("bupstrm",
+               ("added table: '%.*s'.'%.*s'  item: 0x%lx  snap_num: %u",
+                BBLS(&bup_database->db_item.base.name), BBLS(&item->name),
+                (long) bup_table, bup_table->tbl_item.snap_num));
+    break;
+  }
+
+  case BSTREAM_IT_PRIVILEGE:
+  case BSTREAM_IT_VIEW:
+  case BSTREAM_IT_SPROC:
+  case BSTREAM_IT_SFUNC:
+  case BSTREAM_IT_EVENT:
+  case BSTREAM_IT_TRIGGER:
+  {
+    struct st_backup_perdb      *bup_perdb;
+    struct st_backup_database   *bup_database;
+
+    /* Allocate memory for the item. */
+    ERROR_INJECT("bcat_add_item_perdb_malloc", my_malloc_error_inject= 1;);
+    bup_perdb= (struct st_backup_perdb*)
+      my_malloc(sizeof(struct st_backup_perdb), MYF(MY_WME));
+    if (!bup_perdb)
+    {
+      /* Error message reported by mysys. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy the item struct into the local struct. */
+    bup_perdb->perdb_item= *((struct st_bstream_dbitem_info*) item);
+    /* Initialize other elements. */
+    bzero(&bup_perdb->perdb_metadata, sizeof(bup_perdb->perdb_metadata));
+    /* Get the database reference from the item. */
+    bup_database= (struct st_backup_database*) bup_perdb->perdb_item.db;
+    DBUG_PRINT("bupstrm",
+               ("referred db item: 0x%lx  pos: %lu  type: %d  name: '%.*s'",
+                (long) bup_database, bup_database->db_item.base.pos,
+                bup_database->db_item.base.type,
+                BBLS(&bup_database->db_item.base.name)));
+    /* Check consistency of array position. */
+    DBUG_ASSERT(item->pos == bup_database->db_perdbs.elements);
+    /* Insert a reference into its database's array. */
+    ERROR_INJECT("bcat_add_item_perdb_insert", my_malloc_error_inject= 1;);
+    err= insert_dynamic(&bup_database->db_perdbs, (uchar*) &bup_perdb);
+    if (err)
+    {
+      /* Error message reported by mysys. */
+      my_free(bup_perdb, MYF(0));
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+#if !defined(DBUG_OFF)
+    {
+      const char *typ;
+
+      switch (item->type) {
+      case BSTREAM_IT_VIEW:       typ= "view"; break;
+      case BSTREAM_IT_PRIVILEGE:  typ= "privilege"; break;
+      default:                    typ= "unknown"; break;
+      }
+      DBUG_PRINT("bupstrm",
+                 ("added %s: '%.*s'.'%.*s'  item: 0x%lx", typ,
+                  BBLS(&bup_database->db_item.base.name), BBLS(&item->name),
+                  (long) bup_perdb));
+    }
+#endif
+    break;
+  }
+
+  /* purecov: begin inspected */
+  default:
+  {
+    errm("backup object not yet implemented: unknown type\n");
+    brc= BSTREAM_ERROR;
+    DBUG_PRINT("bupstrm", ("NOTYET implemented: unknown type: '%.*s'",
+                           BBLS(&item->name)));
+    DBUG_ASSERT(0);
+  }
+  /* purecov: end */
+  }
+
+ end:
+  DBUG_RETURN(brc);
+}
+
+
+/**
+  Create global iterator of a given type.
+
+  Possible iterator types.
+
+  - BSTREAM_IT_CHARSET:    all charsets
+  - BSTREAM_IT_USER:       all users
+  - BSTREAM_IT_TABLESPACE: all tablespaces
+  - BSTREAM_IT_DB:         all databases
+
+  The following types of iterators iterate only over items for which
+  some meta-data should be saved in the image.
+
+  - BSTREAM_IT_GLOBAL:     all global items in create-dependency order
+  - BSTREAM_IT_PERDB:      all per-db items except tables which are enumerated
+                           by a table iterator (see below)
+  - BSTREAM_IT_PERTABLE:   all per-table items in create-dependency orders.
+
+  @param[in]    hdr             catalog reference
+  @param[in]    it_type         iterator type
+
+  @return       pointer to the iterator
+    @retval     NULL            error
+*/
+
+void*
+bcat_iterator_get(struct st_bstream_image_header *hdr, unsigned int it_type)
+{
+  struct st_backup_catalog      *bup_catalog= (struct st_backup_catalog*) hdr;
+  struct st_backup_iterator     *iter;
+  DBUG_ENTER("bcat_iterator_get");
+  DBUG_ASSERT(hdr);
+  DBUG_PRINT("bupstrm", ("getting iterator for type: %u", it_type));
+
+  ERROR_INJECT("bcat_iterator_get_malloc", my_malloc_error_inject= 1;);
+  iter= my_malloc(sizeof(struct st_backup_iterator), MYF(MY_WME));
+  if (!iter)
+  {
+    /* Error message reported by mysys. */
+    goto end;
+  }
+  iter->it_index= -1;
+  iter->it_type= it_type;
+
+  ERROR_INJECT("bcat_iterator_get_type", it_type= BSTREAM_IT_PERTABLE;);
+  switch (it_type) {
+
+    /* purecov: begin inspected */
+  case BSTREAM_IT_CHARSET:
+    iter->it_array= &bup_catalog->cat_charsets;
+    DBUG_PRINT("bupstrm", ("charset"));
+    break;
+
+  case BSTREAM_IT_USER:
+    iter->it_array= &bup_catalog->cat_users;
+    DBUG_PRINT("bupstrm", ("user"));
+    goto err;
+    /* purecov: end */
+
+  case BSTREAM_IT_DB:
+    iter->it_array= &bup_catalog->cat_databases;
+    DBUG_PRINT("bupstrm", ("database"));
+    break;
+
+    /* purecov: begin inspected */
+  case BSTREAM_IT_TABLESPACE:
+    iter->it_array= &bup_catalog->cat_tablespaces;
+    DBUG_PRINT("bupstrm", ("tablespace"));
+    goto err;
+
+  case BSTREAM_IT_GLOBAL:
+    errm("iterator type not yet implemented: global\n");
+    DBUG_PRINT("bupstrm", ("NOTYET implemented: global"));
+    goto err;
+
+  case BSTREAM_IT_PERDB:
+    errm("iterator type not yet implemented: perdb\n");
+    DBUG_PRINT("bupstrm", ("NOTYET implemented: perdb"));
+    goto err;
+    /* purecov: end */
+
+  case BSTREAM_IT_PERTABLE:
+    errm("iterator type not yet implemented: pertable\n");
+    DBUG_PRINT("bupstrm", ("NOTYET implemented: pertable"));
+    goto err;
+
+    /* purecov: begin inspected */
+  default:
+    errm("iterator type not yet implemented: type %u\n", it_type);
+    DBUG_PRINT("bupstrm", ("NOTYET implemented: type %u", it_type));
+    DBUG_ASSERT(0);
+    goto err;
+    /* purecov: end */
+  }
+
+  goto end;
+
+ err:
+  my_free(iter, MYF(0));
+  iter= NULL;
+
+ end:
+  DBUG_PRINT("bupstrm", ("iterator: 0x%lx", (long) iter));
+  DBUG_RETURN((void*) iter);
+}
+
+
+/**
+  Return next item pointed by iterator.
+
+  @param[in]    hdr             catalog reference
+  @param[in]    iter_arg        iterator reference
+
+  @return       pointer to catalog item
+    @retval     NULL            end of items or error
+*/
+
+struct st_bstream_item_info*
+bcat_iterator_next(struct st_bstream_image_header *hdr __attribute__((unused)),
+                   void *iter_arg)
+{
+  struct st_backup_iterator     *iter= (struct st_backup_iterator*) iter_arg;
+  struct st_bstream_item_info   *item;
+  DBUG_ENTER("bcat_iterator_next");
+  DBUG_PRINT("bupstrm", ("iter: 0x%lx", (long) iter));
+  DBUG_ASSERT(iter);
+  DBUG_ASSERT(iter->it_array);
+
+  /* Check for end of array. */
+  if (++iter->it_index >= (int) iter->it_array->elements)
+  {
+    /* End of array. Return NULL. This is not an error. */
+    DBUG_PRINT("bupstrm", ("end of array, item: NULL"));
+    item= NULL;
+    goto end;
+  }
+  /* Note that the array contains pointers only. */
+  item= *((struct st_bstream_item_info**)
+          dynamic_array_ptr(iter->it_array, iter->it_index));
+
+  DBUG_PRINT("bupstrm", ("next iterator for type: %u", iter->it_type));
+  DBUG_PRINT("bupstrm", ("next item: 0x%lx  pos: %lu  type: %d  name: '%.*s'",
+                         (long) item, item->pos, item->type,
+                         BBLS(&item->name)));
+
+ end:
+  DBUG_RETURN(item);
+}
+
+
+/**
+  Free iterator resources.
+
+  @param[in]    hdr             catalog reference
+  @param[in]    iter_arg        iterator reference
+
+  @note
+  The iterator can not be used after call to this function.
+*/
+
+void
+bcat_iterator_free(struct st_bstream_image_header *hdr __attribute__((unused)),
+                   void *iter_arg)
+{
+  DBUG_ENTER("bcat_iterator_free");
+  my_free(iter_arg, MYF(0));
+  DBUG_VOID_RETURN;
+}
+
+
+/* purecov: begin deadcode */
+
+/**
+  Create iterator for items belonging to a given database.
+
+  @param[in]    hdr             catalog reference
+  @param[in]    db              database item reference
+
+  @return       pointer to the iterator
+    @retval     NULL            error
+
+  @note Not used when reading a backup stream.
+*/
+
+void*
+bcat_db_iterator_get(struct st_bstream_image_header *hdr
+                     __attribute__((unused)),
+                     struct st_bstream_db_info *db
+                     __attribute__((unused)))
+{
+  DBUG_ENTER("bcat_db_iterator_get");
+  DBUG_ASSERT(0);
+  DBUG_RETURN(NULL);
+}
+
+
+/**
+  Return next item from database items iterator
+
+  @param[in]    hdr             catalog reference
+  @param[in]    db              database item reference
+  @param[in]    iter_arg        iterator reference
+
+  @return       pointer to catalog item
+    @retval     NULL            error
+
+  @note Not used when reading a backup stream.
+*/
+
+struct st_bstream_dbitem_info*
+bcat_db_iterator_next(struct st_bstream_image_header *hdr
+                      __attribute__((unused)),
+                      struct st_bstream_db_info *db
+                      __attribute__((unused)),
+                      void *iter_arg
+                      __attribute__((unused)))
+{
+  DBUG_ENTER("bcat_db_iterator_next");
+  DBUG_ASSERT(0);
+  DBUG_RETURN(NULL);
+}
+
+
+/**
+  Free database items iterator resources
+
+  @param[in]    hdr             catalog reference
+  @param[in]    db              database item reference
+  @param[in]    iter_arg        iterator reference
+
+  @note Not used when reading a backup stream.
+*/
+
+void
+bcat_db_iterator_free(struct st_bstream_image_header *hdr
+                      __attribute__((unused)),
+                      struct st_bstream_db_info *db
+                      __attribute__((unused)),
+                      void *iter_arg
+                      __attribute__((unused)))
+{
+  DBUG_ENTER("bcat_db_iterator_free");
+  DBUG_ASSERT(0);
+  DBUG_VOID_RETURN;
+}
+
+
+/**
+  Produce CREATE statement for a given item.
+
+  Backup stream library calls this function when saving item's
+  meta-data. If function successfully produces the statement, it becomes
+  part of meta-data.
+
+  @param[in]    hdr             catalog reference
+  @param[in]    item            item reference
+  @param[out]   query           query string
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+
+  @note Not used when reading a backup stream.
+*/
+
+int
+bcat_get_item_create_query(struct st_bstream_image_header *hdr
+                           __attribute__((unused)),
+                           struct st_bstream_item_info *item
+                           __attribute__((unused)),
+                           bstream_blob *query
+                           __attribute__((unused)))
+{
+  DBUG_ENTER("bcat_get_item_create_query");
+  DBUG_ASSERT(0);
+  DBUG_RETURN(BSTREAM_OK);
+}
+
+
+/**
+  Return meta-data (other than CREATE statement) for a given item.
+
+  Backup stream library calls this function when saving item's
+  meta-data. If function returns successfully, the bytes returned become
+  part of meta-data.
+
+  @param[in]    hdr             catalog reference
+  @param[in]    item            item reference
+  @param[out]   data            data blob
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+
+  @note Not used when reading a backup stream.
+*/
+
+int
+bcat_get_item_create_data(struct st_bstream_image_header *hdr
+                          __attribute__((unused)),
+                          struct st_bstream_item_info *item
+                          __attribute__((unused)),
+                          struct st_blob *data
+                          __attribute__((unused)))
+{
+  DBUG_ENTER("bcat_get_item_create_data");
+  DBUG_ASSERT(0);
+  DBUG_RETURN(BSTREAM_ERROR);
+}
+
+/* purecov: end */
+
+
+/**
+  Create database object from its meta-data.
+
+  When the meta-data section of backup image is read, items can be created
+  as their meta-data is read (so that there is no need to store these
+  meta-data). This functions stores them in the catalog instead of
+  creating database objects. So the application can make different use
+  of the data.
+
+  @param[in]    hdr             catalog reference
+  @param[in]    item            item reference
+  @param[in]    query           query string
+  @param[in]    data            data blob
+
+  @note The item has set the 'type' element only. No item name nor
+  a catalog position is provided. Let alone a reference to a database.
+
+  @note Either query or data or both can be empty, depending
+  on what was stored in the image.
+
+  @note The blob provided by query and/or data is not guaranteed to
+  exist after the call. It must be copied to become part of the catalog.
+
+  @return       status
+    @retval     BSTREAM_OK      ok
+    @retval     otherwise       error
+
+  @note The return value is specified as 'int' in stream_v1.h
+  though only values from enum_bstream_ret_codes are expected.
+*/
+
+int
+bcat_create_item(struct st_bstream_image_header *hdr,
+                 struct st_bstream_item_info *item,
+                 struct st_blob query,
+                 struct st_blob data)
+{
+  struct st_backup_catalog      *bup_catalog= (struct st_backup_catalog*) hdr;
+  struct st_backup_metadata     mdata;
+  enum enum_bstream_ret_codes   brc= BSTREAM_OK;
+  DBUG_ENTER("bcat_create_item");
+  DBUG_ASSERT(hdr);
+  DBUG_ASSERT(item);
+  DBUG_PRINT("bupstrm", ("item: 0x%lx  pos: %lu  type: %d  name: '%.*s'",
+                         (long) item, item->pos, item->type,
+                         BBLS(&item->name)));
+  DBUG_PRINT("bupstrm", ("query: '%.*s'", BBLS(&query)));
+  DBUG_PRINT("bupstrm", ("data length: %lu", BBL(&data)));
+
+  /*
+    Create new st_blob structs. The strings from the
+    stream libraray have a short life time.
+  */
+  ERROR_INJECT("bcat_create_item_malloc", my_malloc_error_inject= 1;);
+  mdata.md_query.begin= (query.begin ?
+                         my_memdup(query.begin, BBL(&query), MYF(MY_WME)) :
+                         NULL);
+  mdata.md_query.end= (mdata.md_query.begin ?
+                       mdata.md_query.begin + BBL(&query) :
+                       NULL);
+
+  mdata.md_data.begin= (data.begin ?
+                        my_memdup(data.begin, BBL(&data), MYF(MY_WME)) :
+                        NULL);
+  mdata.md_data.end= (mdata.md_data.begin ?
+                      mdata.md_data.begin + BBL(&data) :
+                      NULL);
+
+  DBUG_PRINT("bupstrm", ("query.begin: 0x%lx  data.begin: 0x%lx",
+                         (long) mdata.md_query.begin,
+                         (long) mdata.md_data.begin));
+
+  if ((query.begin && !mdata.md_query.begin) ||
+      (data.begin && !mdata.md_data.begin))
+  {
+    /* Memory allocation failed. Error message reported by mysys. */
+    brc= BSTREAM_ERROR;
+    goto end;
+  }
+
+  ERROR_INJECT("bcat_create_item_user",
+               item->type= BSTREAM_IT_USER; item->pos= ULONG_MAX;);
+  switch (item->type) {
+
+  case BSTREAM_IT_CHARSET:
+  case BSTREAM_IT_USER:
+  case BSTREAM_IT_TABLESPACE:
+  {
+    struct st_backup_global     *bup_global;
+    const char                  *typnam;
+    DYNAMIC_ARRAY               *array;
+
+    switch (item->type) {
+    case BSTREAM_IT_CHARSET:
+      /* purecov: begin inspected */
+      typnam= "Charset";
+      array= &bup_catalog->cat_charsets;
+      break;
+      /* purecov: end */
+    case BSTREAM_IT_USER:
+      typnam= "User";
+      array= &bup_catalog->cat_users;
+      break;
+    case BSTREAM_IT_TABLESPACE:
+      typnam= "Tablespace";
+      array= &bup_catalog->cat_tablespaces;
+      break;
+    default: break; /* purecov: deadcode */
+    }
+
+    bup_global= backup_locate_global(typnam, array, item->pos);
+    if (!bup_global)
+    {
+      /* Error message reported by function. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy meta data. */
+    bup_global->glb_metadata= mdata;
+    DBUG_PRINT("bupstrm", ("Added metadata for %s", typnam));
+    break;
+  }
+
+  case BSTREAM_IT_DB:
+  {
+    struct st_backup_database *bup_database;
+
+    bup_database= (struct st_backup_database*)
+      backup_locate_global("Database", &bup_catalog->cat_databases, item->pos);
+    if (!bup_database)
+    {
+      /* Error message reported by function. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy meta data. */
+    bup_database->db_metadata= mdata;
+    DBUG_PRINT("bupstrm", ("Added metadata for Database"));
+    break;
+  }
+
+  case BSTREAM_IT_TABLE:
+  {
+    struct st_bstream_table_info *item_tbl=
+      (struct st_bstream_table_info*) item;
+    struct st_backup_table *bup_table;
+    DBUG_PRINT("bupstrm", ("table  snap_num: %u  pos: %lu",
+                           item_tbl->snap_num, item_tbl->base.base.pos));
+    bup_table= backup_locate_table(bup_catalog, item_tbl->snap_num,
+                                 item_tbl->base.base.pos);
+    if (!bup_table)
+    {
+      /* Error message reported by function. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy meta data. */
+    bup_table->tbl_metadata= mdata;
+    break;
+  }
+
+  case BSTREAM_IT_PRIVILEGE:
+  case BSTREAM_IT_VIEW:
+  case BSTREAM_IT_SPROC:
+  case BSTREAM_IT_SFUNC:
+  case BSTREAM_IT_EVENT:
+  case BSTREAM_IT_TRIGGER:
+   {
+    struct st_bstream_dbitem_info *item_perdb=
+      (struct st_bstream_dbitem_info*) item;
+    struct st_backup_perdb *bup_perdb;
+    DBUG_PRINT("bupstrm", ("perdb  db_pos: %lu  pos: %lu",
+                           item_perdb->db->base.pos, item_perdb->base.pos));
+    bup_perdb= backup_locate_perdb(bup_catalog, item_perdb->db->base.pos,
+                                   item_perdb->base.pos);
+    if (!bup_perdb)
+    {
+      /* Error message reported by function. */
+      brc= BSTREAM_ERROR;
+      goto end;
+    }
+    /* Copy meta data. */
+    bup_perdb->perdb_metadata= mdata;
+    break;
+  }
+
+   /* purecov: begin inspected */
+  default:
+  {
+    errm("meta data not yet implemented: unknown type\n");
+    brc= BSTREAM_ERROR;
+    DBUG_PRINT("bupstrm", ("NOTYET implemented: unknown type: '%.*s'",
+                           BBLS(&item->name)));
+    DBUG_ASSERT(0);
+  }
+    /* purecov: end */
+  }
+
+ end:
+  if (brc != BSTREAM_OK)
+  {
+    /* Free what has been allocated. */
+    my_free(mdata.md_data.begin, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mdata.md_query.begin, MYF(MY_ALLOW_ZERO_PTR));
+  }
+  DBUG_RETURN(brc);
+}
+
+
+/*
+  ========================================
+  Functions for reading of a backup image.
+  ========================================
+*/
+
+/**
+  Allocate a backup catalog.
+
+  @return       catalog reference
+    @retval     NULL            error
+*/
+
+struct st_backup_catalog*
+backup_catalog_allocate(void)
+{
+  struct st_backup_catalog      *bup_catalog;
+  int                           errpos= 0;
+  int                           err;
+  DBUG_ENTER("backup_catalog_allocate");
+
+  ERROR_INJECT("backup_catalog_allocate_malloc", my_malloc_error_inject= 1;);
+  bup_catalog= my_malloc(sizeof(struct st_backup_catalog),
+                         MYF(MY_WME | MY_ZEROFILL));
+  if (!bup_catalog)
+  {
+    /* Error message reported by mysys. */
+    goto err;
+  }
+  errpos= 10;
+
+  /* Note that the array contains pointers only. */
+  err= my_init_dynamic_array(&bup_catalog->cat_charsets,
+                             sizeof(struct st_backup_global*),
+                             DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+  ERROR_INJECT("backup_catalog_allocate_charsets", if (!err) {err= TRUE;
+      delete_dynamic(&bup_catalog->cat_charsets);});
+  if(err)
+  {
+    /* Error message reported by mysys. */
+    goto err;
+  }
+  errpos= 20;
+
+  /* Note that the array contains pointers only. */
+  err= my_init_dynamic_array(&bup_catalog->cat_users,
+                             sizeof(struct st_backup_global*),
+                             DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+  ERROR_INJECT("backup_catalog_allocate_users", if (!err) {err= TRUE;
+      delete_dynamic(&bup_catalog->cat_users);});
+  if(err)
+  {
+    /* Error message reported by mysys. */
+    goto err;
+  }
+  errpos= 30;
+
+  /* Note that the array contains pointers only. */
+  err= my_init_dynamic_array(&bup_catalog->cat_tablespaces,
+                             sizeof(struct st_backup_global*),
+                             DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+  ERROR_INJECT("backup_catalog_allocate_tablespaces", if (!err) {err= TRUE;
+      delete_dynamic(&bup_catalog->cat_tablespaces);});
+  if(err)
+  {
+    /* Error message reported by mysys. */
+    goto err;
+  }
+  errpos= 40;
+
+  /* Note that the array contains pointers only. */
+  err= my_init_dynamic_array(&bup_catalog->cat_databases,
+                             sizeof(struct st_backup_database*),
+                             DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+  ERROR_INJECT("backup_catalog_allocate_databases", if (!err) {err= TRUE;
+      delete_dynamic(&bup_catalog->cat_databases);});
+  if(err)
+  {
+    /* Error message reported by mysys. */
+    goto err;
+  }
+  errpos= 50;
+
+  /* Note that the array contains pointers only. */
+  err= my_init_dynamic_array(&bup_catalog->cat_snapshots,
+                             sizeof(struct st_backup_snapshot*),
+                             DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+  ERROR_INJECT("backup_catalog_allocate_snapshots", if (!err) {err= TRUE;
+      delete_dynamic(&bup_catalog->cat_snapshots);});
+  if(err)
+  {
+    /* Error message reported by mysys. */
+    goto err;
+  }
+
+  goto end;
+
+ err:
+  switch(errpos) {
+  case 50:
+    delete_dynamic(&bup_catalog->cat_databases);
+  case 40:
+    delete_dynamic(&bup_catalog->cat_tablespaces);
+  case 30:
+    delete_dynamic(&bup_catalog->cat_users);
+  case 20:
+    delete_dynamic(&bup_catalog->cat_charsets);
+  case 10:
+    my_free(bup_catalog, MYF(0));
+    bup_catalog= NULL;
+  }
+
+ end:
+  DBUG_RETURN(bup_catalog);
+}
+
+
+/**
+  Free a backup catalog.
+
+  @param[in]    bup_catalog             catalog reference
+*/
+
+void
+backup_catalog_free(struct st_backup_catalog *bup_catalog)
+{
+  struct st_bstream_image_header        *hdr= &bup_catalog->cat_header;
+  ulong                                 idx;
+  ulong                                 jdx;
+  DBUG_ENTER("backup_catalog_free");
+  DBUG_ASSERT(bup_catalog);
+
+  /* Snapshots. */
+  DBUG_PRINT("bupstrm", ("freeing snapshots."));
+  for (idx= 0; idx < bup_catalog->cat_snapshots.elements; idx++)
+  {
+    struct st_backup_snapshot   *bup_snapshot;
+
+    /* Note that the array contains pointers only. */
+    bup_snapshot= *((struct st_backup_snapshot**)
+                    dynamic_array_ptr(&bup_catalog->cat_snapshots, idx));
+    /* The referenced items are freed with their databases. */
+    delete_dynamic(&bup_snapshot->snap_index_pos_to_table);
+    /* Free the item itself. */
+    my_free(bup_snapshot, MYF(0));
+  }
+  delete_dynamic(&bup_catalog->cat_snapshots);
+
+  /* Databases and contained objects. */
+  DBUG_PRINT("bupstrm", ("freeing databases and contained objects."));
+  for (idx= 0; idx < bup_catalog->cat_databases.elements; idx++)
+  {
+    struct st_backup_database   *bup_database;
+    struct st_backup_metadata   *mdata;
+
+    bup_database= (struct st_backup_database*)
+      backup_locate_global("Database", &bup_catalog->cat_databases, idx);
+    if (!bup_database)
+    {
+      /* Error message reported by function. */
+      continue;
+    }
+
+    /* Perdb items. */
+    DBUG_PRINT("bupstrm", ("freeing perdbs."));
+    for (jdx= 0; jdx < bup_database->db_perdbs.elements; jdx++)
+    {
+      struct st_backup_perdb    *bup_perdb;
+
+      /* Note that the array contains pointers only. */
+      bup_perdb= *((struct st_backup_perdb**)
+                   dynamic_array_ptr(&bup_database->db_perdbs, jdx));
+      DBUG_ASSERT(bup_perdb);
+      mdata= &bup_perdb->perdb_metadata;
+      my_free(mdata->md_data.begin, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(mdata->md_query.begin, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(bup_perdb->perdb_item.base.name.begin, MYF(MY_ALLOW_ZERO_PTR));
+      /* Free the item itself. */
+      my_free(bup_perdb, MYF(0));
+    }
+    delete_dynamic(&bup_database->db_perdbs);
+
+    /* Tables. */
+    DBUG_PRINT("bupstrm", ("freeing tables."));
+    for (jdx= 0; jdx < bup_database->db_tables.elements; jdx++)
+    {
+      struct st_backup_table    *bup_table;
+
+      /* Note that the array contains pointers only. */
+      bup_table= *((struct st_backup_table**)
+                   dynamic_array_ptr(&bup_database->db_tables, jdx));
+      mdata= &bup_table->tbl_metadata;
+      my_free(mdata->md_data.begin, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(mdata->md_query.begin, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(bup_table->tbl_item.base.base.name.begin, MYF(MY_ALLOW_ZERO_PTR));
+      /* Free the item itself. */
+      my_free(bup_table, MYF(0));
+    }
+    delete_dynamic(&bup_database->db_tables);
+
+    DBUG_PRINT("bupstrm", ("freeing db meta data."));
+    mdata= &bup_database->db_metadata;
+    my_free(mdata->md_data.begin, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mdata->md_query.begin, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(bup_database->db_item.base.name.begin, MYF(MY_ALLOW_ZERO_PTR));
+    /* Free the item itself. */
+    my_free(bup_database, MYF(0));
+  }
+  delete_dynamic(&bup_catalog->cat_databases);
+
+  /* Table spaces. */
+  DBUG_PRINT("bupstrm", ("freeing table spaces."));
+  for (idx= 0; idx < bup_catalog->cat_tablespaces.elements; idx++)
+  {
+    struct st_backup_global     *bup_global;
+    struct st_backup_metadata   *mdata;
+
+    /* Note that the array contains pointers only. */
+    bup_global= *((struct st_backup_global**)
+                      dynamic_array_ptr(&bup_catalog->cat_tablespaces, idx));
+
+    DBUG_PRINT("bupstrm", ("freeing tablespace meta data."));
+    mdata= &bup_global->glb_metadata;
+    my_free(mdata->md_data.begin, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mdata->md_query.begin, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(bup_global->glb_item.name.begin, MYF(MY_ALLOW_ZERO_PTR));
+    /* Free the item itself. */
+    my_free(bup_global, MYF(0));
+  }
+  delete_dynamic(&bup_catalog->cat_tablespaces);
+
+  /* Users. */
+  DBUG_PRINT("bupstrm", ("freeing users."));
+  for (idx= 0; idx < bup_catalog->cat_users.elements; idx++)
+  {
+    /* purecov: begin inspected */
+    struct st_backup_global       *bup_global;
+
+    /* Note that the array contains pointers only. */
+    bup_global= *((struct st_backup_global**)
+                dynamic_array_ptr(&bup_catalog->cat_users, idx));
+
+    my_free(bup_global->glb_item.name.begin, MYF(MY_ALLOW_ZERO_PTR));
+    /* Free the item itself. */
+    my_free(bup_global, MYF(0));
+    /* purecov: end */
+  }
+  delete_dynamic(&bup_catalog->cat_users);
+
+  /* Character sets. */
+  DBUG_PRINT("bupstrm", ("freeing charsets."));
+  for (idx= 0; idx < bup_catalog->cat_charsets.elements; idx++)
+  {
+    struct st_backup_global    *bup_global;
+
+    /* Note that the array contains pointers only. */
+    bup_global= *((struct st_backup_global**)
+                   dynamic_array_ptr(&bup_catalog->cat_charsets, idx));
+
+    my_free(bup_global->glb_item.name.begin, MYF(MY_ALLOW_ZERO_PTR));
+    /* Free the item itself. */
+    my_free(bup_global, MYF(0));
+  }
+  delete_dynamic(&bup_catalog->cat_charsets);
+
+  /* Header, snapshots. */
+  DBUG_PRINT("bupstrm", ("freeing header, snapshots."));
+  for (idx= 0; idx < hdr->snap_count; ++idx)
+    bstream_free(hdr->snapshot[idx].engine.name.begin);
+
+  /* Header, binlog goup file. */
+  DBUG_PRINT("bupstrm", ("freeing header, binlog goup file."));
+  if (hdr->binlog_group.file)
+    bstream_free(hdr->binlog_group.file); /* purecov: inspected */
+
+  /* Header, binlog file. */
+  DBUG_PRINT("bupstrm", ("freeing header, binlog file."));
+  if (hdr->binlog_pos.file)
+    bstream_free(hdr->binlog_pos.file);
+
+  /* Header, server version. */
+  DBUG_PRINT("bupstrm", ("freeing header, server version."));
+  if (hdr->server_version.extra.begin)
+    bstream_free(hdr->server_version.extra.begin);
+
+  /* Catalog. */
+  DBUG_PRINT("bupstrm", ("freeing catalog."));
+  my_free(bup_catalog, MYF(0));
+
+  DBUG_VOID_RETURN;
+}
+
+
+/**
+  Open a backup image.
+
+  @param[in]    filename                file name
+  @param[in]    bup_catalog             catalog reference
+
+  @return       image handle reference
+    @retval     NULL                    error
+*/
+
+void*
+backup_image_open(const char *filename, struct st_backup_catalog *bup_catalog)
+{
+  struct st_stream      *strm;
+  int                   rc;
+  int                   errpos= 0;
+  uint                  idx;
+  uint                  version;
+  DBUG_ENTER("backup_image_open");
+  DBUG_ASSERT(filename);
+  DBUG_ASSERT(bup_catalog);
+
+  /* Allocate low-level stream info struct. */
+  ERROR_INJECT("backup_image_open_malloc", my_malloc_error_inject= 1;);
+  strm= my_malloc(sizeof(struct st_stream), MYF(MY_WME));
+  if (!strm)
+  {
+    /* Error message reported by mysys. */
+    goto err;
+  }
+  errpos= 10;
+
+  /*
+    Open stream.
+  */
+  rc= str_open_rd(strm, filename, &version);
+  DBUG_PRINT("bupstrm", ("Opened backup image file (rc=%d)", rc));
+  if (rc != BSTREAM_OK)
+  {
+    /* Error message reported by function. */
+    goto err;
+  }
+  strm->stream_pos= "prefix";
+  errpos= 20;
+
+  /* Add compression algorithm to header. */
+  bup_catalog->cat_zalgo= strm->zalgo;
+
+  /* Add image path to header. */
+  bup_catalog->cat_image_path= strm->path;
+
+  /* Add image size to header. */
+  bup_catalog->cat_image_size= strm->size;
+
+  /*
+    Read backup image stream header.
+  */
+  rc= bstream_rd_header(&strm->bupstrm, &bup_catalog->cat_header);
+  ERROR_INJECT("backup_image_open_header", rc= BSTREAM_ERROR;);
+  DBUG_PRINT("bupstrm", ("Read archive header (rc=%d)", rc));
+  if ((rc != BSTREAM_OK) && (rc != BSTREAM_EOC))
+  {
+    errm("error on stream library read of header.\n");
+    goto err;
+  }
+  strm->stream_pos= "header";
+
+  /* Add image version to header. */
+  bup_catalog->cat_header.version= version;
+  DBUG_PRINT("bupstrm", ("set header version: %u", version));
+
+  /*
+    Now that we know, how many snapshots we have, initialize the
+    snapshot pos to table index arrays.
+  */
+  DBUG_PRINT("bupstrm", ("allocating snapshot indexes: %u",
+                         bup_catalog->cat_header.snap_count));
+  for (idx= 0; idx < bup_catalog->cat_header.snap_count; idx++)
+  {
+    struct st_backup_snapshot *bup_snapshot;
+
+    /* Allocate memory for the item. */
+    ERROR_INJECT("backup_image_open_snapshot_malloc",
+                 my_malloc_error_inject= 1;);
+    bup_snapshot= (struct st_backup_snapshot*)
+      my_malloc(sizeof(struct st_backup_snapshot), MYF(MY_WME));
+    if (!bup_snapshot)
+    {
+      /* Error message reported by mysys. */
+      rc= BSTREAM_ERROR;
+      goto err;
+    }
+    /* Initialize a new index array. */
+    rc= my_init_dynamic_array(&bup_snapshot->snap_index_pos_to_table,
+                              sizeof(struct st_backup_table*),
+                              DYN_ALLOC_INIT, DYN_ALLOC_INCR);
+    ERROR_INJECT("backup_image_open_index", if (!rc) {rc= TRUE;
+        delete_dynamic(&bup_snapshot->snap_index_pos_to_table);});
+    ERROR_INJECT("backup_image_open_index1", if (idx && !rc) {rc= TRUE;
+        delete_dynamic(&bup_snapshot->snap_index_pos_to_table);});
+    if (rc)
+    {
+      /* Error message reported by mysys. */
+      my_free(bup_snapshot, MYF(0));
+      rc= BSTREAM_ERROR;
+      goto err;
+    }
+    /* Check consistency of array position. */
+    DBUG_ASSERT(idx == bup_catalog->cat_snapshots.elements);
+    /* Insert in the catalog. */
+    ERROR_INJECT("backup_image_open_snapshot_insert",
+                 my_malloc_error_inject= 1;);
+    rc= insert_dynamic(&bup_catalog->cat_snapshots, (uchar*) &bup_snapshot);
+    if (rc)
+    {
+      /* Error message reported by mysys. */
+      delete_dynamic(&bup_snapshot->snap_index_pos_to_table);
+      my_free(bup_snapshot, MYF(0));
+      rc= BSTREAM_ERROR;
+      goto err;
+    }
+  }
+
+  goto end;
+
+ err:
+  switch (errpos) {
+  case 20:
+    (void) str_close(strm);
+  case 10:
+    my_free(strm, MYF(MY_ALLOW_ZERO_PTR));
+    strm= NULL;
+  }
+
+ end:
+  DBUG_RETURN(strm);
+}
+
+
+/**
+  Close a backup image.
+
+  @param[in]    image_handle            image handle reference
+*/
+
+enum enum_bstream_ret_codes
+backup_image_close(void* image_handle)
+{
+  struct st_stream *strm= (struct st_stream*) image_handle;
+  enum enum_bstream_ret_codes brc;
+  DBUG_ENTER("backup_image_close");
+  DBUG_ASSERT(strm);
+
+  brc= str_close(strm);
+  my_free(strm, MYF(0));
+  DBUG_RETURN(brc);
+}
+
+
+/**
+  Read backup image catalog.
+
+  @param[in]    image_handle            image handle reference
+  @param[in]    bup_catalog             catalog reference
+
+  @return       status
+    @retval     BSTREAM_OK              ok
+    @retval     != BSTREAM_OK           error
+*/
+
+enum enum_bstream_ret_codes
+backup_read_catalog(void* image_handle, struct st_backup_catalog *bup_catalog)
+{
+  struct st_stream *strm= (struct st_stream*) image_handle;
+  enum enum_bstream_ret_codes brc;
+  DBUG_ENTER("backup_read_catalog");
+  DBUG_ASSERT(strm);
+  DBUG_ASSERT(bup_catalog);
+
+  /*
+    Read catalog requires search of next chunk start.
+  */
+  brc= bstream_next_chunk(&strm->bupstrm);
+  ERROR_INJECT("backup_read_catalog_next_eos", brc= BSTREAM_EOS;);
+  ERROR_INJECT("backup_read_catalog_next_err", brc= BSTREAM_ERROR;);
+  DBUG_PRINT("bupstrm", ("Find next chunk (brc=%d)", brc));
+  if (brc != BSTREAM_OK)
+  {
+    if (brc == BSTREAM_EOS)
+    {
+      errm("end of stream after %s.\n", strm->stream_pos);
+      goto end;
+    }
+    errm("cannot find catalog after %s.\n", strm->stream_pos);
+    goto end;
+  }
+
+  /*
+    Read catalog.
+  */
+  brc= bstream_rd_catalogue(&strm->bupstrm, &bup_catalog->cat_header);
+  ERROR_INJECT("backup_read_catalog_rd_eos", brc= BSTREAM_EOS;);
+  ERROR_INJECT("backup_read_catalog_rd_err", brc= BSTREAM_ERROR;);
+  DBUG_PRINT("bupstrm", ("Read archive catalogue (brc=%d)", brc));
+  if ((brc != BSTREAM_OK) && (brc != BSTREAM_EOC))
+  {
+    if (brc == BSTREAM_EOS)
+    {
+      errm("end of stream within catalog.\n");
+      goto end;
+    }
+    errm("error on stream library read of catalog.\n");
+    goto end;
+  }
+  strm->stream_pos= "catalog";
+  brc= BSTREAM_OK;
+
+ end:
+  DBUG_RETURN(brc);
+}
+
+
+/**
+  Read backup image meta data.
+
+  @param[in]    image_handle            image handle reference
+  @param[in]    bup_catalog             catalog reference
+
+  @return       status
+    @retval     BSTREAM_OK              ok
+    @retval     != BSTREAM_OK           error
+*/
+
+enum enum_bstream_ret_codes
+backup_read_metadata(void *image_handle, struct st_backup_catalog *bup_catalog)
+{
+  struct st_stream *strm= (struct st_stream*) image_handle;
+  enum enum_bstream_ret_codes brc;
+  DBUG_ENTER("backup_read_metadata");
+  DBUG_ASSERT(strm);
+  DBUG_ASSERT(bup_catalog);
+
+  /*
+    Read meta data requires search of next chunk start.
+  */
+  brc= bstream_next_chunk(&strm->bupstrm);
+  ERROR_INJECT("backup_read_metadata_next_eos", brc= BSTREAM_EOS;);
+  ERROR_INJECT("backup_read_metadata_next_err", brc= BSTREAM_ERROR;);
+  DBUG_PRINT("bupstrm", ("Find next chunk (brc=%d)", brc));
+  if (brc != BSTREAM_OK)
+  {
+    if (brc == BSTREAM_EOS)
+    {
+      errm("end of stream after %s.\n", strm->stream_pos);
+      goto end;
+    }
+    errm("cannot find meta data after %s.\n", strm->stream_pos);
+    goto end;
+  }
+
+  /*
+    Read meta data.
+  */
+  brc= bstream_rd_meta_data(&strm->bupstrm, &bup_catalog->cat_header);
+  ERROR_INJECT("backup_read_metadata_rd_eos", brc= BSTREAM_EOS;);
+  ERROR_INJECT("backup_read_metadata_rd_err", brc= BSTREAM_ERROR;);
+  DBUG_PRINT("bupstrm", ("Read meta data (brc=%d)", brc));
+  if ((brc != BSTREAM_OK) && (brc != BSTREAM_EOC))
+  {
+    if (brc == BSTREAM_EOS)
+    {
+      errm("end of stream within meta data.\n");
+      goto end;
+    }
+    errm("error on stream library read of meta data.\n");
+    goto end;
+  }
+  strm->stream_pos= "meta data";
+  brc= BSTREAM_OK;
+
+ end:
+  DBUG_RETURN(brc);
+}
+
+
+/**
+  Read backup image table data.
+
+  @param[in]    image_handle            image handle reference
+  @param[in]    bup_catalog             catalog reference
+
+  @return       status
+    @retval     BSTREAM_OK              ok
+    @retval     != BSTREAM_OK           error
+*/
+
+enum enum_bstream_ret_codes
+backup_read_snapshot(void *image_handle,
+                     struct st_backup_catalog *bup_catalog
+                      __attribute__((unused)),
+                     struct st_bstream_data_chunk *snapshot)
+{
+  struct st_stream *strm= (struct st_stream*) image_handle;
+  enum enum_bstream_ret_codes brc;
+  DBUG_ENTER("backup_read_snapshot");
+  DBUG_ASSERT(strm);
+  DBUG_ASSERT(snapshot);
+
+  /*
+    First read data chunk requires search of next chunk start.
+  */
+  if (!strcmp(strm->stream_pos, "meta data"))
+  {
+    brc= bstream_next_chunk(&strm->bupstrm);
+    ERROR_INJECT("backup_read_snapshot_next_eos", brc= BSTREAM_EOS;);
+    ERROR_INJECT("backup_read_snapshot_next_err", brc= BSTREAM_ERROR;);
+    DBUG_PRINT("bupstrm", ("Find next chunk (brc=%d)", brc));
+    if (brc != BSTREAM_OK)
+    {
+      if (brc == BSTREAM_EOS)
+      {
+        errm("end of stream after %s.\n", strm->stream_pos);
+        goto end;
+      }
+      errm("cannot find next chunk after %s.\n", strm->stream_pos);
+      goto end;
+    }
+  }
+
+  /*
+    Read data chunk.
+  */
+  snapshot->data.begin= NULL;
+  snapshot->data.end= NULL;
+  brc= bstream_rd_data_chunk(&strm->bupstrm, snapshot);
+  ERROR_INJECT("backup_read_snapshot_rd_eos", brc= BSTREAM_EOS;);
+  ERROR_INJECT("backup_read_snapshot_rd_err", brc= BSTREAM_ERROR;);
+  DBUG_PRINT("bupstrm", ("Read data chunk (brc=%d)", brc));
+  if ((brc != BSTREAM_OK) && (brc != BSTREAM_EOC))
+  {
+    if (brc == BSTREAM_EOS)
+    {
+      errm("end of stream after %s.\n", strm->stream_pos);
+      goto end;
+    }
+    errm("error on stream library read of snapshot.\n");
+    goto end;
+  }
+  strm->stream_pos= "table data";
+
+ end:
+  DBUG_RETURN(brc);
+}
+
+
+/**
+  Read backup image summary.
+
+  @param[in]    image_handle            image handle reference
+  @param[in]    bup_catalog             catalog reference
+
+  @return       status
+    @retval     BSTREAM_OK              ok
+    @retval     != BSTREAM_OK           error
+*/
+
+enum enum_bstream_ret_codes
+backup_read_summary(void* image_handle, struct st_backup_catalog *bup_catalog)
+{
+  struct st_stream *strm= (struct st_stream*) image_handle;
+  enum enum_bstream_ret_codes brc;
+  DBUG_ENTER("backup_read_summary");
+  DBUG_ASSERT(strm);
+  DBUG_ASSERT(bup_catalog);
+
+  brc= bstream_rd_summary(&strm->bupstrm, &bup_catalog->cat_header);
+  ERROR_INJECT("backup_read_summary_rd_ok", brc= BSTREAM_OK;);
+  ERROR_INJECT("backup_read_summary_rd_err", brc= BSTREAM_ERROR;);
+  DBUG_PRINT("bupstrm", ("Read summary (brc=%d)", brc));
+  if (brc != BSTREAM_EOS)
+  {
+    if (brc == BSTREAM_ERROR)
+      errm("error on stream library read of summary.\n");
+    else
+      errm("stream not at end after reading summary.\n");
+    brc= BSTREAM_ERROR;
+    goto end;
+  }
+  strm->stream_pos= "summary";
+  brc= BSTREAM_OK;
+
+ end:
+  DBUG_RETURN(brc);
+}
+
+
+/*
+  ===================
+  Catalog navigation.
+  ===================
+*/
+
+/*
+  Catalog items are located by "catalog coordinates". The format of the
+  catalog coordinates depends on the type of item. It is specified as
+  follows:
+
+  [item position (global)]= [db no.]
+  [item position (table)]= [ snap no. ! pos in snapshot's table list ]
+  [item position (other per-db item)]= [ pos in db item list ! db no. ]
+  [item position (per-table item)] = [ pos in table's item list !
+                                       db no. ! table pos ]
+*/
+
+/**
+  Locate a global object by catalog coordinates.
+
+  Catalog coordinates for global objects are:
+
+      array         object-type specific array in catalog
+      pos           position in array
+
+  @param[in]    typnam          object type name
+  @param[in]    array           array reference
+  @param[in]    pos             position in array
+
+  @return       object reference
+*/
+
+struct st_backup_global*
+backup_locate_global(const char *typnam, DYNAMIC_ARRAY *array, ulong pos)
+{
+  struct st_backup_global *bup_global;
+  DBUG_ENTER("backup_locate_global");
+  DBUG_ASSERT(typnam);
+  DBUG_ASSERT(array);
+  DBUG_PRINT("bupstrm", ("typename: %s  pos: %lu", typnam, pos));
+
+  /* Check plausibility of array position. */
+  ERROR_INJECT("backup_locate_global_pos", pos= array->elements;);
+  if (pos >= array->elements)
+  {
+    errm("non-existent %s position: %lu in catalog.\n", typnam, pos);
+    bup_global= NULL;
+    goto end;
+  }
+
+  /*
+    Get a reference to the global object.
+    It does not fail because we checked that pos is in range.
+    Note that the array contains pointers only.
+  */
+  bup_global= *((struct st_backup_global**) dynamic_array_ptr(array, pos));
+  DBUG_PRINT("bupstrm",
+             ("located %s: '%.*s'  item: 0x%lx  pos: %lu", typnam,
+              BBLS(&bup_global->glb_item.name), (long) bup_global,
+              bup_global->glb_item.pos));
+
+  /* Check consistency of array position. */
+  if (bup_global->glb_item.pos != pos)
+  {
+    /* purecov: begin inspected */
+    errm("position of stored %s item: %lu  "
+         "does not match position in catalog array: %lu\n",
+         typnam, bup_global->glb_item.pos, pos);
+    bup_global= NULL;
+    /* purecov: end */
+  }
+
+ end:
+  DBUG_RETURN(bup_global);
+}
+
+
+/**
+  Locate a table object by catalog coordinates.
+
+  Catalog coordinates for tables are:
+
+      snap_num      snapshot position in catalog
+      pos           table position in snapshot
+
+  @param[in]    bup_catalog     catalog reference
+  @param[in]    snap_num        position in catalog's snapshot array
+  @param[in]    pos             position in snapshot's table index array
+
+  @return       table reference
+*/
+
+struct st_backup_table*
+backup_locate_table(struct st_backup_catalog *bup_catalog,
+                    ulong snap_num, ulong pos)
+{
+  static struct st_backup_snapshot      *bup_snapshot;
+  static struct st_backup_table         *bup_table;
+  DBUG_ENTER("backup_locate_table");
+  DBUG_ASSERT(bup_catalog);
+  DBUG_PRINT("bupstrm", ("snap_num: %lu  pos: %lu", snap_num, pos));
+
+  /* Check plausibility of array position. */
+  if (snap_num >= bup_catalog->cat_snapshots.elements)
+  {
+    /* purecov: begin inspected */
+    errm("non-existent snapshot position: %lu in catalog.\n", snap_num);
+    bup_table= NULL;
+    goto end;
+    /* purecov: end */
+  }
+
+  /*
+    Get a reference to the snapshot object.
+    It does not fail because we checked that snap_num is in range.
+    Note that the array contains pointers only.
+  */
+  bup_snapshot= *((struct st_backup_snapshot**)
+                  dynamic_array_ptr(&bup_catalog->cat_snapshots, snap_num));
+
+  /* Check plausibility of array position. */
+  ERROR_INJECT("backup_locate_table_pos",
+               pos= bup_snapshot->snap_index_pos_to_table.elements;);
+  if (pos >= bup_snapshot->snap_index_pos_to_table.elements)
+  {
+    errm("non-existent table position: %lu "
+         "in table index of snapshot: %lu\n", pos, snap_num);
+    bup_table= NULL;
+    goto end;
+  }
+
+  /*
+    Get a reference to the table object.
+    It does not fail because we checked that pos is in range.
+    Note that the array contains pointers only.
+  */
+  bup_table= *((struct st_backup_table**)
+               dynamic_array_ptr(&bup_snapshot->snap_index_pos_to_table, pos));
+  DBUG_PRINT("bupstrm",
+             ("located table: '%.*s'.'%.*s'  "
+              "item: 0x%lx  snap_num: %u  pos: %lu",
+              BBLS(&bup_table->tbl_item.base.db->base.name),
+              BBLS(&bup_table->tbl_item.base.base.name), (long) bup_table,
+              bup_table->tbl_item.snap_num, bup_table->tbl_item.base.base.pos));
+
+  /* Check consistency of array position. */
+  if (bup_table->tbl_item.snap_num != snap_num)
+  {
+    /* purecov: begin inspected */
+    errm("snapshot position of stored table item: %u  "
+         "does not match position in catalog: %lu\n",
+         bup_table->tbl_item.snap_num, snap_num);
+    bup_table= NULL;
+    /* purecov: end */
+  }
+  if (bup_table->tbl_item.base.base.pos != pos)
+  {
+    /* purecov: begin inspected */
+    errm("position of stored table item: %lu  "
+         "does not match position in index of snapshot %lu: %lu\n",
+         bup_table->tbl_item.base.base.pos, snap_num, pos);
+    bup_table= NULL;
+    /* purecov: end */
+  }
+
+ end:
+  DBUG_RETURN(bup_table);
+}
+
+
+/**
+  Locate a perdb object by catalog coordinates.
+
+  Catalog coordinates for perdb items are:
+
+      db_pos        database position in catalog
+      pos           perdb item position in database
+
+  @param[in]    bup_catalog     catalog reference
+  @param[in]    db_pos          position in catalog's databse array
+  @param[in]    pos             position in databases's perdb array
+
+  @return       perdb item reference
+*/
+
+struct st_backup_perdb*
+backup_locate_perdb(struct st_backup_catalog *bup_catalog,
+                    ulong db_pos, ulong pos)
+{
+  static struct st_backup_database      *bup_database;
+  static struct st_backup_perdb         *bup_perdb;
+  DBUG_ENTER("backup_locate_perdb");
+  DBUG_ASSERT(bup_catalog);
+  DBUG_PRINT("bupstrm", ("db_pos: %lu  pos: %lu", db_pos, pos));
+
+  /* Check plausibility of array position. */
+  if (db_pos >= bup_catalog->cat_databases.elements)
+  {
+    /* purecov: begin inspected */
+    errm("non-existent database position: %lu in catalog.\n", db_pos);
+    bup_perdb= NULL;
+    goto end;
+    /* purecov: end */
+  }
+
+  /*
+    Get a reference to the database object.
+    It does not fail because we checked that db_pos is in range.
+    Note that the array contains pointers only.
+  */
+  bup_database= *((struct st_backup_database**)
+                  dynamic_array_ptr(&bup_catalog->cat_databases, db_pos));
+
+  /* Check plausibility of array position. */
+  ERROR_INJECT("backup_locate_perdb_pos",
+               pos= bup_database->db_perdbs.elements;);
+  if (pos >= bup_database->db_perdbs.elements)
+  {
+    errm("non-existent perdb position: %lu in database: '%.*s'\n",
+         pos, BBLS(&bup_database->db_item.base.name));
+    bup_perdb= NULL;
+    goto end;
+  }
+
+  /*
+    Get a reference to the perdb object.
+    It does not fail because we checked that db_pos is in range.
+    Note that the array contains pointers only.
+  */
+  bup_perdb= *((struct st_backup_perdb**)
+               dynamic_array_ptr(&bup_database->db_perdbs, pos));
+  DBUG_PRINT("bupstrm",
+             ("located perdb: '%.*s'.'%.*s'  "
+              "item: 0x%lx  db_pos: %lu  pos: %lu",
+              BBLS(&bup_perdb->perdb_item.db->base.name),
+              BBLS(&bup_perdb->perdb_item.base.name), (long) bup_perdb,
+              bup_perdb->perdb_item.db->base.pos,
+              bup_perdb->perdb_item.base.pos));
+
+  /* Check consistency of array position. */
+  if (bup_perdb->perdb_item.db->base.pos != db_pos)
+  {
+    /* purecov: begin inspected */
+    errm("database position of stored perdb item: %lu  "
+         "does not match position in catalog: %lu\n",
+         bup_database->db_item.base.pos, pos);
+    bup_perdb= NULL;
+    /* purecov: end */
+  }
+  if (bup_perdb->perdb_item.base.pos != pos)
+  {
+    /* purecov: begin inspected */
+    errm("position of stored perdb item: %lu  "
+         "does not match position in database '%.*s': %lu\n",
+         bup_database->db_item.base.pos,
+         BBLS(&bup_database->db_item.base.name), pos);
+    bup_perdb= NULL;
+    /* purecov: end */
+  }
+
+ end:
+  DBUG_RETURN(bup_perdb);
+}
+
+

=== added file 'client/backup_stream.h'
--- a/client/backup_stream.h	1970-01-01 00:00:00 +0000
+++ b/client/backup_stream.h	2008-11-16 11:33:31 +0000
@@ -0,0 +1,236 @@
+/* Copyright (C) 2008 Sun Microsystems Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/*
+  MySQL Backup Image Stream reading
+*/
+
+/*
+  Include from mysys functions.
+*/
+#include "my_global.h"
+#include "my_sys.h"
+
+/*
+  Include from the low-level stream access functions.
+*/
+#include "stream_v1.h"
+#include "stream_v1_services.h"
+
+
+/*
+  This needs to be provided by the application.
+*/
+C_MODE_START /* It shall shall also be providable by C++. */
+void errm(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
+C_MODE_END   /* It shall shall also be providable by C++. */
+
+
+/*
+  =====================
+  Catalog declarations.
+  =====================
+*/
+
+/*
+  The below declarations in C language try to borrow kind of inheritance
+  from C++. By having a sub-structure as the first element of a new
+  structure one can cast to the new structure when a reference to the
+  sub-structure is given.
+
+  In the dynamic arrays, we store pointers to catalog items only.
+  Some items reference others. These pointers would become invalid
+  when the array is reallocated on insert of a new element.
+*/
+
+/*
+  Catalog.
+
+  The dynamic arrays hold pointers to items of the following types:
+
+  struct st_backup_global               cat_charsets
+  struct st_backup_global               cat_users
+  struct st_backup_global               cat_tablespaces
+  struct st_backup_database             cat_databases
+  struct st_backup_snapshot             cat_snapshots
+
+  note: cat_header must be first element in st_backup_catalog.
+*/
+struct st_backup_catalog
+{
+  struct st_bstream_image_header        cat_header;     /* must be 1st */
+  const char                            *cat_zalgo;
+  const char                            *cat_image_path;
+  my_off_t                              cat_image_size;
+  DYNAMIC_ARRAY                         cat_charsets;
+  DYNAMIC_ARRAY                         cat_users;
+  DYNAMIC_ARRAY                         cat_tablespaces;
+  DYNAMIC_ARRAY                         cat_databases;
+  DYNAMIC_ARRAY                         cat_snapshots;
+};
+
+/*
+  Meta data.
+*/
+struct st_backup_metadata
+{
+  struct st_blob                        md_query;
+  struct st_blob                        md_data;
+};
+
+/*
+  Global objects: character sets, users, table spaces.
+  Databases are handled independently.
+
+  note: glb_item must be first element in st_backup_tablespace.
+*/
+struct st_backup_global
+{
+  struct st_bstream_item_info           glb_item;       /* must be 1st */
+  struct st_backup_metadata             glb_metadata;
+  const char                            *glb_typename;
+};
+
+/*
+  Per database objects: views, stored procedures, stored functions,
+  events, triggers, privileges.
+  Tables are handled independently.
+
+  note: perdb_item must be first element in st_backup_table.
+*/
+struct st_backup_perdb
+{
+  struct st_bstream_dbitem_info         perdb_item;     /* must be 1st */
+  struct st_backup_metadata             perdb_metadata;
+};
+
+/*
+  Table.
+
+  note: tbl_item must be first element in st_backup_table.
+*/
+struct st_backup_table
+{
+  struct st_bstream_table_info          tbl_item;       /* must be 1st */
+  struct st_backup_metadata             tbl_metadata;
+  ulonglong                             tbl_data_size;
+};
+
+/*
+  Database.
+
+  The dynamic array holds pointers to items of the following type:
+
+  struct st_backup_table                db_tables
+  struct st_backup_perdb                db_perdbs
+
+  note: db_item must be first element in st_backup_database.
+*/
+struct st_backup_database
+{
+  struct st_bstream_db_info             db_item;        /* must be 1st */
+  struct st_backup_metadata             db_metadata;
+  DYNAMIC_ARRAY                         db_tables;
+  DYNAMIC_ARRAY                         db_perdbs;
+};
+
+/*
+  Snapshot.
+
+  Tables belong to databases. But in the table data chunks they are
+  numbered by snapshot number and table number. The table number is
+  relative to the snapshot. To find the table item within its database
+  we need an index from the table number (pos) within the snapshot
+  to the table item.
+
+  For every snapshot there is a struct st_backup_snapshot with an
+  array that has a reference per table of that snapshot.
+
+  The dynamic array holds pointers to items of the following type:
+
+  struct st_backup_table                snap_index_pos_to_table
+*/
+struct st_backup_snapshot
+{
+  DYNAMIC_ARRAY                         snap_index_pos_to_table;
+};
+
+/*
+  =========================
+  Stream reading functions.
+  =========================
+*/
+
+/* The below shall also be usable by C++. */
+C_MODE_START
+
+struct st_backup_catalog*
+backup_catalog_allocate(void);
+
+void
+backup_catalog_free(struct st_backup_catalog *bup_catalog);
+
+void*
+backup_image_open(const char *filename, struct st_backup_catalog *bup_catalog);
+
+enum enum_bstream_ret_codes
+backup_image_close(void *image_handle);
+
+enum enum_bstream_ret_codes
+backup_read_catalog(void *image_handle, struct st_backup_catalog *bup_catalog);
+
+enum enum_bstream_ret_codes
+backup_read_metadata(void *image_handle, struct st_backup_catalog *bup_catalog);
+
+enum enum_bstream_ret_codes
+backup_read_snapshot(void *image_handle, struct st_backup_catalog *bup_catalog,
+                     struct st_bstream_data_chunk *snapshot);
+
+enum enum_bstream_ret_codes
+backup_read_summary(void *image_handle, struct st_backup_catalog *bup_catalog);
+
+struct st_backup_global*
+backup_locate_global(const char *typnam, DYNAMIC_ARRAY *array, ulong pos);
+
+struct st_backup_table*
+backup_locate_table(struct st_backup_catalog *bup_catalog,
+                    ulong snap_num, ulong pos);
+
+struct st_backup_perdb*
+backup_locate_perdb(struct st_backup_catalog *bup_catalog,
+                    ulong db_pos, ulong pos);
+
+/*
+  =================================
+  Convenience functions and macros.
+  =================================
+*/
+
+/* Backup blob length. */
+ulong BBL(struct st_blob *blob);
+
+/* Backup blob string. */
+char *BBS(struct st_blob *blob);
+
+/*
+  Backup blob length and string.
+  This is for use with printf format '%.*s'.
+  This must be a macro because it produces two comma separated values!
+*/
+#define BBLS(_b_)       ((uint) BBL(_b_)), BBS(_b_)
+
+/* The above shall also be usable by C++. */
+C_MODE_END
+

=== added file 'client/mysqlbackup.cc'
--- a/client/mysqlbackup.cc	1970-01-01 00:00:00 +0000
+++ b/client/mysqlbackup.cc	2008-11-16 11:33:31 +0000
@@ -0,0 +1,1663 @@
+/* Copyright (C) 2001-2004 MySQL AB
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/*
+  MySQL Backup Utility
+*/
+
+/* Include client related stuff, which includes a lot of common stuff. */
+#include "client_priv.h"
+/* Include special stuff. */
+#include <my_time.h>
+
+/* As long as we don't connect to the server, we are not a MYSQL_CLIENT. */
+#undef MYSQL_CLIENT
+
+/*
+  Include from the stream access functions.
+*/
+#include "backup_stream.h"
+
+/*
+  Include standard stuff.
+*/
+#include <ctype.h>
+
+/*
+  Configuration file.
+*/
+static const char *load_default_groups[]= { "mysqlbackup",
+#ifdef MYSQL_CLIENT
+                                            "client",
+#endif
+                                            NULL };
+
+/*
+  Command line options.
+*/
+
+/* General options. */
+static uint             opt_verbose;
+static ulong            opt_open_files_limit;
+#ifndef DBUG_OFF
+static const char *default_dbug_option = "d:t:o,/tmp/mysqlbackup.trace";
+#endif
+
+#ifdef MYSQL_CLIENT
+/* Options required by a MySQL client (connecting to a server). */
+static const char       *opt_database;
+static const char       *opt_host;
+static char             *opt_pass;
+static int              opt_port;
+static uint             opt_protocol;
+static const char       *opt_sock;
+static const char       *opt_user;
+#endif
+
+/* mysqlbackup specific options. */
+static bool             opt_mysqlbackup_catalog_summary;
+static bool             opt_mysqlbackup_catalog_details;
+static bool             opt_mysqlbackup_metadata_statements;
+static bool             opt_mysqlbackup_metadata_extra;
+static bool             opt_mysqlbackup_snapshots;
+static bool             opt_mysqlbackup_data_chunks;
+static bool             opt_mysqlbackup_data_totals;
+static bool             opt_mysqlbackup_summary;
+static bool             opt_mysqlbackup_exact;
+static const char       *opt_mysqlbackup_search;
+enum options_mysqlbackup
+{
+  OPT_MYSQLBACKUP_CATALOG_SUMMARY=1024,
+  OPT_MYSQLBACKUP_CATALOG_DETAILS,
+  OPT_MYSQLBACKUP_METADATA_STATEMENTS,
+  OPT_MYSQLBACKUP_METADATA_EXTRA,
+  OPT_MYSQLBACKUP_SNAPSHOTS,
+  OPT_MYSQLBACKUP_DATA_CHUNKS,
+  OPT_MYSQLBACKUP_DATA_TOTALS,
+  OPT_MYSQLBACKUP_SUMMARY,
+  OPT_MYSQLBACKUP_ALL,
+  OPT_MYSQLBACKUP_EXACT,
+  OPT_MYSQLBACKUP_SEARCH,
+
+  /* End of options terminator. */
+  OPT_MYSQLBACKUP_LAST
+};
+
+static struct my_option my_long_options[] =
+{
+  /* General options. */
+  {"help", '?', "Display this help and exit.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef __NETWARE__
+  {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+#endif
+#ifndef DBUG_OFF
+  {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
+   (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+#endif
+  {"verbose", 'v', "Print verbose information.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
+   0, 0, 0, 0, 0},
+  {"open_files_limit", OPT_OPEN_FILES_LIMIT,
+   "Used to reserve file descriptors for usage by this program.",
+   (uchar**) &opt_open_files_limit, (uchar**) &opt_open_files_limit,
+   0, GET_ULONG, REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
+
+#ifdef MYSQL_CLIENT
+  /* Options required by a MySQL client (connecting to a server). */
+  {"database", 'd', "Unused.",
+   (uchar**) &opt_database, (uchar**) &opt_database,
+   0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"host", 'h', "Unused.",
+   (uchar**) &opt_host, (uchar**) &opt_host,
+   0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"password", 'p', "Unused.",
+   0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"port", 'P', "Unused.",
+   (uchar**) &opt_port, (uchar**) &opt_port, 0, GET_INT, REQUIRED_ARG,
+   0, 0, 0, 0, 0, 0},
+  {"protocol", OPT_MYSQL_PROTOCOL, "Unused.",
+   0, 0, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"socket", 'S', "Unused.",
+   (uchar**) &opt_sock, (uchar**) &opt_sock,
+   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "Unused.",
+   (uchar**) &opt_user, (uchar**) &opt_user,
+   0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif /*MYSQL_CLIENT*/
+
+  /* mysqlbackup specific options. */
+  {"catalog-summary", OPT_MYSQLBACKUP_CATALOG_SUMMARY,
+   "Print summary from the database objects catalog.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"catalog-details", OPT_MYSQLBACKUP_CATALOG_DETAILS,
+   "Print details from the database objects catalog.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"metadata-statements", OPT_MYSQLBACKUP_METADATA_STATEMENTS,
+   "Print SQL statements to create the database objects.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"metadata-extra", OPT_MYSQLBACKUP_METADATA_EXTRA,
+   "Print extra meta data for the database objects.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"snapshots", OPT_MYSQLBACKUP_SNAPSHOTS,
+   "Print information about snapshots contained in the backup image.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"data-chunks", OPT_MYSQLBACKUP_DATA_CHUNKS,
+   "Print length of every data chunk contained in the backup image.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"data-totals", OPT_MYSQLBACKUP_DATA_TOTALS,
+   "Print length of data contained in the backup image for each object.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"summary", OPT_MYSQLBACKUP_SUMMARY,
+   "Print summary information from end of the backup image.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"all", OPT_MYSQLBACKUP_ALL,
+   "Print everything except snapshots and data-chunks.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"exact", OPT_MYSQLBACKUP_EXACT,
+   "Print exact number of bytes instead of human readable form.",
+   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+  {"search", OPT_MYSQLBACKUP_SEARCH,
+   "Search object in the backup image. "
+   "Name can be object or database.object. "
+   "Quoting of database and/or object with \", ', or ` is allowed. "
+   "Wildcards % and _ are available. "
+   "Use with --metadata-* options to see meta data. "
+   "Plain name finds global objects, name1.name2 finds per db objects.",
+   (uchar**) &opt_mysqlbackup_search, (uchar**) &opt_mysqlbackup_search,
+   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
+  /* End of options terminator. */
+  {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+#include <help_start.h>
+
+static void print_version(void)
+{
+  printf("%s Ver 1.0 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+  NETWARE_SET_SCREEN_MODE(1);
+}
+
+
+static void usage(void)
+{
+  print_version();
+  puts("By Sun Microsystems, for your professional use\n\
+This software comes with NO WARRANTY:  This is free software,\n\
+and you are welcome to modify and redistribute it under the GPL license\n");
+
+  printf("Displays information from a backup image.\n\n");
+  printf("Usage: %s [options] backup-image-file\n", my_progname);
+  my_print_help(my_long_options);
+  my_print_variables(my_long_options);
+}
+
+#include <help_end.h>
+
+
+/**
+  Treat some options specially.
+
+  Called for each option that appears on the command line.
+*/
+
+extern "C" my_bool
+get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+               char *argument)
+{
+#ifdef MYSQL_CLIENT
+  bool tty_password=0;
+#endif
+
+  switch (optid) {
+  /* General options. */
+#ifdef __NETWARE__
+  case OPT_AUTO_CLOSE:
+    setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
+    break;
+#endif
+#ifndef DBUG_OFF
+  case '#':
+    DBUG_PUSH(argument ? argument : default_dbug_option);
+    break;
+#endif
+  case 'v':
+    opt_verbose++;
+    break;
+  case 'V':
+    print_version();
+    exit(0);
+  case '?':
+    usage();
+    exit(0);
+
+#ifdef MYSQL_CLIENT
+  /* Options required by a MySQL client (connecting to a server). */
+  case 'p':
+    if (argument)
+    {
+      my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
+      char *start=argument;
+      opt_pass= my_strdup(argument,MYF(MY_FAE));
+      while (*argument) *argument++= 'x';		/* Destroy argument */
+      if (*start)
+        start[1]=0;				/* Cut length of argument */
+    }
+    else
+      tty_password=1;
+    break;
+  case OPT_MYSQL_PROTOCOL:
+    opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+                                    opt->name);
+    break;
+#endif /*MYSQL_CLIENT*/
+
+  /* mysqlbackup specific options. */
+  case OPT_MYSQLBACKUP_CATALOG_SUMMARY:
+    opt_mysqlbackup_catalog_summary= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_CATALOG_DETAILS:
+    opt_mysqlbackup_catalog_details= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_METADATA_STATEMENTS:
+    opt_mysqlbackup_metadata_statements= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_METADATA_EXTRA:
+    opt_mysqlbackup_metadata_extra= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_SNAPSHOTS:
+    opt_mysqlbackup_snapshots= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_DATA_CHUNKS:
+    opt_mysqlbackup_data_chunks= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_DATA_TOTALS:
+    opt_mysqlbackup_data_totals= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_SUMMARY:
+    opt_mysqlbackup_summary= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_ALL:
+    opt_mysqlbackup_catalog_summary= TRUE;
+    opt_mysqlbackup_catalog_details= TRUE;
+    opt_mysqlbackup_metadata_statements= TRUE;
+    opt_mysqlbackup_metadata_extra= TRUE;
+    opt_mysqlbackup_data_totals= TRUE;
+    opt_mysqlbackup_summary= TRUE;
+    break;
+  case OPT_MYSQLBACKUP_EXACT:
+    opt_mysqlbackup_exact= TRUE;
+    break;
+  }
+
+#ifdef MYSQL_CLIENT
+  if (tty_password)
+    opt_pass= get_tty_password(NullS);
+#endif /*MYSQL_CLIENT*/
+
+  return 0;
+}
+
+
+/**
+  Print a message to stderr with optional prefix.
+
+  Prefix the message with the text "ERROR: " and optionally an extra
+  prefix.
+
+  Flush stdout before printing to stderr. And stderr after it.
+
+  The format string should include newlines ('\n') where required
+  to end a print line. This function adds additional newlines to
+  let the message stand out.
+
+  @param[in]    prefix          optional prefix or empty string
+  @param[in]    format          printf-style format string
+  @param[in]    args            list of arguments for the format string
+*/
+
+static void errm_with_prefix(const char *prefix, const char *format,
+                             va_list args)
+{
+  DBUG_ASSERT(prefix);
+  DBUG_ASSERT(format);
+
+  /*
+    Before printing the error message, flush all prior output.
+    stdout may be buffered depending on platform and output device.
+  */
+  fflush(stdout);
+
+  /* Write prefix. */
+  fprintf(stderr, "\nERROR: %s", prefix); /* prefix has newline if needed. */
+
+  /* Write error message. */
+  vfprintf(stderr, format, args);
+
+  /* Append a newline to make it stand out. */
+  fprintf(stderr, "\n");
+
+  /*
+    Flush the error message, so that it appears as soon as possible.
+    stderr may be buffered depending on platform and output device.
+  */
+  fflush(stderr);
+}
+
+
+/**
+  Print a message to stderr.
+
+  The format string should include newlines ('\n') where required
+  to end a print line.
+
+  @param[in]    format          printf-style format string
+  @param[in]    ...             printf-style varargs
+*/
+
+extern "C" void errm(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
+extern "C" void errm(const char *format, ...)
+{
+  va_list args;
+  DBUG_ASSERT(format);
+
+  va_start(args, format);
+  errm_with_prefix("", format, args);
+  va_end(args);
+}
+
+
+/**
+  Print a formatted time string.
+*/
+
+int print_time(bstream_time_t *time)
+{
+  DBUG_ASSERT(time);
+  return printf("%04d-%02d-%02d %02d:%02d:%02d UTC",
+                time->year + 1900, time->mon + 1, time->mday,
+                time->hour, time->min, time->sec);
+}
+
+
+/**
+  Print a human readable number.
+
+  Numbers are shown as +-0..16384 with a postfix of "bytes",
+  or as +-16..16384 with a postfix of "KB", "MB", "GB", "TB", "PB", or "EB".
+  If one day longlong is > 64 bit, there can be higher numbers with "EB".
+  The range is not +-0..1024 or +-1..1024 because we would lose too much
+  accuracy. Using +-16..16384, we have at least two significant digits.
+  And, by chance, 16384 EB - 1 is exactly the highest possible value in a
+  64-bit value (if used unsigned, which we don't do here).
+*/
+
+static char *llstr_human(longlong value, char *buff)
+{
+  const char *postfixes[]= {"bytes", "KB", "MB", "GB", "TB", "PB", "EB", NULL};
+  const char **postfix_p= postfixes;
+  const char *src;
+  char       *dst;
+  DBUG_ASSERT(buff);
+
+  if (!opt_mysqlbackup_exact)
+  {
+    /* Shrink value while it's > 16K and postfix list is not at end. */
+    while (((value > 16383) || (value < -16384)) && *(++postfix_p))
+      value/= 1024;
+    /*
+      In case that we terminated the loop due to end of the postfixes
+      list, we need to compensate the loop's ++postfix_p so that we
+      point to the last non-NULL postfix. Note that this can only happen
+      on machines where longlong has more than 64 bits.
+    */
+    if (!*postfix_p)
+      --postfix_p; /* purecov: inspected */
+  }
+  /* Convert the number into a string. */
+  (void) llstr(value, buff);
+  /* Find end of destination string. */
+  for (dst= buff; *dst; dst++) {}
+  /* Get pointer to the source string. */
+  src= *postfix_p;
+  /* Append postfix, including the terminating '\0'. */
+  *(dst++)= ' ';
+  while ((*(dst++)= *(src++))) {}
+  /* Result is in buff. */
+  return buff;
+}
+
+
+/* Flags for print_item(). */
+#define PRI_NAME        0x0001
+#define PRI_META        0x0002
+
+
+/**
+  Print item information.
+
+  @parameter[in]        indent          indentation spaces
+  @parameter[in]        item_arg        reference to some item
+  @parameter[in]        what            flags describing what to print
+                                        PRI_NAME        item name
+                                        PRI_META        meta data
+*/
+
+void print_item(uint indent, void *item_arg, uint what)
+{
+  struct st_bstream_item_info   *item= (struct st_bstream_item_info*) item_arg;
+  struct st_blob                *db_name= NULL;
+  struct st_blob                *name;
+  struct st_backup_metadata     *mdata= NULL;
+  const char                    *type_s;
+  DBUG_ENTER("print_item");
+  DBUG_ASSERT(item);
+
+  name= &item->name;
+
+  switch (item->type) {
+
+  case BSTREAM_IT_CHARSET:
+  case BSTREAM_IT_USER:
+  case BSTREAM_IT_TABLESPACE:
+  {
+    struct st_backup_global *bup_global= (struct st_backup_global*) item;
+    type_s= bup_global->glb_typename;
+    mdata= &bup_global->glb_metadata;
+    DBUG_PRINT("bupstrm", ("%s", type_s));
+    break;
+  }
+
+  case BSTREAM_IT_DB:
+  {
+    struct st_backup_database *bup_database= (struct st_backup_database*) item;
+    DBUG_PRINT("bupstrm", ("database"));
+    type_s= "Database";
+    mdata= &bup_database->db_metadata;
+    break;
+  }
+
+  case BSTREAM_IT_TABLE:
+  {
+    struct st_backup_table *bup_table= (struct st_backup_table*) item;
+    DBUG_PRINT("bupstrm", ("table"));
+    type_s= "Table";
+    db_name= &bup_table->tbl_item.base.db->base.name;
+    mdata= &bup_table->tbl_metadata;
+    break;
+  }
+
+  case BSTREAM_IT_PRIVILEGE:
+  case BSTREAM_IT_VIEW:
+  case BSTREAM_IT_SPROC:
+  case BSTREAM_IT_SFUNC:
+  case BSTREAM_IT_EVENT:
+  case BSTREAM_IT_TRIGGER:
+  {
+    struct st_backup_perdb *bup_perdb= (struct st_backup_perdb*) item;
+
+    switch (item->type) {
+    case BSTREAM_IT_PRIVILEGE:
+      DBUG_PRINT("bupstrm", ("privilege"));
+      type_s= "Privilege";
+      break;
+    case BSTREAM_IT_VIEW:
+      DBUG_PRINT("bupstrm", ("view"));
+      type_s= "View";
+      break;
+    case BSTREAM_IT_SPROC:
+      DBUG_PRINT("bupstrm", ("sproc"));
+      type_s= "Sproc";
+      break;
+    case BSTREAM_IT_SFUNC:
+      DBUG_PRINT("bupstrm", ("sfunc"));
+      type_s= "Sfunc";
+      break;
+    case BSTREAM_IT_EVENT:
+      DBUG_PRINT("bupstrm", ("event"));
+      type_s= "Event";
+      break;
+    case BSTREAM_IT_TRIGGER:
+      DBUG_PRINT("bupstrm", ("trigger"));
+      type_s= "Trigger";
+      break;
+    default: break; /* purecov: deadcode */
+    }
+    db_name= &bup_perdb->perdb_item.db->base.name;
+    mdata= &bup_perdb->perdb_metadata;
+    break;
+  }
+
+  /* purecov: begin inspected */
+  default:
+  {
+    DBUG_PRINT("bupstrm", ("unknown item type"));
+    type_s= "Unknown item type";
+    break;
+  }
+  /* purecov: end */
+  }
+
+  if (what & PRI_NAME)
+  {
+    if (db_name)
+      printf("%*s%-9s '%.*s'.'%.*s'\n",
+             indent, "", type_s,
+             BBLS(db_name), BBLS(name));
+    else
+      printf("%*s%-9s '%.*s'\n",
+             indent, "", type_s,
+             BBLS(name));
+  }
+
+  if ((what & PRI_META) && mdata)
+  {
+    if (opt_mysqlbackup_metadata_statements)
+    {
+      if (db_name)
+        printf("%*s%s '%.*s'.'%.*s' statement: '%.*s'\n",
+               indent, "", type_s,
+               BBLS(db_name), BBLS(name), BBLS(&mdata->md_query));
+      else
+        printf("%*s%s '%.*s' statement: '%.*s'\n",
+               indent, "", type_s,
+               BBLS(name), BBLS(&mdata->md_query));
+    }
+
+    if (opt_mysqlbackup_metadata_extra)
+    {
+      if (db_name)
+        printf("%*s%s '%.*s'.'%.*s' extra data length: %lu\n",
+               indent, "", type_s,
+               BBLS(db_name), BBLS(name), BBL(&mdata->md_data));
+      else
+        printf("%*s%s '%.*s' extra data length: %lu\n",
+               indent, "", type_s,
+               BBLS(name), BBL(&mdata->md_data));
+    }
+  }
+
+  DBUG_VOID_RETURN;
+}
+
+
+/**
+  Print error from parsing the search name.
+
+  @param[in]    format          printf-style format string
+  @param[in]    args            list of arguments for the format string
+*/
+
+static void error_parse_search_name(const char *format, ...)
+  ATTRIBUTE_FORMAT(printf, 1, 2);
+static void error_parse_search_name(const char *format, ...)
+{
+  va_list args;
+  DBUG_ASSERT(format);
+
+  va_start(args, format);
+  errm_with_prefix("Cannot parse search name.\n", format, args);
+  va_end(args);
+}
+
+
+/**
+  Parse the search name.
+
+  Split search name into database name, if present, and object name.
+
+  @param[in]    search_name             search name
+  @param[out]   search_database_name_p  database name
+  @param[out]   search_object_name_p    object name
+
+  @return       status
+    @retval     0                       ok
+    @retval     != 0                    error
+*/
+
+static int parse_search_name(const char *search_name,
+                             char **search_database_name_p,
+                             char **search_object_name_p)
+{
+  char          *database= NULL;
+  char          *object= NULL;
+  const char    *token;
+  const char    *tend;
+  int           rc= 1; /* Assume error. */
+  char          quote;
+  DBUG_ENTER("parse_search_name");
+  DBUG_ASSERT(search_name);
+  DBUG_ASSERT(search_database_name_p);
+  DBUG_ASSERT(search_object_name_p);
+  DBUG_PRINT("mysqlbackup", ("searching '%s'\n", search_name));
+
+  /* Skip leading space. */
+  for (token= search_name; isspace(*token); token++) {}
+  /*
+    Check for quoted search string.
+    If unquoted, terminate by dot or space.
+  */
+  quote= '.';
+  switch (*token) {
+  case '\'':
+  case '\"':
+  case '`':
+    quote= *(token++);
+  }
+  /* Find end of token. */
+  if (quote == '.')
+    for (tend= token; *tend && (*tend != quote) && !isspace(*tend); tend++) {}
+  else
+    for (tend= token; *tend && (*tend != quote); tend++) {}
+  /* Copy token into object name. */
+  object= (char*) my_memdup(token, (size_t) (tend - token + 1),
+                            MYF(MY_WME));
+  object[tend - token]= '\0';
+  if (*tend)
+  {
+    /* Found quote or dot or space. */
+    if (quote != '.')
+    {
+      /* Found quote. Skip it. */
+      tend++;
+    }
+    /* Skip trailing space. */
+    for (; isspace(*tend); tend++) {}
+    if (*tend == '.')
+    {
+      /* Object name was a database name. */
+      database= object;
+      object= NULL;
+      /* Skip dot. */
+      tend++;
+      /* We need an object name. Skip space. */
+      for (token= tend; isspace(*token); token++) {}
+      /* Check for quoted search string. If unquoted, search for end. */
+      quote= '\0';
+      switch (*token) {
+      case '\'':
+      case '\"':
+      case '`':
+        quote= *(token++);
+      }
+      /* Find end of token. */
+      if (quote == '\0')
+        for (tend= token; *tend && !isspace(*tend); tend++) {}
+      else
+        for (tend= token; *tend && (*tend != quote); tend++) {}
+      /* Copy token into object name. */
+      object= (char*) my_memdup(token, (size_t) (tend - token + 1),
+                                MYF(MY_WME));
+      object[tend - token]= '\0';
+      /* Check for correct syntax. */
+      if (*tend)
+      {
+        /* Found quote or space. */
+        if (quote != '\0')
+        {
+          /* Found quote. Skip it. */
+          tend++;
+        }
+        /* Skip trailing space. */
+        for (; isspace(*tend); tend++) {}
+        /* Now we must be at string end. */
+        if (*tend)
+        {
+          error_parse_search_name("Unrecognized stuff at '%s'\n", tend);
+          goto end;
+        }
+      }
+      else
+      {
+        /* End of string. */
+        if (quote != '\0')
+        {
+          error_parse_search_name("Search name improperly quoted.\n");
+          goto end;
+        }
+      }
+    }
+    else
+    {
+      if (*tend)
+      {
+        error_parse_search_name("Unrecognized stuff at '%s'\n", tend);
+        goto end;
+      }
+    }
+  }
+  else
+  {
+    /* End of string. */
+    if (quote != '.')
+    {
+      error_parse_search_name("Search name improperly quoted.\n");
+      goto end;
+    }
+  }
+
+  /* Everything looks fine. */
+  *search_database_name_p= database;
+  *search_object_name_p= object;
+  rc= 0;
+
+ end:
+  if (rc)
+  {
+    my_free(object, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(database, MYF(MY_ALLOW_ZERO_PTR));
+  }
+  DBUG_RETURN(rc);
+}
+
+
+/**
+  Search backup object.
+
+  @param[in]    search_name             search name
+  @param[out]   search_database_name    database name, may be NULL
+  @param[out]   search_object_name      object name
+
+  @return       status
+    @retval     0                       ok
+    @retval     != 0                    error
+*/
+
+void
+search_object(struct st_backup_catalog *bup_catalog,
+              char *search_database_name,
+              char *search_object_name)
+{
+  struct st_backup_global       *bup_global;
+  struct st_backup_database     *bup_database;
+  struct st_blob                *name;
+  uint                          search_database_name_len;
+  uint                          search_object_name_len;
+  uint                          idx;
+  DBUG_ENTER("search_object");
+  DBUG_ASSERT(bup_catalog);
+  /* search_database_name may be NULL. */
+  DBUG_ASSERT(search_object_name);
+
+  printf("\n");
+  if (search_database_name)
+    printf("Searching '%s'.'%s'\n", search_database_name, search_object_name);
+  else
+    printf("Searching '%s'\n", search_object_name);
+
+  if (search_database_name)
+    search_database_name_len= strlen(search_database_name);
+  search_object_name_len= strlen(search_object_name);
+
+  if (!search_database_name)
+  {
+    /* Search character set. */
+    for (idx= 0; idx < bup_catalog->cat_charsets.elements; idx++)
+    {
+      /* Note that the array contains pointers only. */
+      bup_global= *((struct st_backup_global**)
+                    dynamic_array_ptr(&bup_catalog->cat_charsets, idx));
+      name= &bup_global->glb_item.name;
+      if (!my_wildcmp(&my_charset_latin1, (char*) name->begin,
+                      (char*) name->end, (char*) search_object_name,
+                      (char*) search_object_name + search_object_name_len,
+                      '\\', '_', '%'))
+      {
+        print_item(2, bup_global, PRI_NAME);
+      }
+    }
+
+    /* Search user. */
+    for (idx= 0; idx < bup_catalog->cat_users.elements; idx++)
+    {
+      /* purecov: begin inspected */
+      /* Note that the array contains pointers only. */
+      bup_global= *((struct st_backup_global**)
+                    dynamic_array_ptr(&bup_catalog->cat_users, idx));
+      name= &bup_global->glb_item.name;
+      if (!my_wildcmp(&my_charset_latin1, (char*) name->begin,
+                      (char*) name->end, (char*) search_object_name,
+                      (char*) search_object_name + search_object_name_len,
+                      '\\', '_', '%'))
+      {
+        print_item(2, bup_global, PRI_NAME);
+      }
+      /* purecov: end */
+    }
+
+    /* Search table space. */
+    for (idx= 0; idx < bup_catalog->cat_tablespaces.elements; idx++)
+    {
+      /* Note that the array contains pointers only. */
+      bup_global= *((struct st_backup_global**)
+                    dynamic_array_ptr(&bup_catalog->cat_tablespaces, idx));
+      name= &bup_global->glb_item.name;
+      if (!my_wildcmp(&my_charset_latin1, (char*) name->begin,
+                      (char*) name->end, (char*) search_object_name,
+                      (char*) search_object_name + search_object_name_len,
+                      '\\', '_', '%'))
+      {
+        print_item(2, bup_global, PRI_NAME);
+      }
+    }
+
+    /* Search database. */
+    for (idx= 0; idx < bup_catalog->cat_databases.elements; idx++)
+    {
+      /* Note that the array contains pointers only. */
+      bup_database= *((struct st_backup_database**)
+                      dynamic_array_ptr(&bup_catalog->cat_databases, idx));
+      name= &bup_database->db_item.base.name;
+      if (!my_wildcmp(&my_charset_latin1, (char*) name->begin,
+                      (char*) name->end, (char*) search_object_name,
+                      (char*) search_object_name + search_object_name_len,
+                      '\\', '_', '%'))
+      {
+        print_item(2, bup_database, PRI_NAME | PRI_META);
+      }
+    }
+    goto end;
+  }
+
+  /* Search object within databases. */
+  for (idx= 0; idx < bup_catalog->cat_databases.elements; idx++)
+  {
+    struct st_backup_database   *bup_database;
+
+    /* Note that the array contains pointers only. */
+    bup_database= *((struct st_backup_database**)
+                    dynamic_array_ptr(&bup_catalog->cat_databases, idx));
+    name= &bup_database->db_item.base.name;
+    if (!my_wildcmp(&my_charset_latin1, (char*) name->begin,
+                    (char*) name->end, (char*) search_database_name,
+                    (char*) search_database_name + search_database_name_len,
+                    '\\', '_', '%'))
+    {
+      struct st_backup_table  *bup_table;
+      struct st_backup_perdb  *bup_perdb;
+      uint                    jdx;
+
+      /* Tables. */
+      for (jdx= 0; jdx < bup_database->db_tables.elements; jdx++)
+      {
+        /* Note that the array contains pointers only. */
+        bup_table= *((struct st_backup_table**)
+                     dynamic_array_ptr(&bup_database->db_tables, jdx));
+        name= &bup_table->tbl_item.base.base.name;
+        if (!my_wildcmp(&my_charset_latin1, (char*) name->begin,
+                        (char*) name->end, (char*) search_object_name,
+                        (char*) search_object_name + search_object_name_len,
+                        '\\', '_', '%'))
+        {
+          print_item(4, bup_table, PRI_NAME | PRI_META);
+        }
+      }
+
+      /* Perdb items. */
+      for (jdx= 0; jdx < bup_database->db_perdbs.elements; jdx++)
+      {
+        /* Note that the array contains pointers only. */
+        bup_perdb= *((struct st_backup_perdb**)
+                     dynamic_array_ptr(&bup_database->db_perdbs, jdx));
+        name= &bup_perdb->perdb_item.base.name;
+        if (!my_wildcmp(&my_charset_latin1, (char*) name->begin,
+                        (char*) name->end, (char*) search_object_name,
+                        (char*) search_object_name + search_object_name_len,
+                        '\\', '_', '%'))
+        {
+          print_item(4, bup_perdb, PRI_NAME | PRI_META);
+        }
+      }
+    }
+  }
+
+ end:
+  DBUG_VOID_RETURN;
+}
+
+
+/**
+  Read and print summary.
+
+  The summary section may be inside the image header or at image end.
+
+  @param[in]    image_handle            image handle reference
+  @param[in]    bup_catalog             catalog reference
+
+  @return       status
+    @retval     BSTREAM_OK              ok
+    @retval     != BSTREAM_OK           error
+*/
+
+enum enum_bstream_ret_codes
+read_and_print_summary(void *image_handle,
+                       struct st_backup_catalog *bup_catalog)
+{
+  struct st_bstream_image_header        *hdr= &bup_catalog->cat_header;
+  enum enum_bstream_ret_codes           brc;
+  DBUG_ENTER("read_and_print_summary");
+  DBUG_ASSERT(image_handle);
+  DBUG_ASSERT(bup_catalog);
+
+  /*
+    Read summary.
+  */
+  brc= backup_read_summary(image_handle, bup_catalog);
+  if (brc != BSTREAM_OK)
+  {
+    goto end;
+  }
+
+  /*
+    Print summary.
+  */
+  if (opt_mysqlbackup_summary)
+  {
+    printf("\n");
+    printf("Summary:\n");
+    printf("\n");
+    printf("Creation time:       ");
+    print_time(&hdr->start_time);
+    printf("\n");
+    printf("Validity time:       ");
+    print_time(&hdr->vp_time);
+    printf("\n");
+    printf("Finish   time:       ");
+    print_time(&hdr->end_time);
+    printf("\n");
+
+    /*
+      Binlog coordinates are present, if the BSTREAM_FLAG_BINLOG flag is
+      set in the header *and* table data are in the image.
+      DBUG_ASSERT(!(hdr->flags & BSTREAM_FLAG_BINLOG) ||
+                  hdr->binlog_pos.file || hdr->binlog_group.file);
+    */
+    if ((hdr->flags & BSTREAM_FLAG_BINLOG) &&
+        (hdr->binlog_pos.file || hdr->binlog_group.file))
+    {
+      printf("Binlog coordinates:  %s:%lu\n",
+             hdr->binlog_pos.file ? hdr->binlog_pos.file : "[NULL]",
+             hdr->binlog_pos.pos);
+      printf("Binlog group coords: %s:%lu\n",
+             hdr->binlog_group.file ? hdr->binlog_group.file : "[NULL]",
+             hdr->binlog_group.pos);
+    }
+    else
+    {
+      printf("No binlog information\n");
+    }
+  }
+
+ end:
+  DBUG_RETURN(brc);
+}
+
+
+/*
+  =============
+  Main program.
+  =============
+*/
+
+/**
+  Main
+
+  @parameter[in]        argc            argument count
+  @parameter[in]        argv            argument vector
+
+  @return               status
+    @retval             0               ok
+    @retval             != 0            error
+*/
+
+int main(int argc, char** argv)
+{
+  char                                  **defaults_argv;
+  void                                  *image_handle;
+  char                                  *search_database_name= NULL;
+  char                                  *search_object_name= NULL;
+  struct st_backup_catalog              *bup_catalog= NULL;
+  struct st_bstream_image_header        *hdr;
+  enum enum_bstream_ret_codes           brc;
+  int                                   rc;
+  uint                                  idx;
+  int                                   errpos= 0;
+  char                                  llbuff[22];
+
+  /* Preparations */
+  MY_INIT(argv[0]);
+  DBUG_ENTER("main");
+  DBUG_PROCESS(argv[0]);
+  my_init_time(); // for time functions
+  load_defaults("my", load_default_groups, &argc, &argv);
+  defaults_argv= argv;
+  errpos= 10;
+  rc= handle_options(&argc, &argv, my_long_options, get_one_option);
+  if (rc)
+  {
+    /* Error message reported by mysys. */
+    rc= 1;
+    goto use_err;
+  }
+  errpos= 20;
+  if (argc != 1)
+  {
+    errm("incorrect number of arguments.\n");
+    rc= 1;
+    goto use_err;
+  }
+  if (opt_mysqlbackup_search)
+  {
+    if (parse_search_name(opt_mysqlbackup_search, &search_database_name,
+                          &search_object_name))
+    {
+      rc= 1;
+      goto use_err;
+    }
+    errpos= 25;
+  }
+  my_set_max_open_files(opt_open_files_limit);
+
+  /*
+    Allocate catalog.
+  */
+  bup_catalog= backup_catalog_allocate();
+  if (!bup_catalog)
+  {
+    rc= 2;
+    goto end;
+  }
+  errpos= 30;
+
+  /*
+    Open backup image stream.
+  */
+  image_handle= backup_image_open(argv[0], bup_catalog);
+  if (!image_handle)
+  {
+    rc= 2;
+    goto end;
+  }
+  errpos= 40;
+
+  /*
+    Print backup image stream header.
+  */
+  hdr= &bup_catalog->cat_header;
+  printf("\n");
+  printf("Image path:          '%s'\n",
+         bup_catalog->cat_image_path);
+  printf("Image size:          %s\n",
+         llstr_human(bup_catalog->cat_image_size, llbuff));
+  printf("Image compression:   %s\n", bup_catalog->cat_zalgo);
+  printf("Image version:       %u\n", hdr->version);
+  printf("Creation time:       ");
+  print_time(&hdr->start_time);
+  printf("\n");
+  printf("Server version:      %d.%d.%d (%.*s)\n",
+         hdr->server_version.major, hdr->server_version.minor,
+         hdr->server_version.release, BBLS(&hdr->server_version.extra));
+  printf("Server byte order:   %s\n",
+         hdr->flags & BSTREAM_FLAG_BIG_ENDIAN ?
+         "big-endian" : "little-endian");
+  if (hdr->flags && opt_verbose)
+  {
+    const char  *separators[]= {"", ", "};
+    int         separator= 0;
+
+    printf("Image options:       ");
+    if (hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY)
+    {
+      /* purecov: begin inspected */
+      printf("%sINLINE_SUMMARY", separators[separator]);
+      separator= 1;
+      /* purecov: end */
+    }
+    if (hdr->flags & BSTREAM_FLAG_BIG_ENDIAN)
+    {
+      /* purecov: begin inspected */
+      printf("%sBIG_ENDIAN", separators[separator]);
+      separator= 1;
+      /* purecov: end */
+    }
+    if (hdr->flags & BSTREAM_FLAG_BINLOG)
+    {
+      printf("%sBINLOG", separators[separator]);
+      separator= 1;
+    }
+    printf("\n");
+  }
+
+  if (hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY)
+  {
+    /* purecov: begin inspected */
+    brc= read_and_print_summary(image_handle, bup_catalog);
+    if (brc != BSTREAM_OK)
+    {
+      rc= 2;
+      goto end;
+    }
+    /* purecov: end */
+  }
+
+  /*
+    Save image reading time if the rest is not wanted.
+    Sorry for the spaghetti here. The reason is that it has beed
+    decided not to display the first two character sets from the
+    catalog with the other catalog items:
+    The first two character sets are special:
+    1. Character set to use for interpreting the backup file.
+    2. Server character set.
+    These do not count as catalog items. They are to display in
+    the header section. To make the output somewhat user-friendly,
+    we display them before the optional snapshots section.
+    So if we have to display the snapshot section, but nothing
+    from the catalog, we can skip catalog reading here.
+  */
+  if (opt_mysqlbackup_search ||
+      opt_mysqlbackup_catalog_summary ||
+      opt_mysqlbackup_catalog_details ||
+      opt_mysqlbackup_metadata_statements ||
+      opt_mysqlbackup_metadata_extra ||
+      opt_mysqlbackup_data_chunks ||
+      opt_mysqlbackup_data_totals ||
+      (opt_mysqlbackup_summary && !(hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY)))
+  {
+    /*
+      Read catalog.
+      This can take some time. So flush what we have so far.
+    */
+    fflush(stdout);
+    brc= backup_read_catalog(image_handle, bup_catalog);
+    if (brc != BSTREAM_OK)
+    {
+      rc= 2;
+      goto end;
+    }
+  }
+
+  /*
+    The first two character sets are special:
+    1. Character set to use for interpreting the backup file.
+    2. Server character set.
+    These do not count as catalog items.
+    List them separately.
+  */
+  if (bup_catalog->cat_charsets.elements >= 2)
+  {
+    struct st_backup_global *bup_global;
+
+    /* Note that the array contains pointers only. */
+    bup_global= *((struct st_backup_global**)
+                  dynamic_array_ptr(&bup_catalog->cat_charsets, 1));
+    printf("Server charset:      '%.*s'\n", BBLS(&bup_global->glb_item.name));
+  }
+  if (opt_verbose && (bup_catalog->cat_charsets.elements >= 1))
+  {
+    struct st_backup_global *bup_global;
+
+    /* Note that the array contains pointers only. */
+    bup_global= *((struct st_backup_global**)
+                  dynamic_array_ptr(&bup_catalog->cat_charsets, 0));
+    printf("Backup image chrset: '%.*s'\n", BBLS(&bup_global->glb_item.name));
+  }
+
+  if (opt_mysqlbackup_snapshots)
+  {
+    printf("Snapshot count:      %u\n", hdr->snap_count);
+    printf("\n");
+    printf("Snapshots:\n");
+    printf("\n");
+    for (idx= 0; idx < hdr->snap_count; idx++)
+    {
+      struct st_bstream_snapshot_info     *snapshot= hdr->snapshot + idx;
+      const char                          *snap_type;
+
+      switch (snapshot->type) {
+      case BI_NATIVE:     snap_type= "native from";
+        break;
+      case BI_DEFAULT:    snap_type= "logical from locked tables";
+        break;
+      case BI_CS:         snap_type= "logical from consistent snapshot";
+        break;
+      /* purecov: begin inspected */
+      case BI_NODATA:     snap_type= "nodata";
+        break;
+      default:            snap_type= "unknown/illegal";
+        break;
+      /* purecov: end */
+      }
+      if (snapshot->type == BI_NATIVE)
+        printf("  Snapshot %u type    %s '%.*s'  version %u.%u\n",
+               idx, snap_type,
+               BBLS(&snapshot->engine.name),
+               snapshot->engine.major, snapshot->engine.minor);
+      else
+        printf("  Snapshot %u type    %s\n", idx, snap_type);
+      printf("  Snapshot %u version %u\n", idx, snapshot->version);
+      if (snapshot->options)
+        printf("  Snapshot %u options %u\n",
+               idx, snapshot->options); /* purecov: inspected */
+      printf("  Snapshot %u tables  %lu\n", idx, snapshot->table_count);
+    }
+  }
+
+  /*
+    Print catalog.
+  */
+  if (opt_mysqlbackup_catalog_summary)
+  {
+    ulong sum_table;
+    ulong sum_perdb;
+
+    printf("\n");
+    printf("Catalog summary:\n");
+    printf("\n");
+    if (opt_verbose)
+    {
+      /*
+        The first two character sets are special:
+        1. Character set to use for interpreting the backup file.
+        2. Server character set.
+        These do not count as catalog items.
+      */
+      printf("  Character sets:         %u\n",
+             bup_catalog->cat_charsets.elements >= 2 ?
+             bup_catalog->cat_charsets.elements - 2 : 0);
+    }
+    printf("  Databases:              %u\n",
+           bup_catalog->cat_databases.elements);
+    sum_table= 0;
+    sum_perdb= 0;
+    for (idx= 0; idx < bup_catalog->cat_databases.elements; idx++)
+    {
+      struct st_backup_database   *bup_database;
+
+      /* Note that the array contains pointers only. */
+      bup_database= *((struct st_backup_database**)
+                      dynamic_array_ptr(&bup_catalog->cat_databases, idx));
+      sum_table+= bup_database->db_tables.elements;
+      sum_perdb+= bup_database->db_perdbs.elements;
+    }
+    printf("  Tables:                 %lu\n", sum_table);
+    printf("  Other per db objects:   %lu\n", sum_perdb);
+  }
+  if (opt_mysqlbackup_catalog_details)
+  {
+    struct st_backup_global     *bup_global;
+    struct st_backup_database   *bup_database;
+
+    printf("\n");
+    printf("Catalog details:\n");
+    printf("\n");
+
+    /* Charsets. */
+    if (opt_verbose)
+    {
+      /*
+        The first two character sets are special:
+        1. Character set to use for interpreting the backup file.
+        2. Server character set.
+        These do not count as catalog items.
+      */
+      for (idx= 2; idx < bup_catalog->cat_charsets.elements; idx++)
+      {
+        /* purecov: begin inspected */
+        /* Note that the array contains pointers only. */
+        bup_global= *((struct st_backup_global**)
+                      dynamic_array_ptr(&bup_catalog->cat_charsets, idx));
+        print_item(2, bup_global, PRI_NAME);
+        /* purecov: end */
+      }
+    }
+
+    /* Users. */
+    for (idx= 0; idx < bup_catalog->cat_users.elements; idx++)
+    {
+      /* purecov: begin inspected */
+      /* Note that the array contains pointers only. */
+      bup_global= *((struct st_backup_global**)
+                    dynamic_array_ptr(&bup_catalog->cat_users, idx));
+      print_item(2, bup_global, PRI_NAME);
+      /* purecov: end */
+    }
+
+    /* Table spaces. */
+    for (idx= 0; idx < bup_catalog->cat_tablespaces.elements; idx++)
+    {
+      /* Note that the array contains pointers only. */
+      bup_global= *((struct st_backup_global**)
+                    dynamic_array_ptr(&bup_catalog->cat_tablespaces, idx));
+      print_item(2, bup_global, PRI_NAME);
+    }
+
+    /* Databases. */
+    for (idx= 0; idx < bup_catalog->cat_databases.elements; idx++)
+    {
+      /* Note that the array contains pointers only. */
+      bup_database= *((struct st_backup_database**)
+                      dynamic_array_ptr(&bup_catalog->cat_databases, idx));
+      print_item(2, bup_database, PRI_NAME);
+
+      /* Tables. */
+      {
+        struct st_backup_table  *bup_table;
+        uint                    jdx;
+
+        for (jdx= 0; jdx < bup_database->db_tables.elements; jdx++)
+        {
+          /* Note that the array contains pointers only. */
+          bup_table= *((struct st_backup_table**)
+                       dynamic_array_ptr(&bup_database->db_tables, jdx));
+          print_item(4, bup_table, PRI_NAME);
+        }
+      }
+
+      /* Perdbs. */
+      {
+        struct st_backup_perdb  *bup_perdb;
+        uint                    jdx;
+
+        for (jdx= 0; jdx < bup_database->db_perdbs.elements; jdx++)
+        {
+          /* Note that the array contains pointers only. */
+          bup_perdb= *((struct st_backup_perdb**)
+                       dynamic_array_ptr(&bup_database->db_perdbs, jdx));
+          print_item(4, bup_perdb, PRI_NAME);
+        }
+      }
+    }
+  }
+
+  /*
+    If user wants to search in catalog, but is not interested in meta
+    data, we can do the search now, before reading the meta data.
+  */
+  if (opt_mysqlbackup_search &&
+      !opt_mysqlbackup_metadata_statements &&
+      !opt_mysqlbackup_metadata_extra)
+  {
+    search_object(bup_catalog, search_database_name, search_object_name);
+    goto end;
+  }
+
+  /* Save image reading time if the rest is not wanted. */
+  if (!opt_mysqlbackup_search &&
+      !opt_mysqlbackup_metadata_statements &&
+      !opt_mysqlbackup_metadata_extra &&
+      !opt_mysqlbackup_data_chunks &&
+      !opt_mysqlbackup_data_totals &&
+      (!opt_mysqlbackup_summary || (hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY)))
+    goto end;
+
+  /*
+    Read meta data.
+    This can take some time. So flush what we have so far.
+  */
+  fflush(stdout);
+  brc= backup_read_metadata(image_handle, bup_catalog);
+  if (brc != BSTREAM_OK)
+  {
+    rc= 2;
+    goto end;
+  }
+
+  if (opt_mysqlbackup_search)
+  {
+    search_object(bup_catalog, search_database_name, search_object_name);
+    goto end;
+  }
+
+  /*
+    Print meta data.
+  */
+  if (opt_mysqlbackup_metadata_statements || opt_mysqlbackup_metadata_extra)
+  {
+    printf("\n");
+    printf("Meta data:\n");
+
+    /* Charsets don't have meta data. */
+    /* Users don't have meta data. */
+
+    /* Tablespaces. */
+    for (idx= 0; idx < bup_catalog->cat_tablespaces.elements; idx++)
+    {
+      struct st_backup_global *bup_global;
+
+      /* Note that the array contains pointers only. */
+      bup_global= *((struct st_backup_global**)
+                    dynamic_array_ptr(&bup_catalog->cat_tablespaces, idx));
+      printf("\n");
+      print_item(2, bup_global, PRI_META);
+    }
+
+    /* Databases and their items. */
+    for (idx= 0; idx < bup_catalog->cat_databases.elements; idx++)
+    {
+      struct st_backup_database *bup_database;
+
+      /* Note that the array contains pointers only. */
+      bup_database= *((struct st_backup_database**)
+                      dynamic_array_ptr(&bup_catalog->cat_databases, idx));
+      printf("\n");
+      print_item(2, bup_database, PRI_META);
+
+      /* Tables. */
+      {
+        struct st_backup_table  *bup_table;
+        uint                    jdx;
+
+        for (jdx= 0; jdx < bup_database->db_tables.elements; jdx++)
+        {
+          /* Note that the array contains pointers only. */
+          bup_table= *((struct st_backup_table**)
+                       dynamic_array_ptr(&bup_database->db_tables, jdx));
+          printf("\n");
+          print_item(4, bup_table, PRI_META);
+        }
+      }
+
+      /* Perdb items. */
+      {
+        struct st_backup_perdb  *bup_perdb;
+        uint                    jdx;
+
+        for (jdx= 0; jdx < bup_database->db_perdbs.elements; jdx++)
+        {
+          /* Note that the array contains pointers only. */
+          bup_perdb= *((struct st_backup_perdb**)
+                       dynamic_array_ptr(&bup_database->db_perdbs, jdx));
+          printf("\n");
+          print_item(4, bup_perdb, PRI_META);
+        }
+      }
+    }
+  }
+
+  /* Save image reading time if the rest is not wanted. */
+  if (!opt_mysqlbackup_data_chunks &&
+      !opt_mysqlbackup_data_totals &&
+      (!opt_mysqlbackup_summary || (hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY)))
+    goto end;
+
+  /*
+    Read table data.
+    This can take some time. So flush what we have so far.
+  */
+  fflush(stdout);
+  if (opt_mysqlbackup_data_chunks)
+  {
+    printf("\n");
+    printf("Data chunks:\n");
+  }
+  do
+  {
+    struct st_bstream_data_chunk        snapshot;
+    struct st_backup_table              *bup_table;
+    struct st_blob                      *tbl_name;
+    struct st_blob                      *db_name;
+
+    brc= backup_read_snapshot(image_handle, bup_catalog, &snapshot);
+    if (brc != BSTREAM_OK)
+      break;
+
+    /*
+      There can be a special "table" with number 0.
+      Normal tables start at number 1.
+    */
+    if (snapshot.table_num)
+    {
+      bup_table= backup_locate_table(bup_catalog, snapshot.snap_num,
+                                     snapshot.table_num - 1);
+      /* Accumulate data size. */
+      DBUG_ASSERT(!bup_table->tbl_data_size ||
+                  (bup_table->tbl_item.snap_num == snapshot.snap_num));
+      bup_table->tbl_data_size+= BBL(&snapshot.data);
+      /* Get pointers to the names. */
+      tbl_name= &bup_table->tbl_item.base.base.name;
+      db_name= &bup_table->tbl_item.base.db->base.name;
+
+      if (opt_mysqlbackup_data_chunks)
+      {
+        if (opt_mysqlbackup_snapshots)
+          printf("  Snapshot %d has %lu bytes for table '%.*s'.'%.*s'\n",
+                 snapshot.snap_num, BBL(&snapshot.data),
+                 BBLS(db_name), BBLS(tbl_name));
+        else
+          printf("  Chunk has %lu bytes for table '%.*s'.'%.*s'\n",
+                 BBL(&snapshot.data), BBLS(db_name), BBLS(tbl_name));
+      }
+    }
+    else
+    {
+      /* purecov: begin inspected */
+      if (opt_mysqlbackup_data_chunks)
+      {
+        if (opt_mysqlbackup_snapshots)
+          printf("  Snapshot %d has %lu bytes for special data\n",
+                 snapshot.snap_num, BBL(&snapshot.data));
+        else
+          printf("  Chunk has %lu bytes for special data\n",
+                 BBL(&snapshot.data));
+      }
+      /* purecov: end */
+    }
+  } while (1);
+
+  if (opt_mysqlbackup_data_totals)
+  {
+    struct st_backup_database   *bup_database;
+    struct st_backup_table      *bup_table;
+    struct st_blob              *db_name;
+    struct st_blob              *tbl_name;
+    uint                        idx;
+    uint                        jdx;
+
+    printf("\n");
+    printf("Data totals:\n");
+    printf("\n");
+    for (idx= 0; idx < bup_catalog->cat_databases.elements; idx++)
+    {
+      /* Note that the array contains pointers only. */
+      bup_database= *((struct st_backup_database**)
+                      dynamic_array_ptr(&bup_catalog->cat_databases, idx));
+      db_name= &bup_database->db_item.base.name;
+
+      for (jdx= 0; jdx < bup_database->db_tables.elements; jdx++)
+      {
+        /* Note that the array contains pointers only. */
+        bup_table= *((struct st_backup_table**)
+                     dynamic_array_ptr(&bup_database->db_tables, jdx));
+        tbl_name= &bup_table->tbl_item.base.base.name;
+        if (opt_mysqlbackup_snapshots)
+          printf("  Snapshot %d has %s for table '%.*s'.'%.*s'\n",
+                 bup_table->tbl_item.snap_num,
+                 llstr_human(bup_table->tbl_data_size, llbuff),
+                 BBLS(db_name), BBLS(tbl_name));
+        else
+          printf("  Backup has %s for table '%.*s'.'%.*s'\n",
+                 llstr_human(bup_table->tbl_data_size, llbuff),
+                 BBLS(db_name), BBLS(tbl_name));
+      }
+    }
+  }
+
+  /* Reading of snapshots must end with BSTREAM_EOC. */
+  if (brc != BSTREAM_EOC)
+  {
+    rc= 2;
+    goto end;
+  }
+
+  if (!(hdr->flags & BSTREAM_FLAG_INLINE_SUMMARY))
+  {
+    brc= read_and_print_summary(image_handle, bup_catalog);
+    if (brc != BSTREAM_OK)
+    {
+      rc= 2;
+      goto end;
+    }
+  }
+
+  goto end;
+
+ use_err:
+  usage();
+  rc= 1;
+
+ end:
+  /* Flush stdout to get output in right order in case of error messages. */
+  fflush(stdout);
+  /* Cleanup. */
+  switch (errpos) {
+  default:
+  case 40:
+    brc= backup_image_close(image_handle);
+    if (brc != BSTREAM_OK)
+      rc= 2;
+  case 30:
+    backup_catalog_free(bup_catalog);
+  case 25:
+    my_free(search_object_name, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(search_database_name, MYF(MY_ALLOW_ZERO_PTR));
+  case 20:
+#ifdef MYSQL_CLIENT
+    my_free((char*) opt_database, MYF(MY_ALLOW_ZERO_PTR));
+    my_free((char*) opt_host, MYF(MY_ALLOW_ZERO_PTR));
+    my_free((char*) opt_pass, MYF(MY_ALLOW_ZERO_PTR));
+    my_free((char*) opt_user, MYF(MY_ALLOW_ZERO_PTR));
+#endif
+  case 10:
+    free_defaults(defaults_argv);
+  }
+  my_free_open_file_info();
+  /* We cannot free DBUG, it is used in global destructors after exit(). */
+  my_end(MY_DONT_FREE_DBUG);
+  DBUG_RETURN(rc);
+}
+

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2008-10-20 19:13:22 +0000
+++ b/include/my_sys.h	2008-11-16 11:33:31 +0000
@@ -181,6 +181,18 @@ extern char *my_strndup(const char *from
 #define TRASH(A,B) /* nothing */
 #endif
 
+/*
+  ERROR INJECTION: Non-thread-safe global variable to request error inject.
+  Set this variable to non-zero to request the next my_malloc() to fail.
+  This works with my_malloc.c:my_malloc() and safemalloc.c:_mymalloc().
+  If using this in tests, note that the error messages produced by
+  my_malloc and safemalloc are different. You may need to modify the
+  results with --replace_regex. You may find examples in
+  client/backup_stream.c and backup_client_coverage.test.
+  The global variable is defined in my_static.c.
+*/
+IF_DBUG(extern int my_malloc_error_inject);
+
 #ifdef HAVE_LARGE_PAGES
 extern uint my_get_large_page_size(void);
 extern uchar * my_large_malloc(size_t size, myf my_flags);

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2008-10-23 16:29:52 +0000
+++ b/mysql-test/mysql-test-run.pl	2008-11-16 11:33:31 +0000
@@ -141,6 +141,7 @@ our $exe_master_mysqld;
 our $exe_mysql;
 our $exe_mysqladmin;
 our $exe_mysql_upgrade;
+our $exe_mysqlbackup;
 our $exe_mysqlbinlog;
 our $exe_myisamlog;
 our $exe_mysql_client_test;
@@ -1537,6 +1538,7 @@ sub executable_setup () {
   $exe_mysqldump=      mtr_exe_exists("$path_client_bindir/mysqldump");
   $exe_mysqlimport=    mtr_exe_exists("$path_client_bindir/mysqlimport");
   $exe_mysqlshow=      mtr_exe_exists("$path_client_bindir/mysqlshow");
+  $exe_mysqlbackup=    mtr_exe_exists("$path_client_bindir/mysqlbackup");
   $exe_mysqlbinlog=    mtr_exe_exists("$path_client_bindir/mysqlbinlog");
   $exe_mysqladmin=     mtr_exe_exists("$path_client_bindir/mysqladmin");
   $exe_mysql=          mtr_exe_exists("$path_client_bindir/mysql");
@@ -1953,6 +1955,20 @@ sub environment_setup () {
   $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
 
   # ----------------------------------------------------
+  # Setup env so childs can execute mysqlbackup
+  # ----------------------------------------------------
+  my $cmdline_mysqlbackup=
+    mtr_native_path($exe_mysqlbackup) .
+      " --no-defaults";
+
+  if ( $opt_debug )
+  {
+    $cmdline_mysqlbackup .=
+      " --debug=d:t:A,$path_vardir_trace/log/mysqlbackup.trace";
+  }
+  $ENV{'MYSQL_BACKUP'}= $cmdline_mysqlbackup;
+
+  # ----------------------------------------------------
   # Setup env so childs can execute mysqlbinlog
   # ----------------------------------------------------
   my $cmdline_mysqlbinlog=

=== added file 'mysql-test/suite/backup/r/backup_client.result'
--- a/mysql-test/suite/backup/r/backup_client.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_client.result	2008-11-16 11:33:31 +0000
@@ -0,0 +1,5645 @@
+#
+# WL#4534 - Backup client program
+#
+# Tests with no binlog turned on.
+#
+SET SESSION max_heap_table_size=67108864;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+#
+# Create some databases.
+#
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE DATABASE mysqltest3;
+#
+# Create table spaces.
+#
+CREATE TABLESPACE mysqltest_ts1 ADD DATAFILE 'mysqltest_ts1.dat'
+  COMMENT = 'test tablespace backup 1' ENGINE=Falcon;
+CREATE TABLESPACE mysqltest_ts2 ADD DATAFILE 'mysqltest_ts2.dat'
+  COMMENT = 'test tablespace backup 2' ENGINE=Falcon;
+#
+# Create a table.
+#
+CREATE TABLE mysqltest1.t1 (
+c1 INT PRIMARY KEY AUTO_INCREMENT,
+c2 VARCHAR(30000)) ENGINE=MyISAM;
+INSERT INTO mysqltest1.t1 VALUES(NULL, REPEAT('A', 30000));
+INSERT INTO mysqltest1.t1 SELECT NULL, c2 FROM mysqltest1.t1;
+INSERT INTO mysqltest1.t1 SELECT NULL, c2 FROM mysqltest1.t1;
+INSERT INTO mysqltest1.t1 SELECT NULL, c2 FROM mysqltest1.t1;
+INSERT INTO mysqltest1.t1 SELECT NULL, c2 FROM mysqltest1.t1;
+INSERT INTO mysqltest1.t1 SELECT NULL, c2 FROM mysqltest1.t1;
+#
+# Create more tables.
+#
+CREATE TABLE mysqltest1.t2 ENGINE=Falcon AS SELECT * FROM mysqltest1.t1;
+CREATE TABLE mysqltest1.t3 ENGINE=MEMORY AS SELECT * FROM mysqltest1.t1;
+CREATE TABLE mysqltest2.t1 ENGINE=Falcon TABLESPACE mysqltest_ts1
+AS SELECT * FROM mysqltest1.t1;
+CREATE TABLE mysqltest2.t2 ENGINE=MEMORY AS SELECT * FROM mysqltest1.t1;
+CREATE TABLE mysqltest2.t3 ENGINE=MyISAM AS SELECT * FROM mysqltest1.t1;
+CREATE TABLE mysqltest3.t1 ENGINE=MEMORY AS SELECT * FROM mysqltest1.t1;
+CREATE TABLE mysqltest3.t2 ENGINE=MyISAM AS SELECT * FROM mysqltest1.t1;
+CREATE TABLE mysqltest3.t3 ENGINE=Falcon TABLESPACE mysqltest_ts2
+AS SELECT * FROM mysqltest1.t1;
+#
+# Create views.
+#
+CREATE VIEW mysqltest1.v1 (c1, c2, c3, c4) AS
+SELECT c1, c2, c1 IN (SELECT c1+2 FROM mysqltest1.t1),
+c1 = ALL (SELECT c1 FROM mysqltest1.t1) FROM mysqltest1.t1;
+CREATE VIEW mysqltest1.v2 AS SELECT c2, c3 FROM mysqltest1.v1;
+CREATE VIEW mysqltest2.v1 (c1, c2, c3, c4) AS
+SELECT connection_id(), pi(), current_user(), version();
+CREATE VIEW mysqltest2.v2 AS
+SELECT mysqltest2.t2.c1 AS c1, mysqltest2.t2.c2 AS c2
+FROM mysqltest2.t2, mysqltest2.t3 UNION ALL
+SELECT mysqltest2.t2.c1 AS c3, mysqltest2.t2.c2 AS c4
+FROM mysqltest2.t2, mysqltest2.t3;
+CREATE VIEW mysqltest3.v1 (c1, c2) AS
+SELECT mysqltest1.v1.c1 AS c1, mysqltest2.v2.c1 AS c2
+FROM mysqltest1.v1, mysqltest2.v2
+WHERE mysqltest1.v1.c1 = mysqltest2.v2.c1;
+CREATE VIEW mysqltest3.v2 (c1, c2) AS
+SELECT mysqltest1.v1.c1 AS c1, mysqltest2.v2.c1 AS c2
+FROM mysqltest1.v1 LEFT JOIN mysqltest2.v2
+ON (mysqltest1.v1.c1 = mysqltest2.v2.c1);
+#
+# Create stored procedures
+#
+CREATE PROCEDURE mysqltest1.p1()
+BEGIN
+UPDATE mysqltest1.t1 SET c2='from mysqltest1.p1';
+END;
+|
+CREATE PROCEDURE mysqltest1.p2()
+BEGIN
+UPDATE mysqltest1.t2 SET c2='from mysqltest1.p2';
+END;
+|
+CREATE PROCEDURE mysqltest2.p1()
+BEGIN
+UPDATE mysqltest2.t1 SET c2='from mysqltest2.p1';
+END;
+|
+CREATE PROCEDURE mysqltest2.p2()
+BEGIN
+UPDATE mysqltest2.t2 SET c2='from mysqltest2.p2';
+END;
+|
+#
+# Create stored functions
+#
+CREATE FUNCTION mysqltest1.f1(arg1 INT) RETURNS INTEGER
+BEGIN
+RETURN arg1 * 11;
+END;
+|
+CREATE FUNCTION mysqltest1.f2(arg1 INT) RETURNS INTEGER
+BEGIN
+RETURN arg1 * 12;
+END;
+|
+CREATE FUNCTION mysqltest3.f1(arg1 INT) RETURNS INTEGER
+BEGIN
+RETURN arg1 * 31;
+END;
+|
+CREATE FUNCTION mysqltest3.f2(arg1 INT) RETURNS INTEGER
+BEGIN
+RETURN arg1 * 32;
+END;
+|
+#
+# Create triggers
+#
+CREATE TRIGGER mysqltest2.r1 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t2 WHERE mysqltest2.t2.c1=NEW.c1;
+END;
+|
+CREATE TRIGGER mysqltest2.r2 AFTER INSERT ON mysqltest2.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t1 WHERE mysqltest2.t1.c1=NEW.c1;
+END;
+|
+CREATE TRIGGER mysqltest3.r1 AFTER INSERT ON mysqltest3.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t2 WHERE mysqltest3.t2.c1=NEW.c1;
+END;
+|
+CREATE TRIGGER mysqltest3.r2 AFTER INSERT ON mysqltest3.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t1 WHERE mysqltest3.t1.c1=NEW.c1;
+END;
+|
+#
+# Create events
+#
+CREATE EVENT mysqltest1.e1 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM mysqltest1.t1 WHERE c1 > 100;
+|
+CREATE EVENT mysqltest1.e2 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM mysqltest1.t2 WHERE c1 > 100;
+|
+CREATE EVENT mysqltest2.e1 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM mysqltest2.t1 WHERE c1 > 100;
+|
+CREATE EVENT mysqltest2.e2 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM mysqltest2.t2 WHERE c1 > 100;
+|
+#
+# Create users and grants
+#
+CREATE USER 'bup_user1'@'%';
+CREATE USER 'bup_user2';
+CREATE USER 'bup_user3'@'%';
+REVOKE ALL ON *.* FROM 'bup_user1'@'%';
+REVOKE ALL ON *.* FROM 'bup_user2';
+GRANT ALL ON mysqltest2.* TO 'bup_user1'@'%';
+GRANT SELECT ON mysqltest1.* TO 'bup_user1'@'%';
+GRANT INSERT ON mysqltest1.* TO 'bup_user2';
+GRANT ALL ON mysqltest1.* TO 'no_user'@'%';
+GRANT SELECT (c1) ON mysqltest1.t1 TO 'bup_user1'@'%';
+GRANT SELECT (c2), INSERT (c2) ON mysqltest1.t2 TO 'bup_user2';
+FLUSH PRIVILEGES;
+#
+# Backup.
+#
+BACKUP DATABASE mysqltest1, mysqltest2, mysqltest3 TO 'mysqltest.bak';
+backup_id
+#
+
+Show help output with --help:
+========vvvvvvvv========
+mysqlbackup Ver # for # at #
+By Sun Microsystems, for your professional use
+This software comes with NO WARRANTY:  This is free software,
+and you are welcome to modify and redistribute it under the GPL license
+
+Displays information from a backup image.
+
+Usage: mysqlbackup [options] backup-image-file
+  -?, --help          Display this help and exit.
+  -v, --verbose       Print verbose information.
+  -V, --version       Print version and exit.
+  --open_files_limit=# 
+                      Used to reserve file descriptors for usage by this
+                      program.
+  --catalog-summary   Print summary from the database objects catalog.
+  --catalog-details   Print details from the database objects catalog.
+  --metadata-statements 
+                      Print SQL statements to create the database objects.
+  --metadata-extra    Print extra meta data for the database objects.
+  --snapshots         Print information about snapshots contained in the backup
+                      image.
+  --data-chunks       Print length of every data chunk contained in the backup
+                      image.
+  --data-totals       Print length of data contained in the backup image for
+                      each object.
+  --summary           Print summary information from end of the backup image.
+  --all               Print everything except snapshots and data-chunks.
+  --exact             Print exact number of bytes instead of human readable
+                      form.
+  --search=name       Search object in the backup image. Name can be object or
+                      database.object. Quoting of database and/or object with
+                      ", ', or ` is allowed. Wildcards % and _ are available.
+                      Use with --metadata-* options to see meta data. Plain
+                      name finds global objects, name1.name2 finds per db
+                      objects.
+
+Variables (--variable-name=value)
+and boolean options {FALSE|TRUE}  Value (after reading options)
+--------------------------------- -----------------------------
+open_files_limit #
+search                            (No default value)
+========^^^^^^^^========
+
+Show help output with -?:
+========vvvvvvvv========
+mysqlbackup Ver # for # at #
+By Sun Microsystems, for your professional use
+This software comes with NO WARRANTY:  This is free software,
+and you are welcome to modify and redistribute it under the GPL license
+
+Displays information from a backup image.
+
+Usage: mysqlbackup [options] backup-image-file
+  -?, --help          Display this help and exit.
+  -v, --verbose       Print verbose information.
+  -V, --version       Print version and exit.
+  --open_files_limit=# 
+                      Used to reserve file descriptors for usage by this
+                      program.
+  --catalog-summary   Print summary from the database objects catalog.
+  --catalog-details   Print details from the database objects catalog.
+  --metadata-statements 
+                      Print SQL statements to create the database objects.
+  --metadata-extra    Print extra meta data for the database objects.
+  --snapshots         Print information about snapshots contained in the backup
+                      image.
+  --data-chunks       Print length of every data chunk contained in the backup
+                      image.
+  --data-totals       Print length of data contained in the backup image for
+                      each object.
+  --summary           Print summary information from end of the backup image.
+  --all               Print everything except snapshots and data-chunks.
+  --exact             Print exact number of bytes instead of human readable
+                      form.
+  --search=name       Search object in the backup image. Name can be object or
+                      database.object. Quoting of database and/or object with
+                      ", ', or ` is allowed. Wildcards % and _ are available.
+                      Use with --metadata-* options to see meta data. Plain
+                      name finds global objects, name1.name2 finds per db
+                      objects.
+
+Variables (--variable-name=value)
+and boolean options {FALSE|TRUE}  Value (after reading options)
+--------------------------------- -----------------------------
+open_files_limit #
+search                            (No default value)
+========^^^^^^^^========
+
+Show version with --version:
+========vvvvvvvv========
+mysqlbackup Ver # for # at #
+========^^^^^^^^========
+
+Show version with -V:
+========vvvvvvvv========
+mysqlbackup Ver # for # at #
+========^^^^^^^^========
+
+Minimal output without options:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+========^^^^^^^^========
+
+Catalog summary:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Catalog summary:
+
+  Databases:              3
+  Tables:                 9
+  Other per db objects:   63
+========^^^^^^^^========
+
+Catalog details:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Catalog details:
+
+  Tablespace 'mysqltest_ts1'
+  Tablespace 'mysqltest_ts2'
+  Database  'mysqltest1'
+    Table     'mysqltest1'.'t1'
+    Table     'mysqltest1'.'t2'
+    Table     'mysqltest1'.'t3'
+    Sproc     'mysqltest1'.'p1'
+    Sproc     'mysqltest1'.'p2'
+    Sfunc     'mysqltest1'.'f1'
+    Sfunc     'mysqltest1'.'f2'
+    View      'mysqltest1'.'v1'
+    View      'mysqltest1'.'v2'
+    Event     'mysqltest1'.'e1'
+    Event     'mysqltest1'.'e2'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030'
+  Database  'mysqltest2'
+    Table     'mysqltest2'.'t1'
+    Table     'mysqltest2'.'t2'
+    Table     'mysqltest2'.'t3'
+    Sproc     'mysqltest2'.'p1'
+    Sproc     'mysqltest2'.'p2'
+    View      'mysqltest2'.'v1'
+    View      'mysqltest2'.'v2'
+    Event     'mysqltest2'.'e1'
+    Event     'mysqltest2'.'e2'
+    Trigger   'mysqltest2'.'r1'
+    Trigger   'mysqltest2'.'r2'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025'
+  Database  'mysqltest3'
+    Table     'mysqltest3'.'t1'
+    Table     'mysqltest3'.'t2'
+    Table     'mysqltest3'.'t3'
+    Sfunc     'mysqltest3'.'f1'
+    Sfunc     'mysqltest3'.'f2'
+    View      'mysqltest3'.'v1'
+    View      'mysqltest3'.'v2'
+    Trigger   'mysqltest3'.'r1'
+    Trigger   'mysqltest3'.'r2'
+========^^^^^^^^========
+
+Metadata statements:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Meta data:
+
+  Tablespace 'mysqltest_ts1' statement: 'CREATE TABLESPACE `mysqltest_ts1` ADD DATAFILE 'mysqltest_ts1.dat' COMMENT = 'test tablespace backup 1' ENGINE=Falcon'
+
+  Tablespace 'mysqltest_ts2' statement: 'CREATE TABLESPACE `mysqltest_ts2` ADD DATAFILE 'mysqltest_ts2.dat' COMMENT = 'test tablespace backup 2' ENGINE=Falcon'
+
+  Database 'mysqltest1' statement: 'CREATE DATABASE `mysqltest1` DEFAULT CHARACTER SET latin1'
+
+    Table 'mysqltest1'.'t1' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(30000) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=latin1'
+
+    Table 'mysqltest1'.'t2' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=Falcon DEFAULT CHARSET=latin1'
+
+    Table 'mysqltest1'.'t3' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+
+    Sproc 'mysqltest1'.'p1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest1.t1 SET c2='from mysqltest1.p1';
+END'
+
+    Sproc 'mysqltest1'.'p2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest1.t2 SET c2='from mysqltest1.p2';
+END'
+
+    Sfunc 'mysqltest1'.'f1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 11;
+END'
+
+    Sfunc 'mysqltest1'.'f2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 12;
+END'
+
+    View 'mysqltest1'.'v1' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v1` AS select `mysqltest1`.`t1`.`c1` AS `c1`,`mysqltest1`.`t1`.`c2` AS `c2`,`mysqltest1`.`t1`.`c1` in (select (`mysqltest1`.`t1`.`c1` + 2) AS `c1+2` from `mysqltest1`.`t1`) AS `c3`,`mysqltest1`.`t1`.`c1` = all (select `mysqltest1`.`t1`.`c1` AS `c1` from `mysqltest1`.`t1`) AS `c4` from `mysqltest1`.`t1`'
+
+    View 'mysqltest1'.'v2' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v2` AS select `v1`.`c2` AS `c2`,`v1`.`c3` AS `c3` from `mysqltest1`.`v1`'
+
+    Event 'mysqltest1'.'e1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t1 WHERE c1 > 100'
+
+    Event 'mysqltest1'.'e2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t2 WHERE c1 > 100'
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest1.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest1.* TO 'bup_user2'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' statement: 'GRANT SELECT ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' statement: 'GRANT INSERT ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' statement: 'GRANT UPDATE ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' statement: 'GRANT DELETE ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' statement: 'GRANT CREATE ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' statement: 'GRANT DROP ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' statement: 'GRANT REFERENCES ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' statement: 'GRANT INDEX ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' statement: 'GRANT ALTER ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' statement: 'GRANT LOCK TABLES ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' statement: 'GRANT EXECUTE ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' statement: 'GRANT CREATE VIEW ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' statement: 'GRANT SHOW VIEW ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' statement: 'GRANT CREATE ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' statement: 'GRANT ALTER ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' statement: 'GRANT EVENT ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' statement: 'GRANT TRIGGER ON mysqltest1.* TO 'no_user'@'%''
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' statement: 'GRANT SELECT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' statement: 'GRANT INSERT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' statement: 'GRANT SELECT(c1) ON mysqltest1.t1 TO 'bup_user1'@'%''
+
+  Database 'mysqltest2' statement: 'CREATE DATABASE `mysqltest2` DEFAULT CHARACTER SET latin1'
+
+    Table 'mysqltest2'.'t1' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+
+    Table 'mysqltest2'.'t2' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+
+    Table 'mysqltest2'.'t3' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+
+    Sproc 'mysqltest2'.'p1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest2.t1 SET c2='from mysqltest2.p1';
+END'
+
+    Sproc 'mysqltest2'.'p2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest2.t2 SET c2='from mysqltest2.p2';
+END'
+
+    View 'mysqltest2'.'v1' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v1` AS select connection_id() AS `c1`,pi() AS `c2`,current_user() AS `c3`,version() AS `c4`'
+
+    View 'mysqltest2'.'v2' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v2` AS select `mysqltest2`.`t2`.`c1` AS `c1`,`mysqltest2`.`t2`.`c2` AS `c2` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`) union all select `mysqltest2`.`t2`.`c1` AS `c3`,`mysqltest2`.`t2`.`c2` AS `c4` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`)'
+
+    Event 'mysqltest2'.'e1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t1 WHERE c1 > 100'
+
+    Event 'mysqltest2'.'e2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t2 WHERE c1 > 100'
+
+    Trigger 'mysqltest2'.'r1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r1 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t2 WHERE mysqltest2.t2.c1=NEW.c1;
+END'
+
+    Trigger 'mysqltest2'.'r2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r2 AFTER INSERT ON mysqltest2.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t1 WHERE mysqltest2.t1.c1=NEW.c1;
+END'
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' statement: 'GRANT UPDATE ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' statement: 'GRANT DELETE ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' statement: 'GRANT CREATE ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' statement: 'GRANT DROP ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' statement: 'GRANT REFERENCES ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' statement: 'GRANT INDEX ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' statement: 'GRANT ALTER ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' statement: 'GRANT LOCK TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' statement: 'GRANT EXECUTE ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' statement: 'GRANT CREATE VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' statement: 'GRANT SHOW VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' statement: 'GRANT CREATE ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' statement: 'GRANT ALTER ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' statement: 'GRANT EVENT ON mysqltest2.* TO 'bup_user1'@'%''
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' statement: 'GRANT TRIGGER ON mysqltest2.* TO 'bup_user1'@'%''
+
+  Database 'mysqltest3' statement: 'CREATE DATABASE `mysqltest3` DEFAULT CHARACTER SET latin1'
+
+    Table 'mysqltest3'.'t1' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+
+    Table 'mysqltest3'.'t2' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+
+    Table 'mysqltest3'.'t3' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts2` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+
+    Sfunc 'mysqltest3'.'f1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 31;
+END'
+
+    Sfunc 'mysqltest3'.'f2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 32;
+END'
+
+    View 'mysqltest3'.'v1' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v1` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` join `mysqltest2`.`v2`) where (`v1`.`c1` = `v2`.`c1`)'
+
+    View 'mysqltest3'.'v2' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v2` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` left join `mysqltest2`.`v2` on((`v1`.`c1` = `v2`.`c1`)))'
+
+    Trigger 'mysqltest3'.'r1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r1 AFTER INSERT ON mysqltest3.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t2 WHERE mysqltest3.t2.c1=NEW.c1;
+END'
+
+    Trigger 'mysqltest3'.'r2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r2 AFTER INSERT ON mysqltest3.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t1 WHERE mysqltest3.t1.c1=NEW.c1;
+END'
+========^^^^^^^^========
+
+Metadata extra:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Meta data:
+
+  Tablespace 'mysqltest_ts1' extra data length: 0
+
+  Tablespace 'mysqltest_ts2' extra data length: 0
+
+  Database 'mysqltest1' extra data length: 0
+
+    Table 'mysqltest1'.'t1' extra data length: 0
+
+    Table 'mysqltest1'.'t2' extra data length: 0
+
+    Table 'mysqltest1'.'t3' extra data length: 0
+
+    Sproc 'mysqltest1'.'p1' extra data length: 0
+
+    Sproc 'mysqltest1'.'p2' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f2' extra data length: 0
+
+    View 'mysqltest1'.'v1' extra data length: 0
+
+    View 'mysqltest1'.'v2' extra data length: 0
+
+    Event 'mysqltest1'.'e1' extra data length: 0
+
+    Event 'mysqltest1'.'e2' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' extra data length: 0
+
+  Database 'mysqltest2' extra data length: 0
+
+    Table 'mysqltest2'.'t1' extra data length: 0
+
+    Table 'mysqltest2'.'t2' extra data length: 0
+
+    Table 'mysqltest2'.'t3' extra data length: 0
+
+    Sproc 'mysqltest2'.'p1' extra data length: 0
+
+    Sproc 'mysqltest2'.'p2' extra data length: 0
+
+    View 'mysqltest2'.'v1' extra data length: 0
+
+    View 'mysqltest2'.'v2' extra data length: 0
+
+    Event 'mysqltest2'.'e1' extra data length: 0
+
+    Event 'mysqltest2'.'e2' extra data length: 0
+
+    Trigger 'mysqltest2'.'r1' extra data length: 0
+
+    Trigger 'mysqltest2'.'r2' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' extra data length: 0
+
+  Database 'mysqltest3' extra data length: 0
+
+    Table 'mysqltest3'.'t1' extra data length: 0
+
+    Table 'mysqltest3'.'t2' extra data length: 0
+
+    Table 'mysqltest3'.'t3' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f2' extra data length: 0
+
+    View 'mysqltest3'.'v1' extra data length: 0
+
+    View 'mysqltest3'.'v2' extra data length: 0
+
+    Trigger 'mysqltest3'.'r1' extra data length: 0
+
+    Trigger 'mysqltest3'.'r2' extra data length: 0
+========^^^^^^^^========
+
+Snapshots:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Snapshot count:      3
+
+Snapshots:
+
+  Snapshot 0 type    native from 'MyISAM'  version 1.0
+  Snapshot 0 version 1
+  Snapshot 0 tables  1
+  Snapshot 1 type    logical from consistent snapshot
+  Snapshot 1 version 1
+  Snapshot 1 tables  1
+  Snapshot 2 type    logical from locked tables
+  Snapshot 2 version 1
+  Snapshot 2 tables  1
+========^^^^^^^^========
+
+Data chunks:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Data chunks:
+  Chunk has 960385 bytes for table 'mysqltest1'.'t1'
+  Chunk has 2049 bytes for table 'mysqltest1'.'t1'
+  Chunk has 960385 bytes for table 'mysqltest2'.'t3'
+  Chunk has 1025 bytes for table 'mysqltest2'.'t3'
+  Chunk has 960385 bytes for table 'mysqltest3'.'t2'
+  Chunk has 1025 bytes for table 'mysqltest3'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest1'.'t2'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest2'.'t1'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+  Chunk has 30008 bytes for table 'mysqltest3'.'t3'
+========^^^^^^^^========
+
+Data totals:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Data totals:
+
+  Backup has 939 KB for table 'mysqltest1'.'t1'
+  Backup has 937 KB for table 'mysqltest1'.'t2'
+  Backup has 937 KB for table 'mysqltest1'.'t3'
+  Backup has 937 KB for table 'mysqltest2'.'t1'
+  Backup has 937 KB for table 'mysqltest2'.'t2'
+  Backup has 938 KB for table 'mysqltest2'.'t3'
+  Backup has 937 KB for table 'mysqltest3'.'t1'
+  Backup has 938 KB for table 'mysqltest3'.'t2'
+  Backup has 937 KB for table 'mysqltest3'.'t3'
+========^^^^^^^^========
+
+Summary:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Summary:
+
+Creation time: #
+Validity time: #
+Finish   time: #
+No binlog information
+========^^^^^^^^========
+
+Full set of most relevant information:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Catalog summary:
+
+  Databases:              3
+  Tables:                 9
+  Other per db objects:   63
+
+Catalog details:
+
+  Tablespace 'mysqltest_ts1'
+  Tablespace 'mysqltest_ts2'
+  Database  'mysqltest1'
+    Table     'mysqltest1'.'t1'
+    Table     'mysqltest1'.'t2'
+    Table     'mysqltest1'.'t3'
+    Sproc     'mysqltest1'.'p1'
+    Sproc     'mysqltest1'.'p2'
+    Sfunc     'mysqltest1'.'f1'
+    Sfunc     'mysqltest1'.'f2'
+    View      'mysqltest1'.'v1'
+    View      'mysqltest1'.'v2'
+    Event     'mysqltest1'.'e1'
+    Event     'mysqltest1'.'e2'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030'
+  Database  'mysqltest2'
+    Table     'mysqltest2'.'t1'
+    Table     'mysqltest2'.'t2'
+    Table     'mysqltest2'.'t3'
+    Sproc     'mysqltest2'.'p1'
+    Sproc     'mysqltest2'.'p2'
+    View      'mysqltest2'.'v1'
+    View      'mysqltest2'.'v2'
+    Event     'mysqltest2'.'e1'
+    Event     'mysqltest2'.'e2'
+    Trigger   'mysqltest2'.'r1'
+    Trigger   'mysqltest2'.'r2'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025'
+  Database  'mysqltest3'
+    Table     'mysqltest3'.'t1'
+    Table     'mysqltest3'.'t2'
+    Table     'mysqltest3'.'t3'
+    Sfunc     'mysqltest3'.'f1'
+    Sfunc     'mysqltest3'.'f2'
+    View      'mysqltest3'.'v1'
+    View      'mysqltest3'.'v2'
+    Trigger   'mysqltest3'.'r1'
+    Trigger   'mysqltest3'.'r2'
+
+Meta data:
+
+  Tablespace 'mysqltest_ts1' statement: 'CREATE TABLESPACE `mysqltest_ts1` ADD DATAFILE 'mysqltest_ts1.dat' COMMENT = 'test tablespace backup 1' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts1' extra data length: 0
+
+  Tablespace 'mysqltest_ts2' statement: 'CREATE TABLESPACE `mysqltest_ts2` ADD DATAFILE 'mysqltest_ts2.dat' COMMENT = 'test tablespace backup 2' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts2' extra data length: 0
+
+  Database 'mysqltest1' statement: 'CREATE DATABASE `mysqltest1` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest1' extra data length: 0
+
+    Table 'mysqltest1'.'t1' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(30000) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t1' extra data length: 0
+
+    Table 'mysqltest1'.'t2' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t2' extra data length: 0
+
+    Table 'mysqltest1'.'t3' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t3' extra data length: 0
+
+    Sproc 'mysqltest1'.'p1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest1.t1 SET c2='from mysqltest1.p1';
+END'
+    Sproc 'mysqltest1'.'p1' extra data length: 0
+
+    Sproc 'mysqltest1'.'p2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest1.t2 SET c2='from mysqltest1.p2';
+END'
+    Sproc 'mysqltest1'.'p2' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 11;
+END'
+    Sfunc 'mysqltest1'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 12;
+END'
+    Sfunc 'mysqltest1'.'f2' extra data length: 0
+
+    View 'mysqltest1'.'v1' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v1` AS select `mysqltest1`.`t1`.`c1` AS `c1`,`mysqltest1`.`t1`.`c2` AS `c2`,`mysqltest1`.`t1`.`c1` in (select (`mysqltest1`.`t1`.`c1` + 2) AS `c1+2` from `mysqltest1`.`t1`) AS `c3`,`mysqltest1`.`t1`.`c1` = all (select `mysqltest1`.`t1`.`c1` AS `c1` from `mysqltest1`.`t1`) AS `c4` from `mysqltest1`.`t1`'
+    View 'mysqltest1'.'v1' extra data length: 0
+
+    View 'mysqltest1'.'v2' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v2` AS select `v1`.`c2` AS `c2`,`v1`.`c3` AS `c3` from `mysqltest1`.`v1`'
+    View 'mysqltest1'.'v2' extra data length: 0
+
+    Event 'mysqltest1'.'e1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t1 WHERE c1 > 100'
+    Event 'mysqltest1'.'e1' extra data length: 0
+
+    Event 'mysqltest1'.'e2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t2 WHERE c1 > 100'
+    Event 'mysqltest1'.'e2' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest1.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest1.* TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' statement: 'GRANT SELECT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' statement: 'GRANT INSERT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' statement: 'GRANT UPDATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' statement: 'GRANT DELETE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' statement: 'GRANT CREATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' statement: 'GRANT DROP ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' statement: 'GRANT REFERENCES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' statement: 'GRANT INDEX ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' statement: 'GRANT ALTER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' statement: 'GRANT LOCK TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' statement: 'GRANT EXECUTE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' statement: 'GRANT CREATE VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' statement: 'GRANT SHOW VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' statement: 'GRANT CREATE ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' statement: 'GRANT ALTER ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' statement: 'GRANT EVENT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' statement: 'GRANT TRIGGER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' statement: 'GRANT SELECT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' statement: 'GRANT INSERT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' statement: 'GRANT SELECT(c1) ON mysqltest1.t1 TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' extra data length: 0
+
+  Database 'mysqltest2' statement: 'CREATE DATABASE `mysqltest2` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest2' extra data length: 0
+
+    Table 'mysqltest2'.'t1' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t1' extra data length: 0
+
+    Table 'mysqltest2'.'t2' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t2' extra data length: 0
+
+    Table 'mysqltest2'.'t3' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t3' extra data length: 0
+
+    Sproc 'mysqltest2'.'p1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest2.t1 SET c2='from mysqltest2.p1';
+END'
+    Sproc 'mysqltest2'.'p1' extra data length: 0
+
+    Sproc 'mysqltest2'.'p2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest2.t2 SET c2='from mysqltest2.p2';
+END'
+    Sproc 'mysqltest2'.'p2' extra data length: 0
+
+    View 'mysqltest2'.'v1' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v1` AS select connection_id() AS `c1`,pi() AS `c2`,current_user() AS `c3`,version() AS `c4`'
+    View 'mysqltest2'.'v1' extra data length: 0
+
+    View 'mysqltest2'.'v2' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v2` AS select `mysqltest2`.`t2`.`c1` AS `c1`,`mysqltest2`.`t2`.`c2` AS `c2` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`) union all select `mysqltest2`.`t2`.`c1` AS `c3`,`mysqltest2`.`t2`.`c2` AS `c4` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`)'
+    View 'mysqltest2'.'v2' extra data length: 0
+
+    Event 'mysqltest2'.'e1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t1 WHERE c1 > 100'
+    Event 'mysqltest2'.'e1' extra data length: 0
+
+    Event 'mysqltest2'.'e2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t2 WHERE c1 > 100'
+    Event 'mysqltest2'.'e2' extra data length: 0
+
+    Trigger 'mysqltest2'.'r1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r1 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t2 WHERE mysqltest2.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r1' extra data length: 0
+
+    Trigger 'mysqltest2'.'r2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r2 AFTER INSERT ON mysqltest2.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t1 WHERE mysqltest2.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r2' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' statement: 'GRANT UPDATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' statement: 'GRANT DELETE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' statement: 'GRANT CREATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' statement: 'GRANT DROP ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' statement: 'GRANT REFERENCES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' statement: 'GRANT INDEX ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' statement: 'GRANT ALTER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' statement: 'GRANT LOCK TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' statement: 'GRANT EXECUTE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' statement: 'GRANT CREATE VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' statement: 'GRANT SHOW VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' statement: 'GRANT CREATE ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' statement: 'GRANT ALTER ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' statement: 'GRANT EVENT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' statement: 'GRANT TRIGGER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' extra data length: 0
+
+  Database 'mysqltest3' statement: 'CREATE DATABASE `mysqltest3` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest3' extra data length: 0
+
+    Table 'mysqltest3'.'t1' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t1' extra data length: 0
+
+    Table 'mysqltest3'.'t2' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t2' extra data length: 0
+
+    Table 'mysqltest3'.'t3' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts2` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t3' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 31;
+END'
+    Sfunc 'mysqltest3'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 32;
+END'
+    Sfunc 'mysqltest3'.'f2' extra data length: 0
+
+    View 'mysqltest3'.'v1' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v1` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` join `mysqltest2`.`v2`) where (`v1`.`c1` = `v2`.`c1`)'
+    View 'mysqltest3'.'v1' extra data length: 0
+
+    View 'mysqltest3'.'v2' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v2` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` left join `mysqltest2`.`v2` on((`v1`.`c1` = `v2`.`c1`)))'
+    View 'mysqltest3'.'v2' extra data length: 0
+
+    Trigger 'mysqltest3'.'r1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r1 AFTER INSERT ON mysqltest3.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t2 WHERE mysqltest3.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r1' extra data length: 0
+
+    Trigger 'mysqltest3'.'r2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r2 AFTER INSERT ON mysqltest3.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t1 WHERE mysqltest3.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r2' extra data length: 0
+
+Data totals:
+
+  Backup has 939 KB for table 'mysqltest1'.'t1'
+  Backup has 937 KB for table 'mysqltest1'.'t2'
+  Backup has 937 KB for table 'mysqltest1'.'t3'
+  Backup has 937 KB for table 'mysqltest2'.'t1'
+  Backup has 937 KB for table 'mysqltest2'.'t2'
+  Backup has 938 KB for table 'mysqltest2'.'t3'
+  Backup has 937 KB for table 'mysqltest3'.'t1'
+  Backup has 938 KB for table 'mysqltest3'.'t2'
+  Backup has 937 KB for table 'mysqltest3'.'t3'
+
+Summary:
+
+Creation time: #
+Validity time: #
+Finish   time: #
+No binlog information
+========^^^^^^^^========
+
+Full set of most relevant information, verbosely:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+Backup image chrset: 'utf8'
+
+Catalog summary:
+
+  Character sets:         0
+  Databases:              3
+  Tables:                 9
+  Other per db objects:   63
+
+Catalog details:
+
+  Tablespace 'mysqltest_ts1'
+  Tablespace 'mysqltest_ts2'
+  Database  'mysqltest1'
+    Table     'mysqltest1'.'t1'
+    Table     'mysqltest1'.'t2'
+    Table     'mysqltest1'.'t3'
+    Sproc     'mysqltest1'.'p1'
+    Sproc     'mysqltest1'.'p2'
+    Sfunc     'mysqltest1'.'f1'
+    Sfunc     'mysqltest1'.'f2'
+    View      'mysqltest1'.'v1'
+    View      'mysqltest1'.'v2'
+    Event     'mysqltest1'.'e1'
+    Event     'mysqltest1'.'e2'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030'
+  Database  'mysqltest2'
+    Table     'mysqltest2'.'t1'
+    Table     'mysqltest2'.'t2'
+    Table     'mysqltest2'.'t3'
+    Sproc     'mysqltest2'.'p1'
+    Sproc     'mysqltest2'.'p2'
+    View      'mysqltest2'.'v1'
+    View      'mysqltest2'.'v2'
+    Event     'mysqltest2'.'e1'
+    Event     'mysqltest2'.'e2'
+    Trigger   'mysqltest2'.'r1'
+    Trigger   'mysqltest2'.'r2'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025'
+  Database  'mysqltest3'
+    Table     'mysqltest3'.'t1'
+    Table     'mysqltest3'.'t2'
+    Table     'mysqltest3'.'t3'
+    Sfunc     'mysqltest3'.'f1'
+    Sfunc     'mysqltest3'.'f2'
+    View      'mysqltest3'.'v1'
+    View      'mysqltest3'.'v2'
+    Trigger   'mysqltest3'.'r1'
+    Trigger   'mysqltest3'.'r2'
+
+Meta data:
+
+  Tablespace 'mysqltest_ts1' statement: 'CREATE TABLESPACE `mysqltest_ts1` ADD DATAFILE 'mysqltest_ts1.dat' COMMENT = 'test tablespace backup 1' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts1' extra data length: 0
+
+  Tablespace 'mysqltest_ts2' statement: 'CREATE TABLESPACE `mysqltest_ts2` ADD DATAFILE 'mysqltest_ts2.dat' COMMENT = 'test tablespace backup 2' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts2' extra data length: 0
+
+  Database 'mysqltest1' statement: 'CREATE DATABASE `mysqltest1` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest1' extra data length: 0
+
+    Table 'mysqltest1'.'t1' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(30000) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t1' extra data length: 0
+
+    Table 'mysqltest1'.'t2' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t2' extra data length: 0
+
+    Table 'mysqltest1'.'t3' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t3' extra data length: 0
+
+    Sproc 'mysqltest1'.'p1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest1.t1 SET c2='from mysqltest1.p1';
+END'
+    Sproc 'mysqltest1'.'p1' extra data length: 0
+
+    Sproc 'mysqltest1'.'p2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest1.t2 SET c2='from mysqltest1.p2';
+END'
+    Sproc 'mysqltest1'.'p2' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 11;
+END'
+    Sfunc 'mysqltest1'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 12;
+END'
+    Sfunc 'mysqltest1'.'f2' extra data length: 0
+
+    View 'mysqltest1'.'v1' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v1` AS select `mysqltest1`.`t1`.`c1` AS `c1`,`mysqltest1`.`t1`.`c2` AS `c2`,`mysqltest1`.`t1`.`c1` in (select (`mysqltest1`.`t1`.`c1` + 2) AS `c1+2` from `mysqltest1`.`t1`) AS `c3`,`mysqltest1`.`t1`.`c1` = all (select `mysqltest1`.`t1`.`c1` AS `c1` from `mysqltest1`.`t1`) AS `c4` from `mysqltest1`.`t1`'
+    View 'mysqltest1'.'v1' extra data length: 0
+
+    View 'mysqltest1'.'v2' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v2` AS select `v1`.`c2` AS `c2`,`v1`.`c3` AS `c3` from `mysqltest1`.`v1`'
+    View 'mysqltest1'.'v2' extra data length: 0
+
+    Event 'mysqltest1'.'e1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t1 WHERE c1 > 100'
+    Event 'mysqltest1'.'e1' extra data length: 0
+
+    Event 'mysqltest1'.'e2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t2 WHERE c1 > 100'
+    Event 'mysqltest1'.'e2' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest1.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest1.* TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' statement: 'GRANT SELECT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' statement: 'GRANT INSERT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' statement: 'GRANT UPDATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' statement: 'GRANT DELETE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' statement: 'GRANT CREATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' statement: 'GRANT DROP ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' statement: 'GRANT REFERENCES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' statement: 'GRANT INDEX ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' statement: 'GRANT ALTER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' statement: 'GRANT LOCK TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' statement: 'GRANT EXECUTE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' statement: 'GRANT CREATE VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' statement: 'GRANT SHOW VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' statement: 'GRANT CREATE ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' statement: 'GRANT ALTER ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' statement: 'GRANT EVENT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' statement: 'GRANT TRIGGER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' statement: 'GRANT SELECT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' statement: 'GRANT INSERT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' statement: 'GRANT SELECT(c1) ON mysqltest1.t1 TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' extra data length: 0
+
+  Database 'mysqltest2' statement: 'CREATE DATABASE `mysqltest2` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest2' extra data length: 0
+
+    Table 'mysqltest2'.'t1' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t1' extra data length: 0
+
+    Table 'mysqltest2'.'t2' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t2' extra data length: 0
+
+    Table 'mysqltest2'.'t3' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t3' extra data length: 0
+
+    Sproc 'mysqltest2'.'p1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest2.t1 SET c2='from mysqltest2.p1';
+END'
+    Sproc 'mysqltest2'.'p1' extra data length: 0
+
+    Sproc 'mysqltest2'.'p2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest2.t2 SET c2='from mysqltest2.p2';
+END'
+    Sproc 'mysqltest2'.'p2' extra data length: 0
+
+    View 'mysqltest2'.'v1' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v1` AS select connection_id() AS `c1`,pi() AS `c2`,current_user() AS `c3`,version() AS `c4`'
+    View 'mysqltest2'.'v1' extra data length: 0
+
+    View 'mysqltest2'.'v2' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v2` AS select `mysqltest2`.`t2`.`c1` AS `c1`,`mysqltest2`.`t2`.`c2` AS `c2` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`) union all select `mysqltest2`.`t2`.`c1` AS `c3`,`mysqltest2`.`t2`.`c2` AS `c4` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`)'
+    View 'mysqltest2'.'v2' extra data length: 0
+
+    Event 'mysqltest2'.'e1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t1 WHERE c1 > 100'
+    Event 'mysqltest2'.'e1' extra data length: 0
+
+    Event 'mysqltest2'.'e2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t2 WHERE c1 > 100'
+    Event 'mysqltest2'.'e2' extra data length: 0
+
+    Trigger 'mysqltest2'.'r1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r1 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t2 WHERE mysqltest2.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r1' extra data length: 0
+
+    Trigger 'mysqltest2'.'r2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r2 AFTER INSERT ON mysqltest2.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t1 WHERE mysqltest2.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r2' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' statement: 'GRANT UPDATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' statement: 'GRANT DELETE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' statement: 'GRANT CREATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' statement: 'GRANT DROP ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' statement: 'GRANT REFERENCES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' statement: 'GRANT INDEX ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' statement: 'GRANT ALTER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' statement: 'GRANT LOCK TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' statement: 'GRANT EXECUTE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' statement: 'GRANT CREATE VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' statement: 'GRANT SHOW VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' statement: 'GRANT CREATE ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' statement: 'GRANT ALTER ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' statement: 'GRANT EVENT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' statement: 'GRANT TRIGGER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' extra data length: 0
+
+  Database 'mysqltest3' statement: 'CREATE DATABASE `mysqltest3` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest3' extra data length: 0
+
+    Table 'mysqltest3'.'t1' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t1' extra data length: 0
+
+    Table 'mysqltest3'.'t2' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t2' extra data length: 0
+
+    Table 'mysqltest3'.'t3' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts2` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t3' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 31;
+END'
+    Sfunc 'mysqltest3'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 32;
+END'
+    Sfunc 'mysqltest3'.'f2' extra data length: 0
+
+    View 'mysqltest3'.'v1' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v1` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` join `mysqltest2`.`v2`) where (`v1`.`c1` = `v2`.`c1`)'
+    View 'mysqltest3'.'v1' extra data length: 0
+
+    View 'mysqltest3'.'v2' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v2` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` left join `mysqltest2`.`v2` on((`v1`.`c1` = `v2`.`c1`)))'
+    View 'mysqltest3'.'v2' extra data length: 0
+
+    Trigger 'mysqltest3'.'r1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r1 AFTER INSERT ON mysqltest3.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t2 WHERE mysqltest3.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r1' extra data length: 0
+
+    Trigger 'mysqltest3'.'r2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r2 AFTER INSERT ON mysqltest3.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t1 WHERE mysqltest3.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r2' extra data length: 0
+
+Data totals:
+
+  Backup has 939 KB for table 'mysqltest1'.'t1'
+  Backup has 937 KB for table 'mysqltest1'.'t2'
+  Backup has 937 KB for table 'mysqltest1'.'t3'
+  Backup has 937 KB for table 'mysqltest2'.'t1'
+  Backup has 937 KB for table 'mysqltest2'.'t2'
+  Backup has 938 KB for table 'mysqltest2'.'t3'
+  Backup has 937 KB for table 'mysqltest3'.'t1'
+  Backup has 938 KB for table 'mysqltest3'.'t2'
+  Backup has 937 KB for table 'mysqltest3'.'t3'
+
+Summary:
+
+Creation time: #
+Validity time: #
+Finish   time: #
+No binlog information
+========^^^^^^^^========
+
+Full set of most relevant information plus snapshots:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+Snapshot count:      3
+
+Snapshots:
+
+  Snapshot 0 type    native from 'MyISAM'  version 1.0
+  Snapshot 0 version 1
+  Snapshot 0 tables  1
+  Snapshot 1 type    logical from consistent snapshot
+  Snapshot 1 version 1
+  Snapshot 1 tables  1
+  Snapshot 2 type    logical from locked tables
+  Snapshot 2 version 1
+  Snapshot 2 tables  1
+
+Catalog summary:
+
+  Databases:              3
+  Tables:                 9
+  Other per db objects:   63
+
+Catalog details:
+
+  Tablespace 'mysqltest_ts1'
+  Tablespace 'mysqltest_ts2'
+  Database  'mysqltest1'
+    Table     'mysqltest1'.'t1'
+    Table     'mysqltest1'.'t2'
+    Table     'mysqltest1'.'t3'
+    Sproc     'mysqltest1'.'p1'
+    Sproc     'mysqltest1'.'p2'
+    Sfunc     'mysqltest1'.'f1'
+    Sfunc     'mysqltest1'.'f2'
+    View      'mysqltest1'.'v1'
+    View      'mysqltest1'.'v2'
+    Event     'mysqltest1'.'e1'
+    Event     'mysqltest1'.'e2'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030'
+  Database  'mysqltest2'
+    Table     'mysqltest2'.'t1'
+    Table     'mysqltest2'.'t2'
+    Table     'mysqltest2'.'t3'
+    Sproc     'mysqltest2'.'p1'
+    Sproc     'mysqltest2'.'p2'
+    View      'mysqltest2'.'v1'
+    View      'mysqltest2'.'v2'
+    Event     'mysqltest2'.'e1'
+    Event     'mysqltest2'.'e2'
+    Trigger   'mysqltest2'.'r1'
+    Trigger   'mysqltest2'.'r2'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025'
+  Database  'mysqltest3'
+    Table     'mysqltest3'.'t1'
+    Table     'mysqltest3'.'t2'
+    Table     'mysqltest3'.'t3'
+    Sfunc     'mysqltest3'.'f1'
+    Sfunc     'mysqltest3'.'f2'
+    View      'mysqltest3'.'v1'
+    View      'mysqltest3'.'v2'
+    Trigger   'mysqltest3'.'r1'
+    Trigger   'mysqltest3'.'r2'
+
+Meta data:
+
+  Tablespace 'mysqltest_ts1' statement: 'CREATE TABLESPACE `mysqltest_ts1` ADD DATAFILE 'mysqltest_ts1.dat' COMMENT = 'test tablespace backup 1' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts1' extra data length: 0
+
+  Tablespace 'mysqltest_ts2' statement: 'CREATE TABLESPACE `mysqltest_ts2` ADD DATAFILE 'mysqltest_ts2.dat' COMMENT = 'test tablespace backup 2' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts2' extra data length: 0
+
+  Database 'mysqltest1' statement: 'CREATE DATABASE `mysqltest1` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest1' extra data length: 0
+
+    Table 'mysqltest1'.'t1' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(30000) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t1' extra data length: 0
+
+    Table 'mysqltest1'.'t2' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t2' extra data length: 0
+
+    Table 'mysqltest1'.'t3' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t3' extra data length: 0
+
+    Sproc 'mysqltest1'.'p1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest1.t1 SET c2='from mysqltest1.p1';
+END'
+    Sproc 'mysqltest1'.'p1' extra data length: 0
+
+    Sproc 'mysqltest1'.'p2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest1.t2 SET c2='from mysqltest1.p2';
+END'
+    Sproc 'mysqltest1'.'p2' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 11;
+END'
+    Sfunc 'mysqltest1'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 12;
+END'
+    Sfunc 'mysqltest1'.'f2' extra data length: 0
+
+    View 'mysqltest1'.'v1' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v1` AS select `mysqltest1`.`t1`.`c1` AS `c1`,`mysqltest1`.`t1`.`c2` AS `c2`,`mysqltest1`.`t1`.`c1` in (select (`mysqltest1`.`t1`.`c1` + 2) AS `c1+2` from `mysqltest1`.`t1`) AS `c3`,`mysqltest1`.`t1`.`c1` = all (select `mysqltest1`.`t1`.`c1` AS `c1` from `mysqltest1`.`t1`) AS `c4` from `mysqltest1`.`t1`'
+    View 'mysqltest1'.'v1' extra data length: 0
+
+    View 'mysqltest1'.'v2' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v2` AS select `v1`.`c2` AS `c2`,`v1`.`c3` AS `c3` from `mysqltest1`.`v1`'
+    View 'mysqltest1'.'v2' extra data length: 0
+
+    Event 'mysqltest1'.'e1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t1 WHERE c1 > 100'
+    Event 'mysqltest1'.'e1' extra data length: 0
+
+    Event 'mysqltest1'.'e2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t2 WHERE c1 > 100'
+    Event 'mysqltest1'.'e2' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest1.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest1.* TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' statement: 'GRANT SELECT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' statement: 'GRANT INSERT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' statement: 'GRANT UPDATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' statement: 'GRANT DELETE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' statement: 'GRANT CREATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' statement: 'GRANT DROP ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' statement: 'GRANT REFERENCES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' statement: 'GRANT INDEX ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' statement: 'GRANT ALTER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' statement: 'GRANT LOCK TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' statement: 'GRANT EXECUTE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' statement: 'GRANT CREATE VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' statement: 'GRANT SHOW VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' statement: 'GRANT CREATE ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' statement: 'GRANT ALTER ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' statement: 'GRANT EVENT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' statement: 'GRANT TRIGGER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' statement: 'GRANT SELECT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' statement: 'GRANT INSERT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' statement: 'GRANT SELECT(c1) ON mysqltest1.t1 TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' extra data length: 0
+
+  Database 'mysqltest2' statement: 'CREATE DATABASE `mysqltest2` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest2' extra data length: 0
+
+    Table 'mysqltest2'.'t1' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t1' extra data length: 0
+
+    Table 'mysqltest2'.'t2' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t2' extra data length: 0
+
+    Table 'mysqltest2'.'t3' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t3' extra data length: 0
+
+    Sproc 'mysqltest2'.'p1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest2.t1 SET c2='from mysqltest2.p1';
+END'
+    Sproc 'mysqltest2'.'p1' extra data length: 0
+
+    Sproc 'mysqltest2'.'p2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest2.t2 SET c2='from mysqltest2.p2';
+END'
+    Sproc 'mysqltest2'.'p2' extra data length: 0
+
+    View 'mysqltest2'.'v1' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v1` AS select connection_id() AS `c1`,pi() AS `c2`,current_user() AS `c3`,version() AS `c4`'
+    View 'mysqltest2'.'v1' extra data length: 0
+
+    View 'mysqltest2'.'v2' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v2` AS select `mysqltest2`.`t2`.`c1` AS `c1`,`mysqltest2`.`t2`.`c2` AS `c2` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`) union all select `mysqltest2`.`t2`.`c1` AS `c3`,`mysqltest2`.`t2`.`c2` AS `c4` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`)'
+    View 'mysqltest2'.'v2' extra data length: 0
+
+    Event 'mysqltest2'.'e1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t1 WHERE c1 > 100'
+    Event 'mysqltest2'.'e1' extra data length: 0
+
+    Event 'mysqltest2'.'e2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t2 WHERE c1 > 100'
+    Event 'mysqltest2'.'e2' extra data length: 0
+
+    Trigger 'mysqltest2'.'r1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r1 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t2 WHERE mysqltest2.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r1' extra data length: 0
+
+    Trigger 'mysqltest2'.'r2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r2 AFTER INSERT ON mysqltest2.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t1 WHERE mysqltest2.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r2' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' statement: 'GRANT UPDATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' statement: 'GRANT DELETE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' statement: 'GRANT CREATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' statement: 'GRANT DROP ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' statement: 'GRANT REFERENCES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' statement: 'GRANT INDEX ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' statement: 'GRANT ALTER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' statement: 'GRANT LOCK TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' statement: 'GRANT EXECUTE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' statement: 'GRANT CREATE VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' statement: 'GRANT SHOW VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' statement: 'GRANT CREATE ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' statement: 'GRANT ALTER ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' statement: 'GRANT EVENT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' statement: 'GRANT TRIGGER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' extra data length: 0
+
+  Database 'mysqltest3' statement: 'CREATE DATABASE `mysqltest3` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest3' extra data length: 0
+
+    Table 'mysqltest3'.'t1' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t1' extra data length: 0
+
+    Table 'mysqltest3'.'t2' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t2' extra data length: 0
+
+    Table 'mysqltest3'.'t3' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts2` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t3' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 31;
+END'
+    Sfunc 'mysqltest3'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 32;
+END'
+    Sfunc 'mysqltest3'.'f2' extra data length: 0
+
+    View 'mysqltest3'.'v1' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v1` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` join `mysqltest2`.`v2`) where (`v1`.`c1` = `v2`.`c1`)'
+    View 'mysqltest3'.'v1' extra data length: 0
+
+    View 'mysqltest3'.'v2' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v2` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` left join `mysqltest2`.`v2` on((`v1`.`c1` = `v2`.`c1`)))'
+    View 'mysqltest3'.'v2' extra data length: 0
+
+    Trigger 'mysqltest3'.'r1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r1 AFTER INSERT ON mysqltest3.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t2 WHERE mysqltest3.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r1' extra data length: 0
+
+    Trigger 'mysqltest3'.'r2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r2 AFTER INSERT ON mysqltest3.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t1 WHERE mysqltest3.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r2' extra data length: 0
+
+Data totals:
+
+  Snapshot 0 has 939 KB for table 'mysqltest1'.'t1'
+  Snapshot 1 has 937 KB for table 'mysqltest1'.'t2'
+  Snapshot 2 has 937 KB for table 'mysqltest1'.'t3'
+  Snapshot 1 has 937 KB for table 'mysqltest2'.'t1'
+  Snapshot 2 has 937 KB for table 'mysqltest2'.'t2'
+  Snapshot 0 has 938 KB for table 'mysqltest2'.'t3'
+  Snapshot 2 has 937 KB for table 'mysqltest3'.'t1'
+  Snapshot 0 has 938 KB for table 'mysqltest3'.'t2'
+  Snapshot 1 has 937 KB for table 'mysqltest3'.'t3'
+
+Summary:
+
+Creation time: #
+Validity time: #
+Finish   time: #
+No binlog information
+========^^^^^^^^========
+
+Full set of most relevant information plus snapshots, verbosely:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+Backup image chrset: 'utf8'
+Snapshot count:      3
+
+Snapshots:
+
+  Snapshot 0 type    native from 'MyISAM'  version 1.0
+  Snapshot 0 version 1
+  Snapshot 0 tables  1
+  Snapshot 1 type    logical from consistent snapshot
+  Snapshot 1 version 1
+  Snapshot 1 tables  1
+  Snapshot 2 type    logical from locked tables
+  Snapshot 2 version 1
+  Snapshot 2 tables  1
+
+Catalog summary:
+
+  Character sets:         0
+  Databases:              3
+  Tables:                 9
+  Other per db objects:   63
+
+Catalog details:
+
+  Tablespace 'mysqltest_ts1'
+  Tablespace 'mysqltest_ts2'
+  Database  'mysqltest1'
+    Table     'mysqltest1'.'t1'
+    Table     'mysqltest1'.'t2'
+    Table     'mysqltest1'.'t3'
+    Sproc     'mysqltest1'.'p1'
+    Sproc     'mysqltest1'.'p2'
+    Sfunc     'mysqltest1'.'f1'
+    Sfunc     'mysqltest1'.'f2'
+    View      'mysqltest1'.'v1'
+    View      'mysqltest1'.'v2'
+    Event     'mysqltest1'.'e1'
+    Event     'mysqltest1'.'e2'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030'
+  Database  'mysqltest2'
+    Table     'mysqltest2'.'t1'
+    Table     'mysqltest2'.'t2'
+    Table     'mysqltest2'.'t3'
+    Sproc     'mysqltest2'.'p1'
+    Sproc     'mysqltest2'.'p2'
+    View      'mysqltest2'.'v1'
+    View      'mysqltest2'.'v2'
+    Event     'mysqltest2'.'e1'
+    Event     'mysqltest2'.'e2'
+    Trigger   'mysqltest2'.'r1'
+    Trigger   'mysqltest2'.'r2'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025'
+  Database  'mysqltest3'
+    Table     'mysqltest3'.'t1'
+    Table     'mysqltest3'.'t2'
+    Table     'mysqltest3'.'t3'
+    Sfunc     'mysqltest3'.'f1'
+    Sfunc     'mysqltest3'.'f2'
+    View      'mysqltest3'.'v1'
+    View      'mysqltest3'.'v2'
+    Trigger   'mysqltest3'.'r1'
+    Trigger   'mysqltest3'.'r2'
+
+Meta data:
+
+  Tablespace 'mysqltest_ts1' statement: 'CREATE TABLESPACE `mysqltest_ts1` ADD DATAFILE 'mysqltest_ts1.dat' COMMENT = 'test tablespace backup 1' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts1' extra data length: 0
+
+  Tablespace 'mysqltest_ts2' statement: 'CREATE TABLESPACE `mysqltest_ts2` ADD DATAFILE 'mysqltest_ts2.dat' COMMENT = 'test tablespace backup 2' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts2' extra data length: 0
+
+  Database 'mysqltest1' statement: 'CREATE DATABASE `mysqltest1` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest1' extra data length: 0
+
+    Table 'mysqltest1'.'t1' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(30000) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t1' extra data length: 0
+
+    Table 'mysqltest1'.'t2' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t2' extra data length: 0
+
+    Table 'mysqltest1'.'t3' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t3' extra data length: 0
+
+    Sproc 'mysqltest1'.'p1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest1.t1 SET c2='from mysqltest1.p1';
+END'
+    Sproc 'mysqltest1'.'p1' extra data length: 0
+
+    Sproc 'mysqltest1'.'p2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest1.t2 SET c2='from mysqltest1.p2';
+END'
+    Sproc 'mysqltest1'.'p2' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 11;
+END'
+    Sfunc 'mysqltest1'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 12;
+END'
+    Sfunc 'mysqltest1'.'f2' extra data length: 0
+
+    View 'mysqltest1'.'v1' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v1` AS select `mysqltest1`.`t1`.`c1` AS `c1`,`mysqltest1`.`t1`.`c2` AS `c2`,`mysqltest1`.`t1`.`c1` in (select (`mysqltest1`.`t1`.`c1` + 2) AS `c1+2` from `mysqltest1`.`t1`) AS `c3`,`mysqltest1`.`t1`.`c1` = all (select `mysqltest1`.`t1`.`c1` AS `c1` from `mysqltest1`.`t1`) AS `c4` from `mysqltest1`.`t1`'
+    View 'mysqltest1'.'v1' extra data length: 0
+
+    View 'mysqltest1'.'v2' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v2` AS select `v1`.`c2` AS `c2`,`v1`.`c3` AS `c3` from `mysqltest1`.`v1`'
+    View 'mysqltest1'.'v2' extra data length: 0
+
+    Event 'mysqltest1'.'e1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t1 WHERE c1 > 100'
+    Event 'mysqltest1'.'e1' extra data length: 0
+
+    Event 'mysqltest1'.'e2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t2 WHERE c1 > 100'
+    Event 'mysqltest1'.'e2' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest1.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest1.* TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' statement: 'GRANT SELECT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' statement: 'GRANT INSERT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' statement: 'GRANT UPDATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' statement: 'GRANT DELETE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' statement: 'GRANT CREATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' statement: 'GRANT DROP ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' statement: 'GRANT REFERENCES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' statement: 'GRANT INDEX ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' statement: 'GRANT ALTER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' statement: 'GRANT LOCK TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' statement: 'GRANT EXECUTE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' statement: 'GRANT CREATE VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' statement: 'GRANT SHOW VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' statement: 'GRANT CREATE ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' statement: 'GRANT ALTER ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' statement: 'GRANT EVENT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' statement: 'GRANT TRIGGER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' statement: 'GRANT SELECT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' statement: 'GRANT INSERT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' statement: 'GRANT SELECT(c1) ON mysqltest1.t1 TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' extra data length: 0
+
+  Database 'mysqltest2' statement: 'CREATE DATABASE `mysqltest2` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest2' extra data length: 0
+
+    Table 'mysqltest2'.'t1' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t1' extra data length: 0
+
+    Table 'mysqltest2'.'t2' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t2' extra data length: 0
+
+    Table 'mysqltest2'.'t3' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t3' extra data length: 0
+
+    Sproc 'mysqltest2'.'p1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest2.t1 SET c2='from mysqltest2.p1';
+END'
+    Sproc 'mysqltest2'.'p1' extra data length: 0
+
+    Sproc 'mysqltest2'.'p2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest2.t2 SET c2='from mysqltest2.p2';
+END'
+    Sproc 'mysqltest2'.'p2' extra data length: 0
+
+    View 'mysqltest2'.'v1' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v1` AS select connection_id() AS `c1`,pi() AS `c2`,current_user() AS `c3`,version() AS `c4`'
+    View 'mysqltest2'.'v1' extra data length: 0
+
+    View 'mysqltest2'.'v2' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v2` AS select `mysqltest2`.`t2`.`c1` AS `c1`,`mysqltest2`.`t2`.`c2` AS `c2` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`) union all select `mysqltest2`.`t2`.`c1` AS `c3`,`mysqltest2`.`t2`.`c2` AS `c4` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`)'
+    View 'mysqltest2'.'v2' extra data length: 0
+
+    Event 'mysqltest2'.'e1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t1 WHERE c1 > 100'
+    Event 'mysqltest2'.'e1' extra data length: 0
+
+    Event 'mysqltest2'.'e2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t2 WHERE c1 > 100'
+    Event 'mysqltest2'.'e2' extra data length: 0
+
+    Trigger 'mysqltest2'.'r1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r1 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t2 WHERE mysqltest2.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r1' extra data length: 0
+
+    Trigger 'mysqltest2'.'r2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r2 AFTER INSERT ON mysqltest2.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t1 WHERE mysqltest2.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r2' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' statement: 'GRANT UPDATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' statement: 'GRANT DELETE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' statement: 'GRANT CREATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' statement: 'GRANT DROP ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' statement: 'GRANT REFERENCES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' statement: 'GRANT INDEX ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' statement: 'GRANT ALTER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' statement: 'GRANT LOCK TABLES ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' statement: 'GRANT EXECUTE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' statement: 'GRANT CREATE VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' statement: 'GRANT SHOW VIEW ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' statement: 'GRANT CREATE ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' statement: 'GRANT ALTER ROUTINE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' statement: 'GRANT EVENT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' statement: 'GRANT TRIGGER ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025' extra data length: 0
+
+  Database 'mysqltest3' statement: 'CREATE DATABASE `mysqltest3` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest3' extra data length: 0
+
+    Table 'mysqltest3'.'t1' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t1' extra data length: 0
+
+    Table 'mysqltest3'.'t2' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t2' extra data length: 0
+
+    Table 'mysqltest3'.'t3' statement: 'USE `mysqltest3`; CREATE TABLE `mysqltest3`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts2` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest3'.'t3' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 31;
+END'
+    Sfunc 'mysqltest3'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest3'.'f2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 32;
+END'
+    Sfunc 'mysqltest3'.'f2' extra data length: 0
+
+    View 'mysqltest3'.'v1' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v1` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` join `mysqltest2`.`v2`) where (`v1`.`c1` = `v2`.`c1`)'
+    View 'mysqltest3'.'v1' extra data length: 0
+
+    View 'mysqltest3'.'v2' statement: 'USE `mysqltest3`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v2` AS select `v1`.`c1` AS `c1`,`v2`.`c1` AS `c2` from (`mysqltest1`.`v1` left join `mysqltest2`.`v2` on((`v1`.`c1` = `v2`.`c1`)))'
+    View 'mysqltest3'.'v2' extra data length: 0
+
+    Trigger 'mysqltest3'.'r1' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r1 AFTER INSERT ON mysqltest3.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t2 WHERE mysqltest3.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r1' extra data length: 0
+
+    Trigger 'mysqltest3'.'r2' statement: 'USE `mysqltest3`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest3.r2 AFTER INSERT ON mysqltest3.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest3.t1 WHERE mysqltest3.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest3'.'r2' extra data length: 0
+
+Data totals:
+
+  Snapshot 0 has 939 KB for table 'mysqltest1'.'t1'
+  Snapshot 1 has 937 KB for table 'mysqltest1'.'t2'
+  Snapshot 2 has 937 KB for table 'mysqltest1'.'t3'
+  Snapshot 1 has 937 KB for table 'mysqltest2'.'t1'
+  Snapshot 2 has 937 KB for table 'mysqltest2'.'t2'
+  Snapshot 0 has 938 KB for table 'mysqltest2'.'t3'
+  Snapshot 2 has 937 KB for table 'mysqltest3'.'t1'
+  Snapshot 0 has 938 KB for table 'mysqltest3'.'t2'
+  Snapshot 1 has 937 KB for table 'mysqltest3'.'t3'
+
+Summary:
+
+Creation time: #
+Validity time: #
+Finish   time: #
+No binlog information
+========^^^^^^^^========
+
+Full set of most relevant information plus data chunks:
+========vvvvvvvv========
+
+Image path: #
+Image size: #
+Image compression:   none
+Image version:       1
+Creation time: #
+Server version: #
+Server byte order:   little-endian
+Server charset:      'utf8'
+
+Catalog summary:
+
+  Databases:              3
+  Tables:                 9
+  Other per db objects:   63
+
+Catalog details:
+
+  Tablespace 'mysqltest_ts1'
+  Tablespace 'mysqltest_ts2'
+  Database  'mysqltest1'
+    Table     'mysqltest1'.'t1'
+    Table     'mysqltest1'.'t2'
+    Table     'mysqltest1'.'t3'
+    Sproc     'mysqltest1'.'p1'
+    Sproc     'mysqltest1'.'p2'
+    Sfunc     'mysqltest1'.'f1'
+    Sfunc     'mysqltest1'.'f2'
+    View      'mysqltest1'.'v1'
+    View      'mysqltest1'.'v2'
+    Event     'mysqltest1'.'e1'
+    Event     'mysqltest1'.'e2'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026'
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028'
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029'
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030'
+  Database  'mysqltest2'
+    Table     'mysqltest2'.'t1'
+    Table     'mysqltest2'.'t2'
+    Table     'mysqltest2'.'t3'
+    Sproc     'mysqltest2'.'p1'
+    Sproc     'mysqltest2'.'p2'
+    View      'mysqltest2'.'v1'
+    View      'mysqltest2'.'v2'
+    Event     'mysqltest2'.'e1'
+    Event     'mysqltest2'.'e2'
+    Trigger   'mysqltest2'.'r1'
+    Trigger   'mysqltest2'.'r2'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000012'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000013'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000014'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000015'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000016'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000017'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000018'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000019'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000020'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000021'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000022'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000023'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000024'
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000025'
+  Database  'mysqltest3'
+    Table     'mysqltest3'.'t1'
+    Table     'mysqltest3'.'t2'
+    Table     'mysqltest3'.'t3'
+    Sfunc     'mysqltest3'.'f1'
+    Sfunc     'mysqltest3'.'f2'
+    View      'mysqltest3'.'v1'
+    View      'mysqltest3'.'v2'
+    Trigger   'mysqltest3'.'r1'
+    Trigger   'mysqltest3'.'r2'
+
+Meta data:
+
+  Tablespace 'mysqltest_ts1' statement: 'CREATE TABLESPACE `mysqltest_ts1` ADD DATAFILE 'mysqltest_ts1.dat' COMMENT = 'test tablespace backup 1' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts1' extra data length: 0
+
+  Tablespace 'mysqltest_ts2' statement: 'CREATE TABLESPACE `mysqltest_ts2` ADD DATAFILE 'mysqltest_ts2.dat' COMMENT = 'test tablespace backup 2' ENGINE=Falcon'
+  Tablespace 'mysqltest_ts2' extra data length: 0
+
+  Database 'mysqltest1' statement: 'CREATE DATABASE `mysqltest1` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest1' extra data length: 0
+
+    Table 'mysqltest1'.'t1' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(30000) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t1' extra data length: 0
+
+    Table 'mysqltest1'.'t2' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t2' extra data length: 0
+
+    Table 'mysqltest1'.'t3' statement: 'USE `mysqltest1`; CREATE TABLE `mysqltest1`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest1'.'t3' extra data length: 0
+
+    Sproc 'mysqltest1'.'p1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest1.t1 SET c2='from mysqltest1.p1';
+END'
+    Sproc 'mysqltest1'.'p1' extra data length: 0
+
+    Sproc 'mysqltest1'.'p2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest1.t2 SET c2='from mysqltest1.p2';
+END'
+    Sproc 'mysqltest1'.'p2' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 11;
+END'
+    Sfunc 'mysqltest1'.'f1' extra data length: 0
+
+    Sfunc 'mysqltest1'.'f2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(arg1 INT) RETURNS int(11)
+BEGIN
+RETURN arg1 * 12;
+END'
+    Sfunc 'mysqltest1'.'f2' extra data length: 0
+
+    View 'mysqltest1'.'v1' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v1` AS select `mysqltest1`.`t1`.`c1` AS `c1`,`mysqltest1`.`t1`.`c2` AS `c2`,`mysqltest1`.`t1`.`c1` in (select (`mysqltest1`.`t1`.`c1` + 2) AS `c1+2` from `mysqltest1`.`t1`) AS `c3`,`mysqltest1`.`t1`.`c1` = all (select `mysqltest1`.`t1`.`c1` AS `c1` from `mysqltest1`.`t1`) AS `c4` from `mysqltest1`.`t1`'
+    View 'mysqltest1'.'v1' extra data length: 0
+
+    View 'mysqltest1'.'v2' statement: 'USE `mysqltest1`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v2` AS select `v1`.`c2` AS `c2`,`v1`.`c3` AS `c3` from `mysqltest1`.`v1`'
+    View 'mysqltest1'.'v2' extra data length: 0
+
+    Event 'mysqltest1'.'e1' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t1 WHERE c1 > 100'
+    Event 'mysqltest1'.'e1' extra data length: 0
+
+    Event 'mysqltest1'.'e2' statement: 'USE `mysqltest1`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest1.t2 WHERE c1 > 100'
+    Event 'mysqltest1'.'e2' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest1.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest1.* TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' statement: 'GRANT SELECT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' statement: 'GRANT INSERT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000011' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' statement: 'GRANT UPDATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000012' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' statement: 'GRANT DELETE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000013' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' statement: 'GRANT CREATE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000014' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' statement: 'GRANT DROP ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000015' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' statement: 'GRANT REFERENCES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000016' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' statement: 'GRANT INDEX ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000017' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' statement: 'GRANT ALTER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000018' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' statement: 'GRANT CREATE TEMPORARY TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000019' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' statement: 'GRANT LOCK TABLES ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000020' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' statement: 'GRANT EXECUTE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000021' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' statement: 'GRANT CREATE VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000022' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' statement: 'GRANT SHOW VIEW ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000023' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' statement: 'GRANT CREATE ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000024' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' statement: 'GRANT ALTER ROUTINE ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000025' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' statement: 'GRANT EVENT ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000026' extra data length: 0
+
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' statement: 'GRANT TRIGGER ON mysqltest1.* TO 'no_user'@'%''
+    Privilege 'mysqltest1'.''no_user'@'%' 00000027' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' statement: 'GRANT SELECT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000028' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' statement: 'GRANT INSERT(c2) ON mysqltest1.t2 TO 'bup_user2'@'%''
+    Privilege 'mysqltest1'.''bup_user2'@'%' 00000029' extra data length: 0
+
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' statement: 'GRANT SELECT(c1) ON mysqltest1.t1 TO 'bup_user1'@'%''
+    Privilege 'mysqltest1'.''bup_user1'@'%' 00000030' extra data length: 0
+
+  Database 'mysqltest2' statement: 'CREATE DATABASE `mysqltest2` DEFAULT CHARACTER SET latin1'
+  Database 'mysqltest2' extra data length: 0
+
+    Table 'mysqltest2'.'t1' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t1` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) /*!50100 TABLESPACE `mysqltest_ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t1' extra data length: 0
+
+    Table 'mysqltest2'.'t2' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t2` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t2' extra data length: 0
+
+    Table 'mysqltest2'.'t3' statement: 'USE `mysqltest2`; CREATE TABLE `mysqltest2`.`t3` (
+  `c1` int(11) NOT NULL DEFAULT '0',
+  `c2` varchar(30000) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1'
+    Table 'mysqltest2'.'t3' extra data length: 0
+
+    Sproc 'mysqltest2'.'p1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+UPDATE mysqltest2.t1 SET c2='from mysqltest2.p1';
+END'
+    Sproc 'mysqltest2'.'p1' extra data length: 0
+
+    Sproc 'mysqltest2'.'p2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`()
+BEGIN
+UPDATE mysqltest2.t2 SET c2='from mysqltest2.p2';
+END'
+    Sproc 'mysqltest2'.'p2' extra data length: 0
+
+    View 'mysqltest2'.'v1' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v1` AS select connection_id() AS `c1`,pi() AS `c2`,current_user() AS `c3`,version() AS `c4`'
+    View 'mysqltest2'.'v1' extra data length: 0
+
+    View 'mysqltest2'.'v2' statement: 'USE `mysqltest2`; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v2` AS select `mysqltest2`.`t2`.`c1` AS `c1`,`mysqltest2`.`t2`.`c2` AS `c2` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`) union all select `mysqltest2`.`t2`.`c1` AS `c3`,`mysqltest2`.`t2`.`c2` AS `c4` from (`mysqltest2`.`t2` join `mysqltest2`.`t3`)'
+    View 'mysqltest2'.'v2' extra data length: 0
+
+    Event 'mysqltest2'.'e1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t1 WHERE c1 > 100'
+    Event 'mysqltest2'.'e1' extra data length: 0
+
+    Event 'mysqltest2'.'e2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET TIME_ZONE = 'SYSTEM'; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE EVENT `e2` ON SCHEDULE EVERY 1 YEAR STARTS 'yyyy-mm-dd HH:MM:SS' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM mysqltest2.t2 WHERE c1 > 100'
+    Event 'mysqltest2'.'e2' extra data length: 0
+
+    Trigger 'mysqltest2'.'r1' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r1 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t2 WHERE mysqltest2.t2.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r1' extra data length: 0
+
+    Trigger 'mysqltest2'.'r2' statement: 'USE `mysqltest2`; SET SQL_MODE = ''; SET CHARACTER_SET_CLIENT = 'latin1'; SET COLLATION_CONNECTION = 'latin1_swedish_ci'; SET COLLATION_DATABASE = 'latin1_swedish_ci'; CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.r2 AFTER INSERT ON mysqltest2.t2 FOR EACH ROW
+BEGIN
+DELETE FROM mysqltest2.t1 WHERE mysqltest2.t1.c1=NEW.c1;
+END'
+    Trigger 'mysqltest2'.'r2' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' statement: 'GRANT SELECT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000008' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' statement: 'GRANT INSERT ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000009' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' statement: 'GRANT UPDATE ON mysqltest2.* TO 'bup_user1'@'%''
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000010' extra data length: 0
+
+    Privilege 'mysqltest2'.''bup_user1'@'%' 00000011' statement: 'GRANT DELETE ON mysql