Below is the list of changes that have just been committed into a local
6.0 repository of rafal. When rafal does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-02-18 13:04:28+01:00, rafal@quant.(none) +15 -0
WL#4212 (Online Backup : Kernel updates for object metadata changes)
This is second patch in the series. It adds missing error messages and code for reporting
errors in all places where they are currently detected.
mysql-test/r/backup_errors.result@stripped, 2008-02-18 13:04:22+01:00, rafal@quant.(none) +3 -3
Update wrt slight changes in error reporting in the kernel.
mysql-test/t/backup_errors.test@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +1 -1
We now have better error informing about malformed file path.
sql/backup/api_types.h@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +1 -1
Print quotes around database/table names.
sql/backup/backup_kernel.h@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +28 -0
Add fatal_error() covenience function.
sql/backup/be_native.h@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +11 -7
Add error logger as a parameter when constructing Snaphot_info derived classes.
sql/backup/catalog.cc@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +0 -170
- Image_info methods for manipulating catalogue don't report errors - they must be reported
by the caller.
- Implementation of catalogue services moved to kernel.cc
sql/backup/catalog.h@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +39 -2
- Added Image_info::Obj::describe() method for reporting purposes.
- Added methods creating catalogue iterators.
sql/backup/data_backup.cc@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +7 -7
Moved "bp_vp_state" breakpoint to more appropriate place.
sql/backup/kernel.cc@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +272 -71
- Fix error messages in all places where we need to report one.
- Moved here implementation of iterator catalogue services from catalog.cc.
- When sending error at the end of BACKUP/RESTORE operation, report end of operation only if
it has been started.
sql/backup/logger.cc@stripped, 2008-02-18 13:04:24+01:00, rafal@quant.(none) +6 -0
Added note to Logger::write_message() documentation.
sql/backup/logger.h@stripped, 2008-02-18 13:04:24+01:00, rafal@quant.(none) +14 -1
- Updated documentation.
- Added destructor.
- Moved "bp_starting_state" breakpoint here.
sql/backup/stream.cc@stripped, 2008-02-18 13:04:24+01:00, rafal@quant.(none) +53 -45
Refactored stream initialization code into init() method to be shared in open() and rewind().
sql/backup/stream.h@stripped, 2008-02-18 13:04:24+01:00, rafal@quant.(none) +2 -0
Added init() method to I/OStream classes.
sql/mysqld.cc@stripped, 2008-02-18 13:04:23+01:00, rafal@quant.(none) +6 -0
Add online backup initialization and shutdown functions.
sql/share/errmsg.txt@stripped, 2008-02-18 13:04:24+01:00, rafal@quant.(none) +55 -11
- Reformulate some error messages to adapt them to current terminology.
- Added new error mesages for online backup.
diff -Nrup a/mysql-test/r/backup_errors.result b/mysql-test/r/backup_errors.result
--- a/mysql-test/r/backup_errors.result 2008-02-06 18:26:46 +01:00
+++ b/mysql-test/r/backup_errors.result 2008-02-18 13:04:22 +01:00
@@ -6,7 +6,7 @@ CREATE DATABASE adb;
CREATE DATABASE bdb;
CREATE TABLE bdb.t1(a int) ENGINE=MEMORY;
BACKUP DATABASE adb TO '';
-ERROR HY000: Invalid backup location ''
+ERROR HY000: Malformed file path ''
BACKUP DATABASE adb TO "bdb/t1.frm";
ERROR HY000: Can't write to backup location 'bdb/t1.frm' (file already exists?)
BACKUP DATABASE adb TO "test.bak";
@@ -79,7 +79,7 @@ ERROR 42S02: Table 'mysql.online_backup'
SHOW ERRORS;
Level Code Message
Error 1146 Table 'mysql.online_backup' doesn't exist
-Error 1651 Can't open the online backup progress tables. Check 'mysql.online_backup' and 'mysql.online_backup_progress'.
+Error 1675 Cannot create backup/restore execution context
Restoring the table
CREATE TABLE mysql.online_backup LIKE test.ob_copy;
DROP TABLE test.ob_copy;
@@ -90,7 +90,7 @@ ERROR 42S02: Table 'mysql.online_backup_
SHOW ERRORS;
Level Code Message
Error 1146 Table 'mysql.online_backup_progress' doesn't exist
-Error 1651 Can't open the online backup progress tables. Check 'mysql.online_backup' and 'mysql.online_backup_progress'.
+Error 1675 Cannot create backup/restore execution context
Restoring the table
CREATE TABLE mysql.online_backup_progress LIKE test.obp_copy;
DROP TABLE test.obp_copy;
diff -Nrup a/mysql-test/t/backup_errors.test b/mysql-test/t/backup_errors.test
--- a/mysql-test/t/backup_errors.test 2008-02-06 17:26:39 +01:00
+++ b/mysql-test/t/backup_errors.test 2008-02-18 13:04:23 +01:00
@@ -21,7 +21,7 @@ CREATE DATABASE bdb;
CREATE TABLE bdb.t1(a int) ENGINE=MEMORY;
# invalid location
---error ER_BACKUP_INVALID_LOC
+--error ER_BAD_PATH
BACKUP DATABASE adb TO '';
# don't overwrite existing files
diff -Nrup a/sql/backup/api_types.h b/sql/backup/api_types.h
--- a/sql/backup/api_types.h 2008-02-12 18:17:50 +01:00
+++ b/sql/backup/api_types.h 2008-02-18 13:04:23 +01:00
@@ -132,7 +132,7 @@ class Table_ref
/// Produce string identifying the table (e.g. for error reporting)
const char* describe(char *buf, size_t len) const
{
- my_snprintf(buf,len,"%s.%s",db().name().ptr(),name().ptr());
+ my_snprintf(buf,len,"`%s`.`%s`",db().name().ptr(),name().ptr());
return buf;
}
diff -Nrup a/sql/backup/backup_kernel.h b/sql/backup/backup_kernel.h
--- a/sql/backup/backup_kernel.h 2008-02-12 18:17:50 +01:00
+++ b/sql/backup/backup_kernel.h 2008-02-18 13:04:23 +01:00
@@ -72,6 +72,7 @@ class Backup_restore_ctx: public backup:
int do_backup();
int do_restore();
+ int fatal_error(int, ...);
int close();
@@ -135,6 +136,33 @@ inline
void Backup_restore_ctx::disable_fkey_constraints()
{
m_thd->options|= OPTION_NO_FOREIGN_KEY_CHECKS;
+}
+
+/**
+ Report error and move context object into error state.
+
+ After this method is called the context object is in error state and
+ cannot be normally used. It still can be examined for saved error messages.
+ The code of the error reported here is saved in m_error member.
+
+ When called multiple time, later calls overwrite error code saved by
+ the previous ones.
+
+ @returns error code given as input.
+ */
+inline
+int Backup_restore_ctx::fatal_error(int error_code, ...)
+{
+ va_list args;
+
+ m_error= error_code;
+ m_remove_loc= TRUE;
+
+ va_start(args,error_code);
+ v_report_error(backup::log_level::ERROR, error_code, args);
+ va_end(args);
+
+ return error_code;
}
/**
diff -Nrup a/sql/backup/be_native.h b/sql/backup/be_native.h
--- a/sql/backup/be_native.h 2008-02-12 18:17:50 +01:00
+++ b/sql/backup/be_native.h 2008-02-18 13:04:23 +01:00
@@ -18,18 +18,18 @@ class Native_snapshot: public Snapshot_i
public:
- Native_snapshot(const storage_engine_ref se):
+ Native_snapshot(Logger &log, const storage_engine_ref se):
Snapshot_info(0), m_hton(NULL), m_be(NULL)
{
- init(se);
+ init(log, se);
if (m_be)
m_version= m_be->version();
}
- Native_snapshot(const version_t ver, const storage_engine_ref se):
+ Native_snapshot(Logger &log, const version_t ver, const storage_engine_ref se):
Snapshot_info(ver), m_hton(NULL), m_be(NULL)
{
- init(se);
+ init(log, se);
}
~Native_snapshot()
@@ -73,18 +73,22 @@ class Native_snapshot: public Snapshot_i
private:
- int init(const storage_engine_ref se);
+ int init(Logger &log, const storage_engine_ref se);
};
inline
-int Native_snapshot::init(const storage_engine_ref se)
+int Native_snapshot::init(Logger &log, const storage_engine_ref se)
{
+ DBUG_ASSERT(se);
+
m_hton= se_hton(se);
m_se_ver= se_version(se);
DBUG_ASSERT(m_hton);
DBUG_ASSERT(m_hton->get_backup_engine);
+ m_name= ::ha_resolve_storage_engine_name(m_hton);
+
result_t ret= m_hton->get_backup_engine(const_cast<handlerton*>(m_hton), m_be);
if (ret != OK || !m_be)
@@ -92,10 +96,10 @@ int Native_snapshot::init(const storage_
if (m_be)
m_be->free();
m_be= NULL;
+ log.report_error(ER_BACKUP_CREATE_BE,m_name);
return 1;
}
- m_name= ::ha_resolve_storage_engine_name(m_hton);
return 0;
}
diff -Nrup a/sql/backup/catalog.cc b/sql/backup/catalog.cc
--- a/sql/backup/catalog.cc 2008-02-12 18:17:51 +01:00
+++ b/sql/backup/catalog.cc 2008-02-18 13:04:23 +01:00
@@ -90,16 +90,10 @@ Image_info::add_db(const String &db_name
Db *db= new (&mem_root) Db(db_name);
if (!db)
- {
- // TODO: report error
return NULL;
- }
if (m_dbs.insert(pos,db))
- {
- // TODO: report error
return NULL;
- }
db->base.pos= pos;
@@ -172,22 +166,13 @@ Image_info::add_table(Db &db, const Stri
Table *t= new (&mem_root) Table(db, table_name);
if (!t)
- {
- // TODO: report error
return NULL;
- }
if (snap.add_table(*t, pos))
- {
- // TODO: report error
return NULL;
- }
if (db.add_table(*t))
- {
- // TODO: report error
return NULL;
- }
if (!snap.m_no)
snap.m_no= add_snapshot(snap); // reports errors
@@ -208,18 +193,12 @@ Image_info::Table*
Image_info::get_table(uint snap_no, ulong pos) const
{
if (snap_no > snap_count() || m_snap[snap_no] == NULL)
- {
- // TODO: report error
return NULL;
- }
Table *t= m_snap[snap_no]->get_table(pos);
if (!t)
- {
- // TODO: report error
return NULL;
- }
return t;
}
@@ -252,7 +231,6 @@ Image_info::Obj *find_obj(const Image_in
}
default:
- // TODO: warn or report error
return NULL;
}
}
@@ -260,151 +238,3 @@ Image_info::Obj *find_obj(const Image_in
} // backup namespace
template class Map<uint,backup::Image_info::Db>;
-
-
-/*************************************************
-
- CATALOGUE SERVICES
-
- *************************************************/
-
-/*
- Iterators - used by the backup stream library to enumerate objects to be
- saved in a backup image.
- */
-
-static uint cset_iter; ///< Used to implement trivial charset iterator.
-static uint null_iter; ///< Used to implement trivial empty iterator.
-
-/// Return pointer to an instance of iterator of a given type.
-extern "C"
-void* bcat_iterator_get(st_bstream_image_header *catalogue, unsigned int type)
-{
- switch (type) {
-
- case BSTREAM_IT_PERDB: // per-db objects, except tables
- case BSTREAM_IT_PERTABLE: // per-table objects
- return &null_iter;
-
- case BSTREAM_IT_CHARSET: // character sets
- cset_iter= 0;
- return &cset_iter;
-
- case BSTREAM_IT_USER: // users
- return &null_iter;
-
- case BSTREAM_IT_GLOBAL: // all global objects
- // only global items (for which meta-data is stored) are databases
- case BSTREAM_IT_DB: // all databases
- return
- new backup::Image_info::Db_iterator(*static_cast<backup::Image_info*>(catalogue));
- // TODO: report error if iterator could not be created
-
- default:
- return NULL;
-
- }
-}
-
-/// Return next item pointed by a given iterator and advance it to the next positon.
-extern "C"
-struct st_bstream_item_info*
-bcat_iterator_next(st_bstream_image_header *catalogue, void *iter)
-{
- using namespace backup;
-
- /* If this is the null iterator, return NULL immediately */
- if (iter == &null_iter)
- return NULL;
-
- static bstream_blob name= {NULL, NULL};
-
- /*
- If it is cset iterator then cset_iter variable contains iterator position.
- We return only 2 charsets: the utf8 charset used to encode all strings and
- the default server charset.
- */
- if (iter == &cset_iter)
- {
- switch (cset_iter) {
- case 0: name.begin= (byte*)my_charset_utf8_bin.csname; break;
- case 1: name.begin= (byte*)system_charset_info->csname; break;
- default: name.begin= NULL; break;
- }
-
- name.end= name.begin ? name.begin + strlen((char*)name.begin) : NULL;
- cset_iter++;
-
- return name.begin ? (st_bstream_item_info*)&name : NULL;
- }
-
- /*
- In all other cases assume that iter points at instance of
- @c Image_info::Iterator and use this instance to get next item.
- */
- const Image_info::Obj *ptr= (*(Image_info::Iterator*)iter)++;
-
- return ptr ? (st_bstream_item_info*)(ptr->info()) : NULL;
-}
-
-extern "C"
-void bcat_iterator_free(st_bstream_image_header *catalogue, void *iter)
-{
- /*
- Do nothing for the null and cset iterators, but delete the
- @c Image_info::Iterator object otherwise.
- */
- if (iter == &null_iter)
- return;
-
- if (iter == &cset_iter)
- return;
-
- delete (backup::Image_info::Iterator*)iter;
-}
-
-/* db-items iterator */
-
-/**
- Return pointer to an iterator for iterating over objects inside a given
- database.
- */
-extern "C"
-void* bcat_db_iterator_get(st_bstream_image_header *catalogue, struct st_bstream_db_info *dbi)
-{
- using namespace backup;
-
- DBUG_ASSERT(catalogue);
- DBUG_ASSERT(dbi);
-
- Image_info *info= static_cast<backup::Image_info*>(catalogue);
- Image_info::Db *db = info->get_db(dbi->base.pos);
-
- if (!db)
- {
- // TODO: reprt error
- return NULL;
- }
-
- return new Image_info::DbObj_iterator(*info, *db);
-}
-
-extern "C"
-struct st_bstream_dbitem_info*
-bcat_db_iterator_next(st_bstream_image_header *catalogue,
- struct st_bstream_db_info *db,
- void *iter)
-{
- const backup::Image_info::Obj *ptr= (*(backup::Image_info::Iterator*)iter)++;
-
- return ptr ? (st_bstream_dbitem_info*)ptr->info() : NULL;
-}
-
-extern "C"
-void bcat_db_iterator_free(st_bstream_image_header *catalogue,
- struct st_bstream_db_info *db,
- void *iter)
-{
- delete (backup::Image_info::DbObj_iterator*)iter;
-}
-
diff -Nrup a/sql/backup/catalog.h b/sql/backup/catalog.h
--- a/sql/backup/catalog.h 2008-02-12 18:17:51 +01:00
+++ b/sql/backup/catalog.h 2008-02-18 13:04:23 +01:00
@@ -305,6 +305,8 @@ class Image_info::Obj: public Sql_alloc
*/
virtual ~Obj();
+ obj_type type() const;
+
/**
Returns pointer to @c st_bstream_item_info structure filled with data about
the object.
@@ -321,6 +323,9 @@ class Image_info::Obj: public Sql_alloc
*/
virtual obs::Obj *materialize(uint ver, const String&) =0;
+ typedef Table_ref::describe_buf describe_buf;
+ virtual const char* describe(describe_buf&) const =0;
+
protected:
String m_name; ///< For storing object's name.
@@ -357,6 +362,7 @@ class Image_info::Db
const st_bstream_item_info* info() const;
obs::Obj* materialize(uint ver, const String &sdata);
result_t add_table(Table&);
+ const char* describe(describe_buf&) const;
private:
@@ -394,6 +400,7 @@ class Image_info::Table
const st_bstream_item_info* info() const;
obs::Obj* materialize(uint ver, const String &sdata);
+ const char* describe(Obj::describe_buf&) const;
friend class Db;
friend class DbObj_iterator;
@@ -600,6 +607,18 @@ void Image_info::save_binlog_pos(const :
binlog_pos.file= const_cast<char*>(li.log_file_name);
}
+inline
+Image_info::Db_iterator* Image_info::get_dbs()
+{
+ return new Db_iterator(*this);
+}
+
+inline
+Image_info::DbObj_iterator* Image_info::get_db_objects(const Db &db)
+{
+ return new DbObj_iterator(*this,db);
+}
+
/********************************************************************
Inline members of Image_info::Tables class.
@@ -653,6 +672,11 @@ void Image_info::Obj::store_name(const S
info->name.end= info->name.begin + name.length();
}
+inline
+Image_info::obj_type Image_info::Obj::type() const
+{
+ return info()->type;
+}
/// Implementation of @c Image_info::Obj virtual method.
inline
@@ -670,6 +694,21 @@ const st_bstream_item_info* Image_info::
/// Implementation of @c Image_info::Obj virtual method.
inline
+const char* Image_info::Db::describe(describe_buf &buf) const
+{
+ my_snprintf(buf, sizeof(buf), "`%s`", Obj::m_name.ptr());
+ return buf;
+}
+
+/// Implementation of @c Image_info::Obj virtual method.
+inline
+const char* Image_info::Table::describe(Obj::describe_buf &buf) const
+{
+ return Table_ref::describe(buf);
+}
+
+/// Implementation of @c Image_info::Obj virtual method.
+inline
obs::Obj* Image_info::Db::materialize(uint ver, const String &sdata)
{
return m_obj_ptr= obs::materialize_database(&name(), ver, &sdata);
@@ -805,8 +844,6 @@ namespace backup {
/*
Wrappers around backup stream functions which perform necessary type conversions.
-
- TODO: report errors
*/
inline
diff -Nrup a/sql/backup/data_backup.cc b/sql/backup/data_backup.cc
--- a/sql/backup/data_backup.cc 2008-02-12 18:17:51 +01:00
+++ b/sql/backup/data_backup.cc 2008-02-18 13:04:23 +01:00
@@ -11,6 +11,7 @@
backed up.
@todo Implement better scheduling strategy in Scheduler::step
+ @todo Add error reporting in the scheduler and elsewhere
@todo If an error from driver is ignored (and operation retried) leave trace
of the error in the log.
*/
@@ -599,6 +600,12 @@ int write_table_data(THD* thd, Logger &l
LOG_INFO binlog_pos;
log.report_state(BUP_VALIDITY_POINT);
+ /*
+ This breakpoint is used to assist in testing state changes for
+ the backup progress. It is not to be used to indicate actual
+ timing of the validity point.
+ */
+ BACKUP_BREAKPOINT("bp_vp_state");
/*
Block commits.
@@ -639,13 +646,6 @@ int write_table_data(THD* thd, Logger &l
error= unblock_commits(thd);
if (error)
goto error;
-
- /*
- This breakpoint is used to assist in testing state changes for
- the backup progress. It is not to be used to indicate actual
- timing of the validity point.
- */
- BACKUP_BREAKPOINT("bp_vp_state");
// Report and save information about VP
diff -Nrup a/sql/backup/kernel.cc b/sql/backup/kernel.cc
--- a/sql/backup/kernel.cc 2008-02-12 18:17:51 +01:00
+++ b/sql/backup/kernel.cc 2008-02-18 13:04:23 +01:00
@@ -123,13 +123,10 @@ execute_backup_command(THD *thd, LEX *le
using namespace backup;
- Backup_restore_ctx context(thd);
+ Backup_restore_ctx context(thd); // reports errors
if (!context.is_valid())
- {
- context.report_error(ER_BACKUP_UNKNOWN_ERROR);
- DBUG_RETURN(send_error(context,ER_BACKUP_UNKNOWN_ERROR));
- }
+ DBUG_RETURN(send_error(context,ER_BACKUP_CONTEXT_CREATE));
switch (lex->sql_command) {
@@ -165,11 +162,11 @@ execute_backup_command(THD *thd, LEX *le
info->close(); // close catalogue after filling it with objects to backup
if (res || !info->is_valid())
- DBUG_RETURN(send_error(context,ER_BACKUP_UNKNOWN_ERROR));
+ DBUG_RETURN(send_error(context,ER_BACKUP_BACKUP_PREPARE));
if (info->db_count() == 0)
{
- context.report_error(ER_BACKUP_NOTHING_TO_BACKUP);
+ context.fatal_error(ER_BACKUP_NOTHING_TO_BACKUP);
DBUG_RETURN(send_error(context,ER_BACKUP_NOTHING_TO_BACKUP));
}
@@ -211,7 +208,7 @@ execute_backup_command(THD *thd, LEX *le
} // switch(lex->sql_command)
if (context.close())
- DBUG_RETURN(send_error(context,ER_BACKUP_UNKNOWN_ERROR));
+ DBUG_RETURN(send_error(context,ER_BACKUP_CONTEXT_REMOVE));
// All seems OK - send positive reply to client
@@ -297,7 +294,7 @@ int Backup_restore_ctx::prepare(LEX_STRI
Check access for SUPER rights. If user does not have SUPER, fail with error.
*/
if (check_global_access(m_thd, SUPER_ACL))
- report_error((m_error= ER_SPECIFIC_ACCESS_DENIED_ERROR), "SUPER");
+ fatal_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, "SUPER");
/*
Check if another BACKUP/RESTORE is running and if not, register
@@ -309,7 +306,7 @@ int Backup_restore_ctx::prepare(LEX_STRI
if (!is_running)
is_running= TRUE;
else
- report_error((m_error= ER_BACKUP_RUNNING));
+ fatal_error(ER_BACKUP_RUNNING);
pthread_mutex_unlock(&run_lock);
@@ -332,7 +329,7 @@ int Backup_restore_ctx::prepare(LEX_STRI
if (bad_filename)
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR),location.str);
+ fatal_error(ER_BAD_PATH,location.str);
return m_error;
}
@@ -347,7 +344,7 @@ int Backup_restore_ctx::prepare(LEX_STRI
if (!mem_alloc)
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_OUT_OF_RESOURCES);
return m_error;
}
@@ -355,7 +352,7 @@ int Backup_restore_ctx::prepare(LEX_STRI
if (!DDL_blocker->block_DDL(m_thd))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_DDL_BLOCK);
return m_error;
}
@@ -381,7 +378,7 @@ Backup_info* Backup_restore_ctx::prepare
if (Logger::init(m_thd, BACKUP, location))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_LOGGER_INIT);
return NULL;
}
@@ -404,12 +401,15 @@ Backup_info* Backup_restore_ctx::prepare
if (!s)
{
- report_error(ER_BACKUP_UNKNOWN_ERROR);
+ fatal_error(ER_OUT_OF_RESOURCES);
return NULL;
}
if (!s->open())
+ {
+ fatal_error(ER_BACKUP_WRITE_LOC,path.ptr());
return NULL;
+ }
m_stream= s;
@@ -421,7 +421,7 @@ Backup_info* Backup_restore_ctx::prepare
if (!info)
{
- report_error(ER_BACKUP_UNKNOWN_ERROR);
+ fatal_error(ER_OUT_OF_RESOURCES);
return NULL;
}
@@ -454,7 +454,7 @@ Restore_info* Backup_restore_ctx::prepar
if (Logger::init(m_thd, RESTORE, location))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_LOGGER_INIT);
return NULL;
}
@@ -476,12 +476,15 @@ Restore_info* Backup_restore_ctx::prepar
if (!s)
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_OUT_OF_RESOURCES);
return NULL;
}
if (!s->open())
+ {
+ fatal_error(ER_BACKUP_READ_LOC,path.ptr());
return NULL;
+ }
m_stream= s;
@@ -493,7 +496,7 @@ Restore_info* Backup_restore_ctx::prepar
if (!info)
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_OUT_OF_RESOURCES);
return NULL;
}
@@ -509,25 +512,25 @@ Restore_info* Backup_restore_ctx::prepar
if (read_header(*info, *s))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_READ_HEADER);
return NULL;
}
if (s->next_chunk() != BSTREAM_OK)
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_NEXT_CHUNK);
return NULL;
}
if (read_catalog(*info, *s))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_READ_HEADER);
return NULL;
}
if (s->next_chunk() != BSTREAM_OK)
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_NEXT_CHUNK);
return NULL;
}
@@ -584,9 +587,13 @@ int Backup_restore_ctx::close()
is_running= FALSE;
pthread_mutex_unlock(&run_lock);
- // remove the location, if asked for
-
- if (m_remove_loc)
+ /*
+ Remove the location, if asked for.
+
+ Important: This is done only for backup operation - RESTORE should never
+ remove the specified backup image!
+ */
+ if (m_remove_loc && m_state == PREPARED_FOR_BACKUP)
{
int res= my_delete(m_path, MYF(0));
@@ -639,7 +646,7 @@ int Backup_restore_ctx::do_backup()
if (write_preamble(info, s))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_WRITE_HEADER);
DBUG_RETURN(m_error);
}
@@ -647,14 +654,14 @@ int Backup_restore_ctx::do_backup()
BACKUP_BREAKPOINT("backup_data");
- if ((m_error= write_table_data(m_thd, *this, info, s))) // reports errors
- DBUG_RETURN(m_error);
+ if (write_table_data(m_thd, *this, info, s)) // reports errors
+ DBUG_RETURN(send_error(*this, ER_BACKUP_BACKUP));
DBUG_PRINT("backup",("Writing summary"));
if (write_summary(info, s))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_WRITE_SUMMARY);
DBUG_RETURN(m_error);
}
@@ -695,7 +702,7 @@ int Backup_restore_ctx::do_restore()
if (read_meta_data(info, s))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_READ_META);
DBUG_RETURN(m_error);
}
@@ -704,14 +711,14 @@ int Backup_restore_ctx::do_restore()
DBUG_PRINT("restore",("Restoring table data"));
// Here restore drivers are created to restore table data
- if ((m_error= restore_table_data(m_thd, *this, info, s))) // reports errors
- DBUG_RETURN(m_error);
+ if (restore_table_data(m_thd, *this, info, s)) // reports errors
+ DBUG_RETURN(send_error(*this, ER_BACKUP_RESTORE));
DBUG_PRINT("restore",("Done."));
if (read_summary(info, s))
{
- report_error((m_error= ER_BACKUP_UNKNOWN_ERROR));
+ fatal_error(ER_BACKUP_READ_SUMMARY);
DBUG_RETURN(m_error);
}
@@ -819,12 +826,11 @@ int Backup_info::add_dbs(List< ::LEX_STR
if (is_internal_db_name(&db_name))
{
- m_ctx.report_error(backup::log_level::ERROR, ER_BACKUP_CANNOT_INCLUDE_DB,
- db_name.c_ptr());
+ m_ctx.fatal_error(ER_BACKUP_CANNOT_INCLUDE_DB, db_name.c_ptr());
goto error;
}
- obs::Obj *obj= get_database(&db_name);
+ obs::Obj *obj= get_database(&db_name); // reports errors
if (obj && !check_db_existence(&db_name))
{
@@ -845,7 +851,7 @@ int Backup_info::add_dbs(List< ::LEX_STR
if (add_db_items(*db)) // reports errors
goto error;
}
- else
+ else if (obj)
{
if (!unknown_dbs.is_empty())
unknown_dbs.append(",");
@@ -853,11 +859,13 @@ int Backup_info::add_dbs(List< ::LEX_STR
delete obj;
}
+ else
+ goto error; // error was reported in get_database()
}
if (!unknown_dbs.is_empty())
{
- m_ctx.report_error(ER_BAD_DB_ERROR,unknown_dbs.c_ptr());
+ m_ctx.fatal_error(ER_BAD_DB_ERROR,unknown_dbs.c_ptr());
goto error;
}
@@ -886,7 +894,7 @@ int Backup_info::add_all_dbs()
if (!dbit)
{
- m_ctx.report_error(ER_BACKUP_LIST_DBS);
+ m_ctx.fatal_error(ER_BACKUP_LIST_DBS);
return ERROR;
}
@@ -950,7 +958,7 @@ int Backup_info::add_db_items(Db &db)
if (!it || TEST_ERROR)
{
- m_ctx.report_error(ER_BACKUP_LIST_DB_TABLES,db.name().ptr());
+ m_ctx.fatal_error(ER_BACKUP_LIST_DB_TABLES,db.name().ptr());
return ERROR;
}
@@ -1056,8 +1064,7 @@ Backup_info::find_backup_engine(const ba
if (!se)
{
- // TODO: better error message
- m_ctx.report_error(ER_BACKUP_TABLE_OPEN,tbl.describe(buf));
+ m_ctx.fatal_error(ER_NO_STORAGE_ENGINE,tbl.describe(buf));
DBUG_RETURN(NULL);
}
@@ -1066,7 +1073,7 @@ Backup_info::find_backup_engine(const ba
if (!snap)
if (has_native_backup(se))
{
- Native_snapshot *nsnap= new Native_snapshot(se);
+ Native_snapshot *nsnap= new Native_snapshot(m_ctx,se);
DBUG_ASSERT(nsnap);
snapshots.push_front(nsnap);
native_snapshots.insert(se,nsnap);
@@ -1096,7 +1103,7 @@ Backup_info::find_backup_engine(const ba
}
if (!snap)
- m_ctx.report_error(ER_BACKUP_NO_BACKUP_DRIVER,tbl.describe(buf));
+ m_ctx.fatal_error(ER_BACKUP_NO_BACKUP_DRIVER,tbl.describe(buf));
DBUG_RETURN(snap);
}
@@ -1307,6 +1314,7 @@ int bcat_reset(st_bstream_image_header *
uint no;
+ DBUG_ASSERT(catalogue);
Restore_info *info= static_cast<Restore_info*>(catalogue);
/*
@@ -1330,43 +1338,39 @@ int bcat_reset(st_bstream_image_header *
storage_engine_ref se= get_se_by_name(name_lex);
handlerton *hton= se_hton(se);
- if (!hton)
+ if (!se || !hton)
{
- // TODO: report error
+ info->m_ctx.fatal_error(ER_BACKUP_CANT_FIND_SE,name_lex.str);
return BSTREAM_ERROR;
}
if (!hton->get_backup_engine)
{
- // TODO: report error
+ info->m_ctx.fatal_error(ER_BACKUP_NO_NATIVE_BE,name_lex.str);
return BSTREAM_ERROR;
}
- info->m_snap[no]= new Native_snapshot(snap->version, se);
- // TODO: handle errors during creation of the snapshot object
-
+ info->m_snap[no]= new Native_snapshot(info->m_ctx, snap->version, se); // reports errors
break;
}
case BI_CS:
- info->m_snap[no]= new CS_snapshot(info->m_ctx, snap->version);
- // TODO: handle errors during creation of the snapshot object
+ info->m_snap[no]= new CS_snapshot(info->m_ctx, snap->version); // reports errors
break;
case BI_DEFAULT:
- info->m_snap[no]= new Default_snapshot(info->m_ctx, snap->version);
- // TODO: handle errors during creation of the snapshot object
+ info->m_snap[no]= new Default_snapshot(info->m_ctx, snap->version); // reports errors
break;
default:
- DBUG_PRINT("restore",("Unknown snapshot type %d",
- info->snapshot[no].type));
+ // note: we use convention that snapshots are counted starting from 1.
+ info->m_ctx.fatal_error(ER_BACKUP_UNKNOWN_BE,no+1);
return BSTREAM_ERROR;
}
if (!info->m_snap[no])
{
- // TODO: report error
+ info->m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
return BSTREAM_ERROR;
}
@@ -1430,7 +1434,13 @@ int bcat_add_item(st_bstream_image_heade
if (!snap)
{
- // TODO: report error
+ /*
+ This can happen only if the snapshot number is too big - if we failed
+ to create one of the snapshots listed in image's header we would stop
+ with error earlier.
+ */
+ DBUG_ASSERT(it->snap_no >= info->snap_count());
+ info->m_ctx.fatal_error(ER_BACKUP_WRONG_TABLE_BE,it->snap_no+1);
return BSTREAM_ERROR;
}
@@ -1457,6 +1467,166 @@ int bcat_add_item(st_bstream_image_heade
/*****************************************************************
+ Iterators
+
+ *****************************************************************/
+
+static uint cset_iter; ///< Used to implement trivial charset iterator.
+static uint null_iter; ///< Used to implement trivial empty iterator.
+
+/// Return pointer to an instance of iterator of a given type.
+extern "C"
+void* bcat_iterator_get(st_bstream_image_header *catalogue, unsigned int type)
+{
+ DBUG_ASSERT(catalogue);
+
+ Backup_info *info= static_cast<Backup_info*>(catalogue);
+
+ switch (type) {
+
+ case BSTREAM_IT_PERDB: // per-db objects, except tables
+ case BSTREAM_IT_PERTABLE: // per-table objects
+ return &null_iter;
+
+ case BSTREAM_IT_CHARSET: // character sets
+ cset_iter= 0;
+ return &cset_iter;
+
+ case BSTREAM_IT_USER: // users
+ return &null_iter;
+
+ case BSTREAM_IT_GLOBAL: // all global objects
+ // only global items (for which meta-data is stored) are databases
+ case BSTREAM_IT_DB: // all databases
+ {
+ Backup_info::Db_iterator *it= info->get_dbs();
+
+ if (!it)
+ {
+ info->m_ctx.fatal_error(ER_BACKUP_LIST_DBS);
+ return NULL;
+ }
+
+ return it;
+ }
+
+ default:
+ return NULL;
+
+ }
+}
+
+/// Return next item pointed by a given iterator and advance it to the next positon.
+extern "C"
+struct st_bstream_item_info*
+bcat_iterator_next(st_bstream_image_header *catalogue, void *iter)
+{
+ using namespace backup;
+
+ /* If this is the null iterator, return NULL immediately */
+ if (iter == &null_iter)
+ return NULL;
+
+ static bstream_blob name= {NULL, NULL};
+
+ /*
+ If it is cset iterator then cset_iter variable contains iterator position.
+ We return only 2 charsets: the utf8 charset used to encode all strings and
+ the default server charset.
+ */
+ if (iter == &cset_iter)
+ {
+ switch (cset_iter) {
+ case 0: name.begin= (byte*)my_charset_utf8_bin.csname; break;
+ case 1: name.begin= (byte*)system_charset_info->csname; break;
+ default: name.begin= NULL; break;
+ }
+
+ name.end= name.begin ? name.begin + strlen((char*)name.begin) : NULL;
+ cset_iter++;
+
+ return name.begin ? (st_bstream_item_info*)&name : NULL;
+ }
+
+ /*
+ In all other cases assume that iter points at instance of
+ @c Image_info::Iterator and use this instance to get next item.
+ */
+ const Image_info::Obj *ptr= (*(Image_info::Iterator*)iter)++;
+
+ return ptr ? (st_bstream_item_info*)(ptr->info()) : NULL;
+}
+
+extern "C"
+void bcat_iterator_free(st_bstream_image_header *catalogue, void *iter)
+{
+ /*
+ Do nothing for the null and cset iterators, but delete the
+ @c Image_info::Iterator object otherwise.
+ */
+ if (iter == &null_iter)
+ return;
+
+ if (iter == &cset_iter)
+ return;
+
+ delete (backup::Image_info::Iterator*)iter;
+}
+
+/* db-items iterator */
+
+/**
+ Return pointer to an iterator for iterating over objects inside a given
+ database.
+ */
+extern "C"
+void* bcat_db_iterator_get(st_bstream_image_header *catalogue, struct st_bstream_db_info *dbi)
+{
+ DBUG_ASSERT(catalogue);
+ DBUG_ASSERT(dbi);
+
+ Backup_info *info= static_cast<Backup_info*>(catalogue);
+ Backup_info::Db *db = info->get_db(dbi->base.pos);
+
+ if (!db)
+ {
+ info->m_ctx.fatal_error(ER_BACKUP_UNKNOWN_OBJECT);
+ return NULL;
+ }
+
+ Backup_info::DbObj_iterator *it= info->get_db_objects(*db);
+
+ if (!it)
+ {
+ info->m_ctx.fatal_error(ER_BACKUP_LIST_DB_TABLES);
+ return NULL;
+ }
+
+ return it;
+}
+
+extern "C"
+struct st_bstream_dbitem_info*
+bcat_db_iterator_next(st_bstream_image_header *catalogue,
+ struct st_bstream_db_info *db,
+ void *iter)
+{
+ const backup::Image_info::Obj *ptr= (*(backup::Image_info::Iterator*)iter)++;
+
+ return ptr ? (st_bstream_dbitem_info*)ptr->info() : NULL;
+}
+
+extern "C"
+void bcat_db_iterator_free(st_bstream_image_header *catalogue,
+ struct st_bstream_db_info *db,
+ void *iter)
+{
+ delete (backup::Image_info::DbObj_iterator*)iter;
+}
+
+
+/*****************************************************************
+
Services for backup stream library related to meta-data
manipulation.
@@ -1478,17 +1648,31 @@ int bcat_create_item(st_bstream_image_he
DBUG_ASSERT(item);
Restore_info *info= static_cast<Restore_info*>(catalogue);
+ int create_err= 0;
- Image_info::Obj *obj= find_obj(*info, *item); // reports errors
-
+ switch (item->type) {
+
+ case BSTREAM_IT_DB: create_err= ER_BACKUP_CANT_RESTORE_DB; break;
+ case BSTREAM_IT_TABLE: create_err= ER_BACKUP_CANT_RESTORE_TABLE; break;
+
/*
TODO: Decide what to do when we come across unknown item:
break the restore process as it is done now or continue
with a warning?
*/
+ default:
+ info->m_ctx.fatal_error(ER_BACKUP_UNKNOWN_OBJECT_TYPE);
+ return BSTREAM_ERROR;
+ }
+
+ Image_info::Obj *obj= find_obj(*info, *item);
+
if (!obj)
- return BSTREAM_ERROR; // find_obj should report errors
+ {
+ info->m_ctx.fatal_error(ER_BACKUP_UNKNOWN_OBJECT);
+ return BSTREAM_ERROR;
+ }
backup::String sdata(create_stmt.begin, create_stmt.end);
@@ -1500,15 +1684,17 @@ int bcat_create_item(st_bstream_image_he
*/
obs::Obj *sobj= obj->materialize(0, sdata);
+ Image_info::Obj::describe_buf buf;
+
if (!sobj)
{
- // TODO: report error
+ info->m_ctx.fatal_error(create_err,obj->describe(buf));
return BSTREAM_ERROR;
}
if (sobj->execute(::current_thd))
{
- // TODO: report error (think about how execute() reports errors)
+ info->m_ctx.fatal_error(create_err,obj->describe(buf));
return BSTREAM_ERROR;
}
@@ -1536,14 +1722,26 @@ int bcat_get_item_create_query(st_bstrea
Backup_info *info= static_cast<Backup_info*>(catalogue);
- Image_info::Obj *obj= find_obj(*info, *item);
+ int meta_err;
- if (!obj)
- {
- // TODO: warn that object was not found (?)
- return BSTREAM_ERROR;
+ switch (item->type) {
+
+ case BSTREAM_IT_DB: meta_err= ER_BACKUP_GET_META_DB; break;
+ case BSTREAM_IT_TABLE: meta_err= ER_BACKUP_GET_META_TABLE; break;
+
+ /*
+ This can't happen - the item was obtained from the backup kernel.
+ */
+ default: DBUG_ASSERT(FALSE);
}
+ Image_info::Obj *obj= find_obj(*info, *item);
+
+ /*
+ The catalogue should contain the specified object and it should have
+ a corresponding server object instance.
+ */
+ DBUG_ASSERT(obj);
DBUG_ASSERT(obj->m_obj_ptr);
/*
@@ -1558,7 +1756,9 @@ int bcat_get_item_create_query(st_bstrea
buf->length(0);
if (obj->m_obj_ptr->serialize(::current_thd, buf))
{
- // TODO: report error
+ Image_info::Obj::describe_buf dbuf;
+
+ info->m_ctx.fatal_error(meta_err,obj->describe(dbuf));
return BSTREAM_ERROR;
}
@@ -1616,7 +1816,8 @@ int send_error(Backup_restore_ctx &log,
va_end(args);
}
- log.report_stop(my_time(0),FALSE); // FASLE = no success
+ if (log.backup::Logger::m_state == backup::Logger::RUNNING)
+ log.report_stop(my_time(0),FALSE); // FASLE = no success
return error_code;
}
diff -Nrup a/sql/backup/logger.cc b/sql/backup/logger.cc
--- a/sql/backup/logger.cc 2008-02-12 18:17:51 +01:00
+++ b/sql/backup/logger.cc 2008-02-18 13:04:24 +01:00
@@ -23,6 +23,12 @@ namespace backup {
for other messages set to 0
@param msg message text
+ @note It should be possible to use this method (and other error reporting
+ methods relying on it) right after creation of the Logger object instance.
+ The message should be written to these destinations which are available at
+ the moment. Destinations which are not ready/initialized yet should be
+ silently ignored.
+
@returns 0 on success.
*/
int Logger::write_message(log_level::value level, int error_code,
diff -Nrup a/sql/backup/logger.h b/sql/backup/logger.h
--- a/sql/backup/logger.h 2008-02-12 18:17:51 +01:00
+++ b/sql/backup/logger.h 2008-02-18 13:04:24 +01:00
@@ -3,6 +3,7 @@
#include <backup_stream.h>
#include <backup/error.h>
+#include <backup/debug.h>
#include <backup/backup_progress.h>
@@ -26,7 +27,11 @@ class Image_info;
process.
Destination of the messages is determined by the implementation. Currently
- messages are output the the servers error log.
+ messages are:
+ - for errors, reported to the online backup progress table,
+ - for errors and warning, pushed on client's error stack,
+ - written to error log and trace file (if enabled)
+
Messages are intended for a DBA and thus should be localized. A message should
be registered in errmsg.txt database and have assigned an error code. Printing
@@ -40,6 +45,7 @@ class Logger
enum { CREATED, READY, RUNNING, DONE } m_state;
Logger();
+ ~Logger();
int init(THD*, enum_type, const LEX_STRING);
int report_error(int error_code, ...);
@@ -87,6 +93,12 @@ Logger::Logger():
m_type(BACKUP), m_state(CREATED), m_op_id(0), m_save_errors(FALSE)
{}
+inline
+Logger::~Logger()
+{
+ clear_saved_errors();
+}
+
/**
Initialize logger for backup or restore operation.
@@ -111,6 +123,7 @@ int Logger::init(THD *thd, enum_type typ
m_op_id= report_ob_init(thd->id, BUP_STARTING,
type == BACKUP ? OP_BACKUP : OP_RESTORE,
0, "", path.str, thd->query);
+ BACKUP_BREAKPOINT("bp_starting_state");
return 0;
}
diff -Nrup a/sql/backup/stream.cc b/sql/backup/stream.cc
--- a/sql/backup/stream.cc 2008-02-12 18:17:51 +01:00
+++ b/sql/backup/stream.cc 2008-02-18 13:04:24 +01:00
@@ -180,6 +180,31 @@ int OStream::write_magic_and_version()
}
/**
+ Initialize backup stream after the underlying stream has been opened.
+ */
+bool OStream::init()
+{
+ // write magic bytes and format version
+ int len= write_magic_and_version();
+
+ if (len <= 0)
+ {
+ m_log.report_error(ER_BACKUP_WRITE_HEADER);
+ return FALSE;
+ }
+
+ bytes= 0;
+
+ if (BSTREAM_OK != bstream_open_wr(this,m_block_size,len))
+ {
+ m_log.report_error(ER_BACKUP_OPEN_WR);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
Open and initialize backup stream for writing.
@retval TRUE operation succeeded
@@ -196,19 +221,7 @@ bool OStream::open()
if (!ret)
return FALSE;
- // write magic bytes and format version
- int len= write_magic_and_version();
-
- if (len <= 0)
- {
- // TODO: report errors
- return FALSE;
- }
-
- bytes= 0;
- ret= BSTREAM_OK == bstream_open_wr(this,m_block_size,len);
- // TODO: report errors
- return ret;
+ return init();
}
/**
@@ -241,14 +254,7 @@ bool OStream::rewind()
if (!ret)
return FALSE;
- int len= write_magic_and_version();
-
- if (len <= 0)
- return FALSE;
-
- ret= BSTREAM_OK == bstream_open_wr(this,m_block_size,len);
-
- return ret;
+ return init();
}
@@ -289,6 +295,30 @@ int IStream::check_magic_and_version()
}
/**
+ Initialize backup stream after the underlying stream has been opened.
+ */
+bool IStream::init()
+{
+ int len= check_magic_and_version();
+
+ if (len <= 0)
+ {
+ m_log.report_error(ER_BACKUP_BAD_MAGIC);
+ return FALSE;
+ }
+
+ bytes= 0;
+
+ if (BSTREAM_OK != bstream_open_rd(this,len))
+ {
+ m_log.report_error(ER_BACKUP_OPEN_RD);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
Open backup stream for reading.
@retval TRUE operation succeeded
@@ -305,19 +335,7 @@ bool IStream::open()
if (!ret)
return FALSE;
- int len= check_magic_and_version();
-
- if (len <= 0)
- {
- // TODO: report errors
- return FALSE;
- }
-
- bytes= 0;
-
- ret= BSTREAM_OK == bstream_open_rd(this,len);
- // TODO: report errors
- return ret;
+ return init();
}
/**
@@ -346,17 +364,7 @@ bool IStream::rewind()
bool ret= Stream::rewind();
- if (!ret)
- return FALSE;
-
- int len= check_magic_and_version();
-
- if (len < 0)
- return FALSE;
-
- ret= BSTREAM_OK == bstream_open_rd(this,len);
-
- return ret;
+ return ret ? init() : FALSE;
}
/// Move to next chunk in the stream.
diff -Nrup a/sql/backup/stream.h b/sql/backup/stream.h
--- a/sql/backup/stream.h 2008-02-12 18:17:52 +01:00
+++ b/sql/backup/stream.h 2008-02-18 13:04:24 +01:00
@@ -109,6 +109,7 @@ class OStream:
private:
int write_magic_and_version();
+ bool init();
};
/// Used to read from backup stream.
@@ -128,6 +129,7 @@ class IStream:
private:
int check_magic_and_version();
+ bool init();
};
} // backup namespace
diff -Nrup a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2008-02-12 18:17:49 +01:00
+++ b/sql/mysqld.cc 2008-02-18 13:04:23 +01:00
@@ -209,8 +209,10 @@ extern "C" int gethostname(char *name, i
Online backup initialization and shutdown functions - defined in
backup/kernel.cc
*/
+#ifndef EMBEDDED_LIBRARY
int backup_init();
void backup_shutdown();
+#endif
/* Constants */
@@ -1230,7 +1232,9 @@ void clean_up(bool print_message)
udf_free();
#endif
}
+#ifndef EMBEDDED_LIBRARY
backup_shutdown();
+#endif
plugin_shutdown();
ha_end();
if (tc_log)
@@ -3462,11 +3466,13 @@ server.");
unireg_abort(1);
}
+#ifndef EMBEDDED_LIBRARY
if (backup_init())
{
sql_print_error("Failed to initialize online backup.");
unireg_abort(1);
}
+#endif
if (opt_help)
unireg_abort(0);
diff -Nrup a/sql/share/errmsg.txt b/sql/share/errmsg.txt
--- a/sql/share/errmsg.txt 2008-02-12 18:17:52 +01:00
+++ b/sql/share/errmsg.txt 2008-02-18 13:04:24 +01:00
@@ -6119,9 +6119,9 @@ ER_BACKUP_NOTHING_TO_BACKUP
ER_BACKUP_CANNOT_INCLUDE_DB
eng "Database '%-.64s' cannot be included in a backup"
ER_BACKUP_BACKUP
- eng "Error during backup operation - server's error log contains more information about the error"
+ eng "Error during backup operation - see SHOW WARNINGS for more information"
ER_BACKUP_RESTORE
- eng "Error during restore operation - server's error log contains more information about the error"
+ eng "Error during restore operation - see SHOW WARNINGS for more information"
ER_BACKUP_RUNNING
eng "Can't execute this command because another BACKUP/RESTORE operation is in progress"
ER_BACKUP_BACKUP_PREPARE
@@ -6159,17 +6159,17 @@ ER_BACKUP_CREATE_BACKUP_DRIVER
ER_BACKUP_CREATE_RESTORE_DRIVER
eng "Can't create %-.64s restore driver"
ER_BACKUP_TOO_MANY_IMAGES
- eng "Found %d images in backup archive but maximum %d are supported"
+ eng "Backup image uses %d backup engines but maximum %d are supported"
ER_BACKUP_WRITE_META
eng "Error when saving meta-data of %-.64s"
ER_BACKUP_READ_META
- eng "Error when reading meta-data list"
+ eng "Error when reading meta-data"
ER_BACKUP_CREATE_META
- eng "Can't create %-.64s"
+ eng "Failed to obtain meta-data for %-.64s"
ER_BACKUP_GET_BUF
eng "Can't allocate buffer for image data transfer"
ER_BACKUP_WRITE_DATA
- eng "Error when writing %-.64s backup image data (for table #%d)"
+ eng "Error when writing data from %-.64s backup driver (data block for table #%d)"
ER_BACKUP_READ_DATA
eng "Error when reading data from backup stream"
ER_BACKUP_NEXT_CHUNK
@@ -6186,7 +6186,7 @@ ER_BACKUP_STOP_RESTORE_DRIVERS
ER_BACKUP_PREPARE_DRIVER
eng "%-.64s backup driver can't prepare for synchronization"
ER_BACKUP_CREATE_VP
- eng "%-.64s backup driver can't create its image validity point"
+ eng "%-.64s backup driver can't create its validity point"
ER_BACKUP_UNLOCK_DRIVER
eng "Can't unlock %-.64s backup driver after creating the validity point"
ER_BACKUP_CANCEL_BACKUP
@@ -6194,9 +6194,9 @@ ER_BACKUP_CANCEL_BACKUP
ER_BACKUP_CANCEL_RESTORE
eng "%-.64s restore driver can't cancel its restore operation"
ER_BACKUP_GET_DATA
- eng "Error when polling %-.64s backup driver for its image data"
+ eng "Error when polling %-.64s backup driver for its data"
ER_BACKUP_SEND_DATA
- eng "Error when sending image data (for table #%d) to %-.64s restore driver"
+ eng "Error when sending data (for table #%d) to %-.64s restore driver"
ER_BACKUP_SEND_DATA_RETRY
eng "After %d attempts %-.64s restore driver still can't accept next block of data"
@@ -6235,5 +6235,49 @@ ER_CANT_CREATE_SROUTINE
ER_TABLESPACE_EXIST
eng "Tablespace '%-.192s' already exists"
-ER_BACKUP_UNKNOWN_ERROR
- eng "No error message for this error yet!"
+ER_BACKUP_CANT_FIND_SE
+ eng "Backup image contains data created by a native driver of %-.64s storage engine but this engine can not be found on this server"
+ER_BACKUP_NO_NATIVE_BE
+ eng "Backup image contains data created by a native driver of %-.64s storage engine but it has no native backup support on this server"
+ER_BACKUP_UNKNOWN_BE
+ eng "Backup engine #%d needed for restoring from backup image has unknown type"
+ER_BACKUP_WRONG_TABLE_BE
+ eng "Backup image specifies wrong backup engine #%d for one of the tables"
+ER_BACKUP_CANT_RESTORE_DB
+ eng "Could not restore database %-.64s"
+ER_BACKUP_CANT_RESTORE_TABLE
+ eng "Could not restore database %-.64s"
+ER_BACKUP_CATALOG_ADD_DB
+ eng "Failed to add database %-.64s to the catalog"
+ER_BACKUP_CATALOG_ADD_TABLE
+ eng "Failed to add table %-.64s to the catalog"
+ER_BACKUP_UNKNOWN_OBJECT
+ eng "Backup image refers to an object which could not be found in the catalog"
+ER_BACKUP_UNKNOWN_OBJECT_TYPE
+ eng "Backup image refers to an object of unknown type"
+ER_BACKUP_OPEN_WR
+ eng "Cannot open backup stream for writing"
+ER_BACKUP_OPEN_RD
+ eng "Cannot open backup stream for reading"
+ER_BACKUP_BAD_MAGIC
+ eng "Could not find correct signature at the beginning of backup stream"
+ER_BACKUP_CONTEXT_CREATE
+ eng "Cannot create backup/restore execution context"
+ER_BACKUP_CONTEXT_REMOVE
+ eng "Error when cleaning up after backup/restore operation"
+ER_BAD_PATH
+ eng "Malformed file path '%-128s'"
+ER_DDL_BLOCK
+ eng "Erorr when attempting to block DDLs"
+ER_BACKUP_LOGGER_INIT
+ eng "Could not initialize logging and reporting services"
+ER_BACKUP_WRITE_SUMMARY
+ eng "Error when writing summary section of backup image"
+ER_BACKUP_READ_SUMMARY
+ eng "Error when reading summary section of backup image"
+ER_BACKUP_GET_META_DB
+ eng "Failed to obtain meta-data for database %-.64s"
+ER_BACKUP_GET_META_TABLE
+ eng "Failed to obtain meta-data for table %-.64s"
+ER_BACKUP_CREATE_BE
+ eng "Cannot create backup engine for storage engine %-.64s"