Skip to content

Commit

Permalink
Minor fixes to messages
Browse files Browse the repository at this point in the history
Using --version now shows whether it is MariaDB or MySQL that we are
built with. Verbose messages now consistently use :.
  • Loading branch information
LinuxJedi committed Dec 21, 2022
1 parent 44495ed commit 6ed22d7
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 23 deletions.
4 changes: 4 additions & 0 deletions config.h.in
Expand Up @@ -7,12 +7,16 @@

#if defined(LIBMYSQL_VERSION)
#define MYSQL_VERSION_STR LIBMYSQL_VERSION
#define DB_LIBRARY "MySQL"
#elif defined(MARIADB_CLIENT_VERSION_STR)
#define MYSQL_VERSION_STR MARIADB_CLIENT_VERSION_STR
#define DB_LIBRARY "MariaDB"
#elif defined(MYSQL_VERSION_NUMBER)
#define MYSQL_VERSION_STR MYSQL_VERSION_NUMBER
#define DB_LIBRARY "MySQL"
#else
#define MYSQL_VERSION_STR MYSQL_SERVER_VERSION
#define DB_LIBRARY "MySQL"
#endif

#endif
2 changes: 1 addition & 1 deletion src/common.c
Expand Up @@ -394,7 +394,7 @@ void remove_definer(GString * data){

void print_version(const gchar *program){
GString *str=g_string_new(program);
g_string_append_printf(str, "%s, built against MySQL %s", VERSION, MYSQL_VERSION_STR);
g_string_append_printf(str, "%s, built against %s %s", VERSION, DB_LIBRARY, MYSQL_VERSION_STR);
#ifdef WITH_SSL
g_string_append(str," with SSL support");
#endif
Expand Down
14 changes: 7 additions & 7 deletions src/mydumper_jobs.c
Expand Up @@ -766,7 +766,7 @@ void free_table_checksum_job(struct table_checksum_job*tcj){

void do_JOB_CREATE_DATABASE(struct thread_data *td, struct job *job){
struct create_database_job * cdj = (struct create_database_job *)job->job_data;
g_message("Thread %d dumping schema create for `%s`", td->thread_id,
g_message("Thread %d: dumping schema create for `%s`", td->thread_id,
cdj->database);
write_schema_definition_into_file(td->thrconn, cdj->database, cdj->filename, cdj->checksum_filename);
free_create_database_job(cdj);
Expand All @@ -775,15 +775,15 @@ void do_JOB_CREATE_DATABASE(struct thread_data *td, struct job *job){

void do_JOB_CREATE_TABLESPACE(struct thread_data *td, struct job *job){
struct create_tablespace_job * ctj = (struct create_tablespace_job *)job->job_data;
g_message("Thread %d dumping create tablespace if any", td->thread_id);
g_message("Thread %d: dumping create tablespace if any", td->thread_id);
write_tablespace_definition_into_file(td->thrconn, ctj->filename);
free_create_tablespace_job(ctj);
g_free(job);
}

void do_JOB_SCHEMA_POST(struct thread_data *td, struct job *job){
struct schema_post_job * sp = (struct schema_post_job *)job->job_data;
g_message("Thread %d dumping SP and VIEWs for `%s`", td->thread_id,
g_message("Thread %d: dumping SP and VIEWs for `%s`", td->thread_id,
sp->database->name);
write_routines_definition_into_file(td->thrconn, sp->database, sp->filename, sp->checksum_filename);
free_schema_post_job(sp);
Expand All @@ -792,7 +792,7 @@ void do_JOB_SCHEMA_POST(struct thread_data *td, struct job *job){

void do_JOB_VIEW(struct thread_data *td, struct job *job){
struct view_job * vj = (struct view_job *)job->job_data;
g_message("Thread %d dumping view for `%s`.`%s`", td->thread_id,
g_message("Thread %d: dumping view for `%s`.`%s`", td->thread_id,
vj->database, vj->table);
write_view_definition_into_file(td->thrconn, vj->database, vj->table, vj->filename,
vj->filename2, vj->checksum_filename);
Expand All @@ -802,7 +802,7 @@ void do_JOB_VIEW(struct thread_data *td, struct job *job){

void do_JOB_SCHEMA(struct thread_data *td, struct job *job){
struct schema_job *sj = (struct schema_job *)job->job_data;
g_message("Thread %d dumping schema for `%s`.`%s`", td->thread_id,
g_message("Thread %d: dumping schema for `%s`.`%s`", td->thread_id,
sj->database, sj->table);
write_table_definition_into_file(td->thrconn, sj->database, sj->table, sj->filename, sj->checksum_filename, sj->checksum_index_filename);
// free_schema_job(sj);
Expand All @@ -815,7 +815,7 @@ void do_JOB_SCHEMA(struct thread_data *td, struct job *job){

void do_JOB_TRIGGERS(struct thread_data *td, struct job *job){
struct schema_job * sj = (struct schema_job *)job->job_data;
g_message("Thread %d dumping triggers for `%s`.`%s`", td->thread_id,
g_message("Thread %d: dumping triggers for `%s`.`%s`", td->thread_id,
sj->database, sj->table);
write_triggers_definition_into_file(td->thrconn, sj->database, sj->table, sj->filename, sj->checksum_filename);
free_schema_job(sj);
Expand All @@ -825,7 +825,7 @@ void do_JOB_TRIGGERS(struct thread_data *td, struct job *job){

void do_JOB_CHECKSUM(struct thread_data *td, struct job *job){
struct table_checksum_job *tcj = (struct table_checksum_job *)job->job_data;
g_message("Thread %d dumping checksum for `%s`.`%s`", td->thread_id,
g_message("Thread %d: dumping checksum for `%s`.`%s`", td->thread_id,
tcj->database, tcj->table);
if (use_savepoints && mysql_query(td->thrconn, "SAVEPOINT mydumper")) {
g_critical("Savepoint failed: %s", mysql_error(td->thrconn));
Expand Down
12 changes: 6 additions & 6 deletions src/mydumper_working_thread.c
Expand Up @@ -407,7 +407,7 @@ void thd_JOB_DUMP_ALL_DATABASES( struct thread_data *td, struct job *job){

void thd_JOB_DUMP_DATABASE(struct thread_data *td, struct job *job){
struct dump_database_job * ddj = (struct dump_database_job *)job->job_data;
g_message("Thread %d dumping db information for `%s`", td->thread_id,
g_message("Thread %d: dumping db information for `%s`", td->thread_id,
ddj->database->name);
dump_database_thread(td->thrconn, td->conf, ddj->database);
g_free(ddj);
Expand Down Expand Up @@ -584,7 +584,7 @@ void thd_JOB_DUMP(struct thread_data *td, struct job *job){

void initialize_thread(struct thread_data *td){
m_connect(td->thrconn, "mydumper", NULL);
g_message("Thread %d connected using MySQL connection ID %lu",
g_message("Thread %d: connected using MySQL connection ID %lu",
td->thread_id, mysql_thread_id(td->thrconn));
}

Expand Down Expand Up @@ -701,7 +701,7 @@ void check_connection_status(struct thread_data *td){
exit(EXIT_FAILURE);
}
g_free(query);
g_message("Thread %d set to tidb_snapshot '%s'", td->thread_id,
g_message("Thread %d: set to tidb_snapshot '%s'", td->thread_id,
tidb_snapshot);
}

Expand Down Expand Up @@ -1171,7 +1171,7 @@ void *working_thread(struct thread_data *td) {
process_queue(td->conf->schema_queue,td, resume_mutex, process_job, NULL);

if (!no_data){
g_message("Thread %d Schema Done, Starting Non-Innodb", td->thread_id);
g_message("Thread %d: Schema Done, Starting Non-Innodb", td->thread_id);

g_async_queue_push(td->conf->ready, GINT_TO_POINTER(1));
g_async_queue_pop(td->conf->ready_non_innodb_queue);
Expand All @@ -1191,7 +1191,7 @@ void *working_thread(struct thread_data *td) {
g_async_queue_push(td->conf->unlock_tables, GINT_TO_POINTER(1));
}

g_message("Thread %d Non-Innodb Done, Starting Innodb", td->thread_id);
g_message("Thread %d: Non-Innodb Done, Starting Innodb", td->thread_id);
process_queue(td->conf->innodb_queue, td, resume_mutex, process_job, give_me_another_innodb_chunk_step);
// start_processing(td, resume_mutex);
}else{
Expand All @@ -1200,7 +1200,7 @@ void *working_thread(struct thread_data *td) {

process_queue(td->conf->post_data_queue, td, resume_mutex, process_job, NULL);

g_message("Thread %d shutting down", td->thread_id);
g_message("Thread %d: shutting down", td->thread_id);

if (td->binlog_snapshot_gtid_executed!=NULL)
g_free(td->binlog_snapshot_gtid_executed);
Expand Down
2 changes: 1 addition & 1 deletion src/mydumper_write.c
Expand Up @@ -327,7 +327,7 @@ gboolean write_load_data_statement(struct table_job * tj, MYSQL_FIELD *fields, g
}

void message_dumping_data(struct thread_data *td, struct table_job *tj){
g_message("Thread %d dumping data for `%s`.`%s` %s %s %s %s %s %s %s %s %s into %s| Remaining jobs: %d",
g_message("Thread %d: dumping data for `%s`.`%s` %s %s %s %s %s %s %s %s %s into %s| Remaining jobs: %d",
td->thread_id,
tj->dbt->database->name, tj->dbt->table, tj->partition?tj->partition:"",
(tj->where || where_option || tj->dbt->where) ? "WHERE" : "" , tj->where ? tj->where : "",
Expand Down
2 changes: 1 addition & 1 deletion src/myloader_control_job.c
Expand Up @@ -78,7 +78,7 @@ gboolean process_job(struct thread_data *td, struct control_job *job){
g_async_queue_pop(job->data.queue);
break;
case JOB_SHUTDOWN:
// g_message("Thread %d shutting down", td->thread_id);
// g_message("Thread %d: shutting down", td->thread_id);
g_free(job);
return FALSE;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/myloader_jobs_manager.c
Expand Up @@ -179,7 +179,7 @@ void *loader_thread(struct thread_data *td) {
if (td->thrconn)
mysql_close(td->thrconn);
mysql_thread_end();
g_debug("Thread %d ending", td->thread_id);
g_debug("Thread %d: ending", td->thread_id);
return NULL;
}

Expand Down
12 changes: 6 additions & 6 deletions src/myloader_restore_job.c
Expand Up @@ -163,15 +163,15 @@ void process_restore_job(struct thread_data *td, struct restore_job *rj){
guint i=0;
switch (rj->type) {
case JOB_RESTORE_STRING:
g_message("Thread %d restoring %s `%s`.`%s` from %s", td->thread_id, rj->data.srj->object,
g_message("Thread %d: restoring %s `%s`.`%s` from %s", td->thread_id, rj->data.srj->object,
dbt->database->real_database, dbt->real_table, rj->filename);
restore_data_in_gstring(td, rj->data.srj->statement, FALSE, &query_counter);
free_schema_restore_job(rj->data.srj);
break;
case JOB_RESTORE_SCHEMA_STRING:
dbt->schema_state=CREATING;
if (serial_tbl_creation) g_mutex_lock(single_threaded_create_table);
g_message("Thread %d restoring table `%s`.`%s` from %s", td->thread_id,
g_message("Thread %d: restoring table `%s`.`%s` from %s", td->thread_id,
dbt->database->real_database, dbt->real_table, rj->filename);
int truncate_or_delete_failed=0;
if (overwrite_tables)
Expand All @@ -181,7 +181,7 @@ void process_restore_job(struct thread_data *td, struct restore_job *rj){
}else{
g_message("Thread %d: Creating table `%s`.`%s` from content in %s", td->thread_id, dbt->database->real_database, dbt->real_table, rj->filename);
if (restore_data_in_gstring(td, rj->data.srj->statement, FALSE, &query_counter)){
g_critical("Thread %d issue restoring %s: %s",td->thread_id,rj->filename, mysql_error(td->thrconn));
g_critical("Thread %d: issue restoring %s: %s",td->thread_id,rj->filename, mysql_error(td->thrconn));
}
// g_message("Thread %d: Creating table `%s`.`%s` from content in %s COMPLETED", td->thread_id, dbt->database->real_database, dbt->real_table, rj->filename);
}
Expand All @@ -197,7 +197,7 @@ void process_restore_job(struct thread_data *td, struct restore_job *rj){
case JOB_RESTORE_FILENAME:
g_mutex_lock(progress_mutex);
progress++;
g_message("Thread %d restoring `%s`.`%s` part %d of %d from %s. Progress %llu of %llu. Using %d of %d threads.", td->thread_id,
g_message("Thread %d: restoring `%s`.`%s` part %d of %d from %s. Progress %llu of %llu. Using %d of %d threads.", td->thread_id,
dbt->database->real_database, dbt->real_table, rj->data.drj->index, dbt->count, rj->filename, progress,total_data_sql_files, dbt->current_threads, dbt->max_threads);
g_mutex_unlock(progress_mutex);
if (stream && dbt->schema_state<CREATED){
Expand All @@ -215,13 +215,13 @@ void process_restore_job(struct thread_data *td, struct restore_job *rj){
}
}
if (restore_data_from_file(td, dbt->database->real_database, dbt->real_table, rj->filename, FALSE) > 0){
g_critical("Thread %d issue restoring %s: %s",td->thread_id,rj->filename, mysql_error(td->thrconn));
g_critical("Thread %d: issue restoring %s: %s",td->thread_id,rj->filename, mysql_error(td->thrconn));
}
g_atomic_int_dec_and_test(&(dbt->remaining_jobs));
g_free(rj->data.drj);
break;
case JOB_RESTORE_SCHEMA_FILENAME:
g_message("Thread %d restoring %s on `%s` from %s", td->thread_id, rj->data.srj->object,
g_message("Thread %d: restoring %s on `%s` from %s", td->thread_id, rj->data.srj->object,
rj->data.srj->database->real_database, rj->filename);
restore_data_from_file(td, rj->data.srj->database->real_database, NULL, rj->filename, TRUE );
free_schema_restore_job(rj->data.srj);
Expand Down

0 comments on commit 6ed22d7

Please sign in to comment.