diff --git a/client/mysql.cc b/client/mysql.cc index 88cce350471c2..40dcc90e14e20 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -5188,7 +5188,7 @@ static int com_status(String *, char *) tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql)); tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql)); if ((id= mysql_insert_id(&mysql))) - tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff)); + tee_fprintf(stdout, "Insert id:\t\t%lld\n", id); /* "limit 1" is protection against SQL_SELECT_LIMIT=0 */ if (mysql_real_query_for_lazy(C_STRING_WITH_LEN( diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 304e26afa3b4f..00378f216d322 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -850,15 +850,14 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) for (;;) { /* We don't use mysql_kill(), since it only handles 32-bit IDs. */ - char buff[26], *out; /* "KILL " + max 20 digs + NUL */ - out= strxmov(buff, "KILL ", NullS); - ullstr(strtoull(pos, NULL, 0), out); + snprintf(buff, sizeof(buff), "KILL %llu", + // extract `ulonglong` number with strtoull() (note: it returns `ulong` on Linux!) + (unsigned long long) strtoull(pos, NULL, 0)); if (mysql_query(mysql, buff)) { - /* out still points to just the number */ my_printf_error(0, "kill failed on %s; error: '%s'", error_flags, - out, mysql_error(mysql)); + &buff[5], mysql_error(mysql)); error=1; } if (!(pos=strchr(pos,','))) @@ -1473,7 +1472,6 @@ static void print_row(MYSQL_RES *result, MYSQL_ROW cur, static void print_relative_row(MYSQL_RES *result, MYSQL_ROW cur, uint row) { ulonglong tmp; - char buff[22]; MYSQL_FIELD *field; mysql_field_seek(result, 0); @@ -1482,8 +1480,7 @@ static void print_relative_row(MYSQL_RES *result, MYSQL_ROW cur, uint row) field = mysql_fetch_field(result); tmp = cur[1] ? strtoull(cur[1], NULL, 10) : (ulonglong) 0; - printf(" %-*s|\n", (int) field->max_length + 1, - llstr((tmp - last_values[row]), buff)); + printf(" %-*lld|\n", (int) field->max_length + 1, tmp - last_values[row]); last_values[row] = tmp; } diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index dc9d015e6c2ae..4057ee18d8252 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -715,7 +715,6 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, Table_map_log_event *ignored_map= print_event_info->m_table_map_ignored.get_table(table_id); bool skip_event= (ignored_map != NULL); - char ll_buff[21]; bool result= 0; if (opt_flashback) @@ -821,8 +820,7 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, if (is_stmt_end && !result) { if (print_event_info->print_row_count) - fprintf(result_file, "# Number of rows: %s\n", - llstr(print_event_info->row_events, ll_buff)); + fprintf(result_file, "# Number of rows: %lld\n", print_event_info->row_events); print_event_info->row_events= 0; } return result; @@ -863,7 +861,6 @@ static inline my_bool is_server_id_excluded(uint32 server_id) Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, my_off_t pos, const char *logname) { - char ll_buff[21]; Log_event_type ev_type= ev->get_type_code(); my_bool destroy_evt= TRUE; my_bool gtid_err= FALSE; @@ -1040,7 +1037,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, goto end; } if (print_row_event_positions) - fprintf(result_file, "# at %s\n",llstr(pos,ll_buff)); + fprintf(result_file, "# at %lld\n", pos); if (!opt_hexdump) print_event_info->hexdump_from= 0; /* Disabled */ @@ -3160,7 +3157,6 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, } for (;;) { - char llbuff[21]; my_off_t old_off = my_b_tell(file); Log_event* ev = Log_event::read_log_event(file, glob_description_event, @@ -3175,9 +3171,8 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, file->error= 0; else if (file->error) { - error("Could not read entry at offset %s: " - "Error in log format or read error.", - llstr(old_off,llbuff)); + error("Could not read entry at offset %lld: " + "Error in log format or read error.", old_off); goto err; } // else file->error == 0 means EOF, that's OK, we break in this case diff --git a/client/mysqltest.cc b/client/mysqltest.cc index c01f996677cc1..2cb43b32cbc08 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7991,8 +7991,8 @@ void append_metadata(DYNAMIC_STRING *ds, void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows, const char *info) { - char buf[40], buff2[21]; - size_t len= sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2)); + char buf[40]; + size_t len= sprintf(buf,"affected rows: %lld\n", affected_rows); dynstr_append_mem(ds, buf, len); if (info) { diff --git a/include/m_string.h b/include/m_string.h index 060ab2c21d1f8..e5b859040534f 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -158,8 +158,6 @@ size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to, */ #define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + MY_MAX(5, MAX_DECPT_FOR_F_FORMAT)) \ -extern char *llstr(longlong value,char *buff); -extern char *ullstr(longlong value,char *buff); #ifndef HAVE_STRTOUL extern long strtol(const char *str, char **ptr, int base); extern ulong strtoul(const char *str, char **ptr, int base); diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result index 98bf8884d8e5a..8989e070fb02b 100644 --- a/mysql-test/main/func_misc.result +++ b/mysql-test/main/func_misc.result @@ -392,7 +392,7 @@ SELECT GET_LOCK('ul1', -1); GET_LOCK('ul1', -1) NULL Warnings: -Warning 1411 Incorrect timeout value: '-1' for function get_lock +Warning 1411 Incorrect timeout value: '-1.000000' for function get_lock # # MDEV-8624 MariaDB hangs on query with many logical condition # diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 54d0a376a8cd0..efa66b3892013 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -1920,7 +1920,6 @@ int main(int argc, char** argv) MY_STAT status; const char* fname="/tmp/iocache.test"; int cache_size=16384; - char llstr_buf[22]; int max_block,total_bytes=0; int i,num_loops=100,error=0; char *p; @@ -1955,9 +1954,8 @@ int main(int argc, char** argv) if (!my_stat(fname,&status,MYF(MY_WME))) die("%s failed to stat, but I had just closed it,\ wonder how that happened"); - printf("Final size of %s is %s, wrote %d bytes\n",fname, - llstr(status.st_size,llstr_buf), - total_bytes); + printf("Final size of %s is %lld, wrote %d bytes\n", + fname, status.st_size, total_bytes); my_delete(fname, MYF(MY_WME)); /* check correctness of tests */ if (total_bytes != status.st_size) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 5ee1a6857d245..e7311b6f96517 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -1191,7 +1191,6 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp, { longlong old= num; my_bool adjusted= FALSE; - char buf1[255], buf2[255]; ulonglong block_size= (optp->block_size ? (ulonglong) optp->block_size : 1L); DBUG_ENTER("getopt_ll_limit_value"); @@ -1238,8 +1237,8 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp, *fix= old != num; else if (adjusted) my_getopt_error_reporter(WARNING_LEVEL, - "option '%s': signed value %s adjusted to %s", - optp->name, llstr(old, buf1), llstr(num, buf2)); + "option '%s': signed value %lld adjusted to %lld", + optp->name, old, num); DBUG_RETURN(num); } @@ -1264,7 +1263,6 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, { my_bool adjusted= FALSE; ulonglong old= num; - char buf1[255], buf2[255]; DBUG_ENTER("getopt_ull_limit_value"); if ((ulonglong) num > (ulonglong) optp->max_value && @@ -1313,8 +1311,8 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, *fix= old != num; else if (adjusted) my_getopt_error_reporter(WARNING_LEVEL, - "option '%s': unsigned value %s adjusted to %s", - optp->name, ullstr(old, buf1), ullstr(num, buf2)); + "option '%s': unsigned value %llu adjusted to %llu", + optp->name, old, num); DBUG_RETURN(num); } @@ -1730,7 +1728,6 @@ void my_print_variables(const struct my_option *options) { uint name_space= 34, length, nr; ulonglong llvalue; - char buff[255]; const struct my_option *optp; DBUG_ENTER("my_print_variables"); @@ -1811,11 +1808,10 @@ void my_print_variables(const struct my_option *options) printf("%lu\n", *((ulong*) value)); break; case GET_LL: - printf("%s\n", llstr(*((longlong*) value), buff)); + printf("%lld\n", *((longlong*) value)); break; case GET_ULL: - longlong10_to_str(*((ulonglong*) value), buff, 10); - printf("%s\n", buff); + printf("%llu\n", *((ulonglong*) value)); break; case GET_DOUBLE: printf("%.10g\n", *(double*) value); diff --git a/sql/item_func.cc b/sql/item_func.cc index bb6a94d3c44b7..32e6e1aac3079 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4275,14 +4275,13 @@ longlong Item_func_get_lock::val_int() DBUG_RETURN(1); } - if (args[1]->null_value || - (!args[1]->unsigned_flag && ((longlong) timeout < 0))) + if (args[1]->null_value || (!args[1]->unsigned_flag && timeout < 0.0)) { char buf[22]; if (args[1]->null_value) strmov(buf, "NULL"); else - llstr(((longlong) timeout), buf); + snprintf(buf, sizeof(buf), "%lf", timeout); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE), "timeout", buf, "get_lock"); @@ -4523,7 +4522,7 @@ longlong Item_func_benchmark::val_int() if (!args[0]->null_value) { char buff[22]; - llstr(((longlong) loop_count), buff); + longlong10_to_str(loop_count, buff, -10); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_VALUE_FOR_TYPE, ER_THD(thd, ER_WRONG_VALUE_FOR_TYPE), diff --git a/sql/log.cc b/sql/log.cc index 59168b08f8139..7cadb6cd01e6d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3336,7 +3336,6 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, const char *sql_text, size_t sql_text_len) { bool error= 0; - char llbuff[22]; DBUG_ENTER("MYSQL_QUERY_LOG::write"); mysql_mutex_lock(&LOCK_log); @@ -3422,15 +3421,15 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, if (thd->tmp_tables_used && my_b_printf(&log_file, "# Tmp_tables: %lu Tmp_disk_tables: %lu " - "Tmp_table_sizes: %s\n", + "Tmp_table_sizes: %lld\n", (ulong) thd->tmp_tables_used, (ulong) thd->tmp_tables_disk_used, - llstr(thd->tmp_tables_size, llbuff))) + thd->tmp_tables_size)) goto err; if (thd->max_tmp_space_used && my_b_printf(&log_file, - "# Max_tmp_disk_space_used: %s\n", - llstr(thd->max_tmp_space_used, llbuff))) + "# Max_tmp_disk_space_used: %lld\n", + thd->max_tmp_space_used)) goto err; } diff --git a/sql/log.h b/sql/log.h index 2f3b6508f58d9..8dd09ec3625fa 100644 --- a/sql/log.h +++ b/sql/log.h @@ -936,13 +936,10 @@ class MYSQL_BIN_LOG: public TC_LOG, private Event_log } void harvest_bytes_written(Atomic_counter *counter) { -#ifdef DBUG_TRACE - char buf1[22],buf2[22]; -#endif DBUG_ENTER("harvest_bytes_written"); (*counter)+=bytes_written; - DBUG_PRINT("info",("counter: %s bytes_written: %s", llstr(*counter,buf1), - llstr(bytes_written,buf2))); + DBUG_PRINT("info", + ("counter: %lld bytes_written: %lld", *counter, bytes_written)); bytes_written=0; DBUG_VOID_RETURN; } diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index 31e2722b627c0..df994de128600 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -334,14 +334,13 @@ bool Log_event::print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info, bool is_more __attribute__((unused))) { - char llbuff[22]; my_off_t hexdump_from= print_event_info->hexdump_from; DBUG_ENTER("Log_event::print_header"); if (my_b_write_byte(file, '#') || print_timestamp(file) || - my_b_printf(file, " server id %lu end_log_pos %s ", (ulong) server_id, - llstr(log_pos,llbuff))) + my_b_printf(file, " server id %lu end_log_pos %llu ", (ulong) server_id, + log_pos)) goto err; /* print the checksum */ @@ -1576,11 +1575,8 @@ bool Rows_log_event::print_verbose(IO_CACHE *file, if (!(map= print_event_info->m_table_map.get_table(m_table_id)) || !(td= map->create_table_def())) - { - char llbuff[22]; - return (my_b_printf(file, "### Row event for unknown table #%s", - ullstr(m_table_id, llbuff))); - } + return my_b_printf(file, "### Row event for unknown table #%llu", + m_table_id); /* If the write rows event contained no values for the AI */ if (((general_type_code == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end))) @@ -2013,9 +2009,8 @@ bool Query_log_event::print_query_header(IO_CACHE* file, (unlikely(print_event_info->sql_mode != sql_mode || !print_event_info->sql_mode_inited))) { - char llbuff[22]; - if (my_b_printf(file,"SET @@session.sql_mode=%s%s\n", - ullstr(sql_mode, llbuff), print_event_info->delimiter)) + if (my_b_printf(file, "SET @@session.sql_mode=%llu%s\n", + sql_mode, print_event_info->delimiter)) goto err; print_event_info->sql_mode= sql_mode; print_event_info->sql_mode_inited= 1; @@ -2301,7 +2296,6 @@ bool Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) if (print_event_info->short_form) return 0; - char buf[22]; Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); if (print_header(&cache, print_event_info, FALSE) || @@ -2310,7 +2304,7 @@ bool Rotate_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) if (new_log_ident) if (my_b_write(&cache, (uchar*) new_log_ident, (uint)ident_len)) goto err; - if (my_b_printf(&cache, " pos: %s\n", llstr(pos, buf))) + if (my_b_printf(&cache, " pos: %s\n", pos)) goto err; return cache.flush_data(); err: @@ -2374,7 +2368,6 @@ Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) bool Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { - char llbuff[22]; const char *UNINIT_VAR(msg); Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); @@ -2400,8 +2393,7 @@ bool Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) msg="INVALID_INT"; break; } - if (my_b_printf(&cache, "%s=%s%s\n", - msg, llstr(val,llbuff), print_event_info->delimiter)) + if (my_b_printf(&cache, "%s=%lld%s\n", msg, val, print_event_info->delimiter)) goto err; return cache.flush_data(); @@ -2415,16 +2407,14 @@ bool Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) Write_on_release_cache cache(&print_event_info->head_cache, file, Write_on_release_cache::FLUSH_F); - char llbuff[22],llbuff2[22]; if (!print_event_info->short_form) { if (print_header(&cache, print_event_info, FALSE) || my_b_write_string(&cache, "\tRand\n")) goto err; } - if (my_b_printf(&cache, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n", - llstr(seed1, llbuff),llstr(seed2, llbuff2), - print_event_info->delimiter)) + if (my_b_printf(&cache, "SET @@RAND_SEED1=%lld, @@RAND_SEED2=%lld%s\n", + seed1, seed2, print_event_info->delimiter)) goto err; return cache.flush_data(); @@ -2934,11 +2924,9 @@ bool Rows_log_event::print_helper(FILE *file, if (!print_event_info->short_form) { - char llbuff[22]; print_header(head, print_event_info, !last_stmt_event); - if (my_b_printf(head, "\t%s: table id %s%s\n", - name, ullstr(m_table_id, llbuff), + if (my_b_printf(head, "\t%s: table id %lld%s\n", name, m_table_id, last_stmt_event ? " flags: STMT_END_F" : "")) goto err; } @@ -3138,12 +3126,11 @@ bool Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info) { if (!print_event_info->short_form) { - char llbuff[22]; print_header(&print_event_info->head_cache, print_event_info, TRUE); if (my_b_printf(&print_event_info->head_cache, - "\tTable_map: %`s.%`s mapped to number %s%s\n", - m_dbnam, m_tblnam, ullstr(m_table_id, llbuff), + "\tTable_map: %`s.%`s mapped to number %llu%s\n", + m_dbnam, m_tblnam, m_table_id, ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? " (has triggers)" : ""))) goto err; diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index ea0f7a335c3df..012b79ef5f21f 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -722,7 +722,6 @@ int flush_master_info(Master_info* mi, bool need_lock_relay_log) { IO_CACHE* file = &mi->file; - char lbuf[22]; int err= 0; DBUG_ENTER("flush_master_info"); @@ -817,14 +816,14 @@ int flush_master_info(Master_info* mi, my_fcvt(mi->heartbeat_period, 3, heartbeat_buf, NULL); my_b_seek(file, 0L); my_b_printf(file, - "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n" + "%u\n%s\n%lld\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n" "\n\n\n\n\n\n\n\n\n\n\n" "using_gtid=%d\n" "do_domain_ids=%s\n" "ignore_domain_ids=%s\n" "END_MARKER\n", LINES_IN_MASTER_INFO, - mi->master_log_name, llstr(mi->master_log_pos, lbuf), + mi->master_log_name, mi->master_log_pos, mi->host, mi->user, mi->password, mi->port, mi->connect_retry, (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 612f05f9d6619..9191d198d3d55 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -1088,11 +1088,8 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt, if((err= rli->relay_log.find_log_pos(&linfo, log_name, 1)) || (err= rli->relay_log.find_next_log(&linfo, 1))) { - char buff[22]; - sql_print_error("next log error: %d offset: %s log: %s", - err, - llstr(linfo.index_file_offset, buff), - log_name); + sql_print_error("next log error: %d offset: %lld log: %s", + err, linfo.index_file_offset, log_name); goto err; } strmake_buf(log_name ,linfo.log_file_name); diff --git a/sql/set_var.cc b/sql/set_var.cc index 6359eb9ab3fc1..7132c756b94d1 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -481,10 +481,7 @@ bool throw_bounds_warning(THD *thd, const char *name, { char buf[22]; - if (is_unsigned) - ullstr((ulonglong) v, buf); - else - llstr(v, buf); + longlong10_to_str(v, buf, is_unsigned ? 10 : -10); if (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES) { diff --git a/sql/slave.cc b/sql/slave.cc index e16834a387da3..7a6dd99f4a126 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -6432,11 +6432,9 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) buf, event_len, new_buf_arr, sizeof(new_buf_arr), &is_malloc, &new_buf, &event_len)) { - char llbuf[22]; error = ER_BINLOG_UNCOMPRESS_ERROR; error_msg.append(STRING_WITH_LEN("binlog uncompress error, master log_pos: ")); - llstr(mi->master_log_pos, llbuf); - error_msg.append(llbuf, strlen(llbuf)); + error_msg.append_ulonglong(mi->master_log_pos); goto err; } buf = new_buf; @@ -6457,11 +6455,9 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len) sizeof(new_buf_arr), &is_malloc, &new_buf, &event_len)) { - char llbuf[22]; error = ER_BINLOG_UNCOMPRESS_ERROR; error_msg.append(STRING_WITH_LEN("binlog uncompress error, master log_pos: ")); - llstr(mi->master_log_pos, llbuf); - error_msg.append(llbuf, strlen(llbuf)); + error_msg.append_ulonglong(mi->master_log_pos); goto err; } } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index c1a9f376cd38a..63b66bae82959 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -3483,8 +3483,9 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length) if (!(stmt= find_prepared_statement(thd, stmt_id))) { char llbuf[22]; + longlong10_to_str(stmt_id, llbuf, 10); my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast(sizeof(llbuf)), - llstr(stmt_id, llbuf), "mysqld_stmt_fetch"); + llbuf, "mysqld_stmt_fetch"); DBUG_VOID_RETURN; } @@ -3543,8 +3544,9 @@ void mysqld_stmt_reset(THD *thd, char *packet) if (!(stmt= find_prepared_statement(thd, stmt_id))) { char llbuf[22]; + longlong10_to_str(stmt_id, llbuf, 10); my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast(sizeof(llbuf)), - llstr(stmt_id, llbuf), "mysqld_stmt_reset"); + llbuf, "mysqld_stmt_reset"); DBUG_VOID_RETURN; } diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 24736007f083c..9205a02201878 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -525,11 +525,6 @@ C_MODE_START static int print_key_cache_status(const char *name, KEY_CACHE *key_cache, void *unused __attribute__((unused))) { - char llbuff1[22]; - char llbuff2[22]; - char llbuff3[22]; - char llbuff4[22]; - if (!key_cache->key_cache_inited) { printf("%s: Not in use\n", name); @@ -547,10 +542,10 @@ Age_threshold: %10lu\n\ Partitions: %10lu\n\ blocks used: %10lu\n\ not flushed: %10lu\n\ -w_requests: %10s\n\ -writes: %10s\n\ -r_requests: %10s\n\ -reads: %10s\n\n", +w_requests: %10lld\n\ +writes: %10lld\n\ +r_requests: %10lld\n\ +reads: %10lld\n\n", name, (ulong)key_cache->param_buff_size, (ulong)key_cache->param_block_size, @@ -559,10 +554,10 @@ reads: %10s\n\n", (ulong)key_cache->param_partitions, (ulong)stats.blocks_used, (ulong)stats.blocks_changed, - llstr(stats.write_requests,llbuff1), - llstr(stats.writes,llbuff2), - llstr(stats.read_requests,llbuff3), - llstr(stats.reads,llbuff4)); + stats.write_requests, + stats.writes, + stats.read_requests, + stats.reads); } return 0; } @@ -618,58 +613,57 @@ Open streams: %10lu\n", display_table_locks(); #if defined(HAVE_MALLINFO2) struct mallinfo2 info = mallinfo2(); + #define PRIuMALLINFO "zu" #elif defined(HAVE_MALLINFO) struct mallinfo info= mallinfo(); + #define PRIuMALLINFO "u" #endif #if __has_feature(memory_sanitizer) /* Work around missing MSAN instrumentation */ MEM_MAKE_DEFINED(&info, sizeof info); #endif #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) - char llbuff[10][22]; - printf("\nMemory status:\n\ -Non-mmapped space allocated from system: %s\n\ -Number of free chunks: %lu\n\ -Number of fastbin blocks: %lu\n\ -Number of mmapped regions: %lu\n\ -Space in mmapped regions: %s\n\ -Maximum total allocated space: %s\n\ -Space available in freed fastbin blocks: %s\n\ -Total allocated space: %s\n\ -Total free space: %s\n\ -Top-most, releasable space: %s\n\ -Estimated memory (with thread stack): %s\n\ -Global memory allocated by server: %s\n\ -Memory allocated by threads: %s\n", - llstr(info.arena, llbuff[0]), - (ulong) info.ordblks, - (ulong) info.smblks, - (ulong) info.hblks, - llstr(info.hblkhd, llbuff[1]), - llstr(info.usmblks, llbuff[2]), - llstr(info.fsmblks, llbuff[3]), - llstr(info.uordblks, llbuff[4]), - llstr(info.fordblks, llbuff[5]), - llstr(info.keepcost, llbuff[6]), - llstr((count + thread_cache.size()) * my_thread_stack_size + - info.hblkhd + info.arena, llbuff[7]), - llstr(tmp.global_memory_used, llbuff[8]), - llstr(tmp.local_memory_used, llbuff[9])); + printf("\nMemory status:\n" + "Non-mmapped space allocated from system: %" PRIuMALLINFO "\n" + "Number of free chunks: %" PRIuMALLINFO "\n" + "Number of fastbin blocks: %" PRIuMALLINFO "\n" + "Number of mmapped regions: %" PRIuMALLINFO "\n" + "Space in mmapped regions: %" PRIuMALLINFO "\n" + "Maximum total allocated space: %" PRIuMALLINFO "\n" + "Space available in freed fastbin blocks: %" PRIuMALLINFO "\n" + "Total allocated space: %" PRIuMALLINFO "\n" + "Total free space: %" PRIuMALLINFO "\n" + "Top-most, releasable space: %" PRIuMALLINFO "\n" + "Estimated memory (with thread stack): %llu\n" + "Global memory allocated by server: %" PRId64 "\n" + "Memory allocated by threads: %" PRId64 "\n", + info.arena, + info.ordblks, + info.smblks, + info.hblks, + info.hblkhd, + info.usmblks, + info.fsmblks, + info.uordblks, + info.fordblks, + info.keepcost, + (count + thread_cache.size()) * my_thread_stack_size + + info.hblkhd + info.arena, + (int64_t) tmp.global_memory_used, + (int64_t) tmp.local_memory_used); #elif defined(HAVE_MALLOC_ZONE) malloc_statistics_t info; - char llbuff[4][22]; - malloc_zone_statistics(nullptr, &info); - printf("\nMemory status:\n\ -Total allocated space: %s\n\ -Total free space: %s\n\ -Global memory allocated by server: %s\n\ -Memory allocated by threads: %s\n", - llstr(info.size_allocated, llbuff[0]), - llstr((info.size_allocated - info.size_in_use), llbuff[1]), - llstr(tmp.global_memory_used, llbuff[2]), - llstr(tmp.local_memory_used, llbuff[3])); + printf("\nMemory status:\n" + "Total allocated space: %lld\n" + "Total free space: %lld\n" + "Global memory allocated by server: %lld\n" + "Memory allocated by threads: %lld\n", + info.size_allocated, + info.size_allocated - info.size_in_use, + tmp.global_memory_used, + tmp.local_memory_used); #endif #ifdef HAVE_EVENT_SCHEDULER diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index af07c636bc2b6..3dad1fc30d847 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -828,7 +828,8 @@ static bool check_charset(sys_var *self, THD *thd, set_var *var) find_compiled_default_collation()))) return false; } - my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), llstr(csno, buff)); + longlong10_to_str(csno, buff, -10); + my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), buff); return true; } return false; @@ -951,7 +952,8 @@ static bool check_collation_not_null(sys_var *self, THD *thd, set_var *var) int csno= (int)var->value->val_int(); if (!(var->save_result.ptr= get_charset(csno, MYF(0)))) { - my_error(ER_UNKNOWN_COLLATION, MYF(0), llstr(csno, buff)); + longlong10_to_str(csno, buff, 10); + my_error(ER_UNKNOWN_COLLATION, MYF(0), buff); return true; } } @@ -6030,7 +6032,8 @@ static bool check_locale(sys_var *self, THD *thd, set_var *var) int lcno= (int)var->value->val_int(); if (!(locale= my_locale_by_number(lcno))) { - my_error(ER_UNKNOWN_LOCALE, MYF(0), llstr(lcno, buff)); + longlong10_to_str(lcno, buff, -10); + my_error(ER_UNKNOWN_LOCALE, MYF(0), buff); return true; } if (check_not_null(self, thd, var)) diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c index 0ebbc0d6ef55d..3b529f793d746 100644 --- a/storage/maria/aria_chk.c +++ b/storage/maria/aria_chk.c @@ -229,11 +229,11 @@ int main(int argc, char **argv) end: if (check_param.total_files > 1) { /* Only if descript */ - char buff[22],buff2[22]; if (!(check_param.testflag & T_SILENT) || check_param.testflag & T_INFO) puts("\n---------"); - printf("\nTotal of all %d Aria-files:\nData records: %9s Deleted blocks: %9s\n",check_param.total_files,llstr(check_param.total_records,buff), - llstr(check_param.total_deleted,buff2)); + printf("\nTotal of all %d Aria-files:\nData records: %9lld " + "Deleted blocks: %9lld\n", check_param.total_files, + check_param.total_records, check_param.total_deleted); } maria_end(); my_exit(error); @@ -1013,7 +1013,6 @@ static int maria_chk(HA_CHECK *param, char *filename) my_bool born_transactional; MARIA_HA *info; File datafile; - char llbuff[22],llbuff2[22]; my_bool state_updated=0; MARIA_SHARE *share; DBUG_ENTER("maria_chk"); @@ -1373,9 +1372,8 @@ static int maria_chk(HA_CHECK *param, char *filename) if (!(param->testflag & T_VERY_SILENT) || param->testflag & T_INFO) printf("Checking Aria file: %s\n",filename); if (!(param->testflag & T_SILENT)) - printf("Data records: %7s Deleted blocks: %7s\n", - llstr(info->state->records,llbuff), - llstr(info->state->del,llbuff2)); + printf("Data records: %7lld Deleted blocks: %7lld\n", + info->state->records, info->state->del); maria_chk_init_for_check(param, info); if (opt_warning_for_wrong_transid == 0) param->max_trid= ~ (ulonglong) 0; @@ -1488,11 +1486,7 @@ static int maria_chk(HA_CHECK *param, char *filename) error= write_log_record(param); if (param->not_visible_rows_found && (param->testflag & T_VERBOSE)) - { - char buff[22]; - printf("Max transaction id found: %s\n", - llstr(param->max_found_trid, buff)); - } + printf("Max transaction id found: %lld\n", param->max_found_trid); fflush(stdout); fflush(stderr); @@ -1539,7 +1533,6 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) char buff[200],length[10],*pos,*end; enum en_fieldtype type; MARIA_SHARE *share= info->s; - char llbuff[22],llbuff2[22]; DBUG_ENTER("descript"); if (param->testflag & T_VERY_SILENT) @@ -1547,8 +1540,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) longlong checksum= info->state->checksum; if (!(share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))) checksum= 0; - printf("%s %s %s\n", name, llstr(info->state->records,llbuff), - llstr(checksum, llbuff2)); + printf("%s %lld %lld\n", name, info->state->records, checksum); DBUG_VOID_RETURN; } @@ -1583,8 +1575,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) LSN_IN_PARTS(share->state.create_rename_lsn), LSN_IN_PARTS(share->state.is_of_horizon), LSN_IN_PARTS(share->state.skip_redo_lsn)); - printf("create_trid: %s\n", - llstr(share->state.create_trid, llbuff)); + printf("create_trid: %lld\n", share->state.create_trid); } compile_time_assert((MY_UUID_STRING_LENGTH + 1) <= sizeof(buff)); buff[MY_UUID_STRING_LENGTH]= 0; @@ -1630,8 +1621,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) } printf("Status: %s\n",buff); if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)) - printf("Checksum: %26s\n",llstr(info->state->checksum,llbuff)); -; + printf("Checksum: %26lu\n", (unsigned long) info->state->checksum); if (share->options & HA_OPTION_DELAY_KEY_WRITE) printf("Keys are only flushed at close\n"); @@ -1639,29 +1629,26 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) printf("Page checksums are used\n"); if (share->base.auto_key) { - printf("Auto increment key: %16d Last value: %18s\n", - share->base.auto_key, - llstr(share->state.auto_increment,llbuff)); + printf("Auto increment key: %16d Last value: %18lld\n", + share->base.auto_key, share->state.auto_increment); } } - printf("Data records: %16s Deleted blocks: %18s\n", - llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2)); + printf("Data records: %16lld Deleted blocks: %18lld\n", + info->state->records, info->state->del); if (param->testflag & T_SILENT) DBUG_VOID_RETURN; /* This is enough */ if (param->testflag & T_VERBOSE) { #ifdef USE_RELOC - printf("Init-relocation: %16s\n",llstr(share->base.reloc,llbuff)); + printf("Init-relocation: %16lld\n", share->base.reloc); #endif - printf("Datafile parts: %16s Deleted data: %18s\n", - llstr(share->state.split,llbuff), - llstr(info->state->empty,llbuff2)); + printf("Datafile parts: %16lld Deleted data: %18lld\n", + share->state.split, info->state->empty); printf("Datafile pointer (bytes): %11d Keyfile pointer (bytes): %13d\n", share->rec_reflength,share->base.key_reflength); - printf("Datafile length: %16s Keyfile length: %18s\n", - llstr(info->state->data_file_length,llbuff), - llstr(info->state->key_file_length,llbuff2)); + printf("Datafile length: %16lld Keyfile length: %18lld\n", + info->state->data_file_length, info->state->key_file_length); if (info->s->base.reloc == 1L && info->s->base.records == 1L) puts("This is a one-record table"); @@ -1669,9 +1656,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) { if (share->base.max_data_file_length != HA_OFFSET_ERROR || share->base.max_key_file_length != HA_OFFSET_ERROR) - printf("Max datafile length: %16s Max keyfile length: %18s\n", - ullstr(share->base.max_data_file_length,llbuff), - ullstr(share->base.max_key_file_length,llbuff2)); + printf("Max datafile length: %16llu Max keyfile length: %18llu\n", + share->base.max_data_file_length, share->base.max_key_file_length); } } printf("Block_size: %16d\n",(int) share->block_size); @@ -1717,14 +1703,16 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) printf("%-4d%-6ld%-3d %-9s%-23s", key+1,(long) keyseg->start+1,keyseg->length,text,buff); - if (share->state.key_root[key] != HA_OFFSET_ERROR) - llstr(share->state.key_root[key],buff); - else - buff[0]=0; if (param->testflag & T_VERBOSE) + { + if (share->state.key_root[key] == HA_OFFSET_ERROR) + buff[0]= '\0'; + else + longlong10_to_str(share->state.key_root[key], buff, 10); printf("%9.0f %12s %10d", share->state.rec_per_key_part[keyseg_nr++], - buff,keyinfo->block_length); + buff, keyinfo->block_length); + } putchar('\n'); while ((++keyseg)->type != HA_KEYTYPE_END) { @@ -1857,7 +1845,6 @@ static int maria_sort_records(HA_CHECK *param, uchar *temp_buff; ha_rows old_record_count; MARIA_SHARE *share= info->s; - char llbuff[22],llbuff2[22]; MARIA_SORT_INFO sort_info; MARIA_SORT_PARAM sort_param; MARIA_PAGE page; @@ -1908,9 +1895,8 @@ static int maria_sort_records(HA_CHECK *param, { printf("- Sorting records for Aria table '%s'\n",name); if (write_info) - printf("Data records: %9s Deleted: %9s\n", - llstr(info->state->records,llbuff), - llstr(info->state->del,llbuff2)); + printf("Data records: %9lld Deleted: %9lld\n", + info->state->records, info->state->del); } if (share->state.key_root[sort_key] == HA_OFFSET_ERROR) DBUG_RETURN(0); /* Nothing to do */ @@ -1963,8 +1949,8 @@ static int maria_sort_records(HA_CHECK *param, share->state.key_root[sort_key], MYF(MY_NABP+MY_WME))) { - _ma_check_print_error(param, "Can't read indexpage from filepos: %s", - llstr(share->state.key_root[sort_key], llbuff)); + _ma_check_print_error(param, "Can't read indexpage from filepos: %lld", + share->state.key_root[sort_key]); goto err; } @@ -1988,9 +1974,8 @@ static int maria_sort_records(HA_CHECK *param, if (info->state->records != old_record_count) { - _ma_check_print_error(param,"found %s of %s records", - llstr(info->state->records,llbuff), - llstr(old_record_count,llbuff2)); + _ma_check_print_error(param, "found %lld of %lld records", + info->state->records, old_record_count); goto err; } @@ -2049,7 +2034,6 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param, uchar *temp_buff,*keypos,*endpos; my_off_t next_page,rec_pos; uchar *lastkey; - char llbuff[22]; MARIA_SORT_INFO *sort_info= sort_param->sort_info; HA_CHECK *param=sort_info->param; MARIA_KEY tmp_key; @@ -2087,8 +2071,8 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param, (uint) tmp_key.keyinfo->block_length, next_page, MYF(MY_NABP+MY_WME))) { - _ma_check_print_error(param,"Can't read keys from filepos: %s", - llstr(next_page,llbuff)); + _ma_check_print_error(param, "Can't read keys from filepos: %lld", + next_page); goto err; } _ma_page_setup(&new_page, info, ma_page->keyinfo, next_page, temp_buff); diff --git a/storage/maria/aria_pack.c b/storage/maria/aria_pack.c index 43150d6e02c7e..f9ae09434e2c0 100644 --- a/storage/maria/aria_pack.c +++ b/storage/maria/aria_pack.c @@ -1211,7 +1211,6 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) { uint idx; my_off_t total_count; - char llbuf[32]; DBUG_PRINT("info", ("column: %3u", (uint) (count - huff_counts + 1))); if (verbose >= 2) @@ -1232,19 +1231,17 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) if (count->counts[idx]) { total_count+= count->counts[idx]; - DBUG_PRINT("info", ("counts[0x%02x]: %12s", idx, - llstr((longlong) count->counts[idx], llbuf))); + DBUG_PRINT("info", ("counts[0x%02x]: %12lld", idx, + (longlong) count->counts[idx])); if (verbose >= 2) - printf("counts[0x%02x]: %12s\n", idx, - llstr((longlong) count->counts[idx], llbuf)); + printf("counts[0x%02x]: %12lld\n", idx, + (longlong) count->counts[idx]); } } - DBUG_PRINT("info", ("total: %12s", llstr((longlong) total_count, - llbuf))); + DBUG_PRINT("info", ("total: %12lld", (longlong) total_count)); if ((verbose >= 2) && total_count) { - printf("total: %12s\n", - llstr((longlong) total_count, llbuf)); + printf("total: %12lld\n", (longlong) total_count); } } @@ -2514,7 +2511,6 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) uint i,max_calc_length,pack_ref_length,min_record_length,max_record_length; uint intervall,field_length,max_pack_length,pack_blob_length, null_bytes; my_off_t record_count; - char llbuf[32]; ulong length,pack_length; uchar *record,*pos,*end_pos,*record_pos,*start_pos; HUFF_COUNTS *count,*end_count; @@ -2885,7 +2881,7 @@ static int compress_maria_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) fprintf(stderr, "%s: Got error %d reading records\n", my_progname, error); } if (verbose >= 2) - printf("wrote %s records.\n", llstr((longlong) record_count, llbuf)); + printf("wrote %lld records.\n", (longlong) record_count); my_safe_afree(record, isam_file->s->base.reclength); mrg->ref_length=max_pack_length; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index aea4e35a8c79a..1a14f57f47759 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1504,13 +1504,8 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) if (!error && start_records != file->state->records && !(check_opt->flags & T_VERY_SILENT)) - { - char llbuff[22], llbuff2[22]; - sql_print_information("Found %s of %s rows when repairing '%s'", - llstr(file->state->records, llbuff), - llstr(start_records, llbuff2), - table->s->path.str); - } + sql_print_information("Found %lld of %lld rows when repairing '%s'", + file->state->records, start_records, table->s->path.str); thd_proc_info(thd, old_proc_info); thd_progress_end(thd); return error; @@ -1788,10 +1783,8 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) HA_STATUS_CONST); if (rows != file->state->records && !(param->testflag & T_VERY_SILENT)) { - char llbuff[22], llbuff2[22]; - _ma_check_print_warning(param, "Number of rows changed from %s to %s", - llstr(rows, llbuff), - llstr(file->state->records, llbuff2)); + _ma_check_print_warning(param, "Number of rows changed from %lld to %lld", + rows, file->state->records); /* ma_check_print_warning() may generate an error in case of creating keys for ALTER TABLE. In this case we should signal an error. diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c index e3f8cb3ed8482..442455a71456b 100644 --- a/storage/maria/ma_bitmap.c +++ b/storage/maria/ma_bitmap.c @@ -920,10 +920,9 @@ void _ma_print_bitmap(MARIA_FILE_BITMAP *bitmap, uchar *data, pgcache_page_no_t page) { uchar *pos, *end; - char llbuff[22]; DBUG_LOCK_FILE; - fprintf(DBUG_FILE,"\nDump of bitmap page at %s\n", llstr(page, llbuff)); + fprintf(DBUG_FILE,"\nDump of bitmap page at %lld\n", page); page++; /* Skip bitmap page */ for (pos= data, end= pos + bitmap->max_total_size; @@ -942,7 +941,7 @@ void _ma_print_bitmap(MARIA_FILE_BITMAP *bitmap, uchar *data, for (i= 0; i < 16 ; i++, bits>>= 3) { if (bits & 7) - fprintf(DBUG_FILE, "Page: %8s %s\n", llstr(page+i, llbuff), + fprintf(DBUG_FILE, "Page: %8lld %s\n", page+i, bits_to_txt[bits & 7]); } } diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 9863209d49c47..5e229f9356a91 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -216,7 +216,7 @@ int maria_chk_del(HA_CHECK *param, register MARIA_HA *info, reg2 ha_rows i; uint delete_link_length; my_off_t empty,next_link,UNINIT_VAR(old_link); - char buff[22],buff2[22]; + char buff[22]; DBUG_ENTER("maria_chk_del"); param->record_checksum=0; @@ -248,22 +248,22 @@ int maria_chk_del(HA_CHECK *param, register MARIA_HA *info, if (_ma_killed_ptr(param)) DBUG_RETURN(1); if (test_flag & T_VERBOSE) - printf(" %9s",llstr(next_link,buff)); + printf(" %9lld", next_link); if (next_link >= share->state.state.data_file_length) goto wrong; if (mysql_file_pread(info->dfile.file, (uchar*) buff, delete_link_length, next_link,MYF(MY_NABP))) { if (test_flag & T_VERBOSE) puts(""); - _ma_check_print_error(param,"Can't read delete-link at filepos: %s", - llstr(next_link,buff)); + _ma_check_print_error(param, "Can't read delete-link at filepos: %lld", + next_link); DBUG_RETURN(1); } if (*buff != '\0') { if (test_flag & T_VERBOSE) puts(""); - _ma_check_print_error(param,"Record at pos: %s is not remove-marked", - llstr(next_link,buff)); + _ma_check_print_error(param, "Record at pos: %lld is not remove-marked", + next_link); goto wrong; } if (share->options & HA_OPTION_PACK_RECORD) @@ -273,8 +273,8 @@ int maria_chk_del(HA_CHECK *param, register MARIA_HA *info, { if (test_flag & T_VERBOSE) puts(""); _ma_check_print_error(param, - "Deleted block at %s doesn't point back at previous delete link", - llstr(next_link,buff2)); + "Deleted block at %lld doesn't point back at previous delete link", + next_link); goto wrong; } old_link=next_link; @@ -293,23 +293,21 @@ int maria_chk_del(HA_CHECK *param, register MARIA_HA *info, if (empty != share->state.state.empty) { _ma_check_print_warning(param, - "Found %s deleted space in delete link chain. Should be %s", - llstr(empty,buff2), - llstr(share->state.state.empty,buff)); + "Found %lld deleted space in delete link chain. Should be %lld", + empty, share->state.state.empty); } if (next_link != HA_OFFSET_ERROR) { _ma_check_print_error(param, - "Found more than the expected %s deleted rows in delete link chain", - llstr(share->state.state.del, buff)); + "Found more than the expected %lld deleted rows in delete link chain", + share->state.state.del); goto wrong; } if (i != 0) { _ma_check_print_error(param, - "Found %s deleted rows in delete link chain. Should be %s", - llstr(share->state.state.del - i, buff2), - llstr(share->state.state.del, buff)); + "Found %lld deleted rows in delete link chain. Should be %lld", + share->state.state.del - i, share->state.state.del); goto wrong; } } @@ -332,7 +330,6 @@ static int check_k_link(HA_CHECK *param, register MARIA_HA *info, MARIA_SHARE *share= info->s; uint block_size= share->block_size; ha_rows records; - char llbuff[21], llbuff2[21]; uchar *buff; DBUG_ENTER("check_k_link"); @@ -345,16 +342,16 @@ static int check_k_link(HA_CHECK *param, register MARIA_HA *info, if (_ma_killed_ptr(param)) DBUG_RETURN(1); if (param->testflag & T_VERBOSE) - printf("%16s",llstr(next_link,llbuff)); + printf("%16lld", next_link); /* Key blocks must lay within the key file length entirely. */ if (next_link + block_size > share->state.state.key_file_length) { /* purecov: begin tested */ - _ma_check_print_error(param, "Invalid key block position: %s " - "key block size: %u file_length: %s", - llstr(next_link, llbuff), block_size, - llstr(share->state.state.key_file_length, llbuff2)); + _ma_check_print_error(param, "Invalid key block position: %lld " + "key block size: %u file_length: %lld", + next_link, block_size, + share->state.state.key_file_length); DBUG_RETURN(1); /* purecov: end */ } @@ -363,10 +360,9 @@ static int check_k_link(HA_CHECK *param, register MARIA_HA *info, if (next_link & (block_size -1)) { /* purecov: begin tested */ - _ma_check_print_error(param, "Mis-aligned key block: %s " - "minimum key block length: %u", - llstr(next_link, llbuff), - block_size); + _ma_check_print_error(param, + "Mis-aligned key block: %lld minimum key block length: %u", + next_link, block_size); DBUG_RETURN(1); /* purecov: end */ } @@ -380,14 +376,14 @@ static int check_k_link(HA_CHECK *param, register MARIA_HA *info, PAGECACHE_LOCK_LEFT_UNLOCKED, 0))) { /* purecov: begin tested */ - _ma_check_print_error(param, "key cache read error for block: %s", - llstr(next_link,llbuff)); + _ma_check_print_error(param, "key cache read error for block: %lld", + next_link); DBUG_RETURN(1); /* purecov: end */ } if (_ma_get_keynr(info->s, buff) != MARIA_DELETE_KEY_NR) - _ma_check_print_error(param, "Page at %s is not delete marked", - llstr(next_link, llbuff)); + _ma_check_print_error(param, "Page at %lld is not delete marked", + next_link); next_link= mi_sizekorr(buff + share->keypage_header); records--; @@ -396,7 +392,7 @@ static int check_k_link(HA_CHECK *param, register MARIA_HA *info, if (param->testflag & T_VERBOSE) { if (next_link != HA_OFFSET_ERROR) - printf("%16s\n",llstr(next_link,llbuff)); + printf("%16lld\n", next_link); else puts(""); } @@ -411,7 +407,6 @@ int maria_chk_size(HA_CHECK *param, register MARIA_HA *info) MARIA_SHARE *share= info->s; int error; register my_off_t skr,size; - char buff[22],buff2[22]; DBUG_ENTER("maria_chk_size"); if (info->s3) @@ -442,29 +437,26 @@ int maria_chk_size(HA_CHECK *param, register MARIA_HA *info) { error=1; _ma_check_print_error(param, - "Size of indexfile is: %-8s Expected: %s", - llstr(size,buff), llstr(skr,buff2)); + "Size of indexfile is: %-8lld Expected: %lld", size, skr); share->state.state.key_file_length= size; } else if (!(param->testflag & T_VERY_SILENT)) _ma_check_print_warning(param, - "Size of indexfile is: %-8s Expected: %s", - llstr(size,buff), llstr(skr,buff2)); + "Size of indexfile is: %-8lld Expected: %lld", size, skr); } if (size > share->base.max_key_file_length) { - _ma_check_print_warning(param, - "Size of indexfile is: %-8s which is bigger than max indexfile size: %s", - ullstr(size,buff), - ullstr(share->base.max_key_file_length, buff2)); + _ma_check_print_warning(param, "Size of indexfile is: %-8llu " + "which is bigger than max indexfile size: %llu", + size, share->base.max_key_file_length); } else if (!(param->testflag & T_VERY_SILENT) && ! (share->options & HA_OPTION_COMPRESS_RECORD) && ulonglong2double(share->state.state.key_file_length) > ulonglong2double(share->base.margin_key_file_length)*0.9) - _ma_check_print_warning(param,"Keyfile is almost full, %10s of %10s used", - llstr(share->state.state.key_file_length,buff), - llstr(share->base.max_key_file_length,buff)); + _ma_check_print_warning(param, + "Keyfile is almost full, %10lld of %10lld used", + share->state.state.key_file_length, share->base.max_key_file_length); size= mysql_file_seek(info->dfile.file, 0L, MY_SEEK_END, MYF(0)); skr=(my_off_t) share->state.state.data_file_length; @@ -481,30 +473,28 @@ int maria_chk_size(HA_CHECK *param, register MARIA_HA *info) if (skr > size && skr != size + MEMMAP_EXTRA_MARGIN) { error=1; - _ma_check_print_error(param,"Size of datafile is: %-9s Expected: %s", - llstr(size,buff), llstr(skr,buff2)); + _ma_check_print_error(param, + "Size of datafile is: %-9lld Expected: %lld", size, skr); param->testflag|=T_RETRY_WITHOUT_QUICK; } else { _ma_check_print_warning(param, - "Size of datafile is: %-9s Expected: %s", - llstr(size,buff), llstr(skr,buff2)); + "Size of datafile is: %-9lld Expected: %lld", size, skr); } } if (size > share->base.max_data_file_length) { - _ma_check_print_warning(param, - "Size of datafile is: %-8s which is bigger than max datafile size: %s", - ullstr(size,buff), - ullstr(share->base.max_data_file_length, buff2)); + _ma_check_print_warning(param, "Size of datafile is: %-8llu " + "which is bigger than max datafile size: %llu", + size, share->base.max_data_file_length); } else if (!(param->testflag & T_VERY_SILENT) && !(share->options & HA_OPTION_COMPRESS_RECORD) && ulonglong2double(share->state.state.data_file_length) > (ulonglong2double(share->base.max_data_file_length)*0.9)) - _ma_check_print_warning(param, "Datafile is almost full, %10s of %10s used", - llstr(share->state.state.data_file_length,buff), - llstr(share->base.max_data_file_length,buff2)); + _ma_check_print_warning(param, + "Datafile is almost full, %10lld of %10lld used", + share->state.state.data_file_length, share->base.max_data_file_length); DBUG_RETURN(error); } /* maria_chk_size */ @@ -520,7 +510,6 @@ int maria_chk_key(HA_CHECK *param, register MARIA_HA *info) double *rec_per_key_part; MARIA_SHARE *share= info->s; MARIA_KEYDEF *keyinfo; - char buff[22],buff2[22]; MARIA_PAGE page; DBUG_ENTER("maria_chk_key"); @@ -598,8 +587,8 @@ int maria_chk_key(HA_CHECK *param, register MARIA_HA *info) { if (keys != share->state.state.records) { - _ma_check_print_error(param,"Found %s keys of %s",llstr(keys,buff), - llstr(share->state.state.records,buff2)); + _ma_check_print_error(param, "Found %lld keys of %lld", keys, + share->state.state.records); if (!(param->testflag & (T_INFO | T_EXTEND))) DBUG_RETURN(-1); result= -1; @@ -636,10 +625,9 @@ int maria_chk_key(HA_CHECK *param, register MARIA_HA *info) keyseg->type); if (auto_increment > share->state.auto_increment) { - _ma_check_print_warning(param, "Auto-increment value: %s is smaller " - "than max used value: %s", - llstr(share->state.auto_increment,buff2), - llstr(auto_increment, buff)); + _ma_check_print_warning(param, + "Auto-increment value: %lld is smaller than max used value: %lld", + share->state.auto_increment, auto_increment); } if (param->testflag & T_AUTO_INC) { @@ -711,7 +699,6 @@ static int chk_index_down(HA_CHECK *param, MARIA_HA *info, my_off_t page, uchar *buff, ha_rows *keys, ha_checksum *key_checksum, uint level) { - char llbuff[22],llbuff2[22]; MARIA_SHARE *share= info->s; MARIA_PAGE ma_page; DBUG_ENTER("chk_index_down"); @@ -725,10 +712,9 @@ static int chk_index_down(HA_CHECK *param, MARIA_HA *info, /* Give it a chance to fit in the real file size. */ my_off_t max_length= mysql_file_seek(info->s->kfile.file, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)); - _ma_check_print_error(param, "Invalid key block position: %s " - "key block size: %u file_length: %s", - llstr(page, llbuff), keyinfo->block_length, - llstr(share->state.state.key_file_length, llbuff2)); + _ma_check_print_error(param, + "Invalid key block position: %lld key block size: %u file_length: %lld", + page, keyinfo->block_length, share->state.state.key_file_length); if (page + keyinfo->block_length > max_length) goto err; /* Fix the remembered key file length. */ @@ -741,9 +727,8 @@ static int chk_index_down(HA_CHECK *param, MARIA_HA *info, if (page & (info->s->block_size -1)) { /* purecov: begin tested */ - _ma_check_print_error(param, "Mis-aligned key block: %s " - "key block length: %u", - llstr(page, llbuff), info->s->block_size); + _ma_check_print_error(param, "Mis-aligned key block: %lld " + "key block length: %u", page, info->s->block_size); goto err; /* purecov: end */ } @@ -869,7 +854,6 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, uchar *temp_buff, *keypos, *old_keypos, *endpos; my_off_t next_page,record; MARIA_SHARE *share= info->s; - char llbuff[22]; uint diff_pos[2]; uchar *tmp_key_buff; my_bool temp_buff_alloced; @@ -911,17 +895,15 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, param->max_level=level; if (_ma_get_keynr(share, anc_page->buff) != keyinfo->key_nr) - _ma_check_print_error(param, "Page at %s is not marked for index %u", - llstr(anc_page->pos, llbuff), - (uint) keyinfo->key_nr); + _ma_check_print_error(param, "Page at %lld is not marked for index %u", + anc_page->pos, (uint) keyinfo->key_nr); if (page_flag & KEYPAGE_FLAG_HAS_TRANSID) { if (!share->base.born_transactional) { _ma_check_print_error(param, - "Page at %s is marked with HAS_TRANSID even if " - "table is not transactional", - llstr(anc_page->pos, llbuff)); + "Page at %lld is marked with HAS_TRANSID even if " + "table is not transactional", anc_page->pos); } } if (share->base.born_transactional) @@ -932,11 +914,9 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, /* Avoid flooding of errors */ if (param->skip_lsn_error_count++ < MAX_LSN_ERRORS) { - _ma_check_print_error(param, - "Page at %s as wrong LSN " LSN_FMT ". Current " - "LSN is " LSN_FMT, - llstr(anc_page->pos, llbuff), - LSN_IN_PARTS(lsn), + _ma_check_print_error(param, "Page at %lld as wrong LSN " LSN_FMT + ". Current LSN is " LSN_FMT, + anc_page->pos, LSN_IN_PARTS(lsn), LSN_IN_PARTS(param->max_allowed_lsn)); } } @@ -944,8 +924,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, if (anc_page->size > share->max_index_block_size) { _ma_check_print_error(param, - "Page at %s has impossible (too big) pagelength", - llstr(anc_page->pos, llbuff)); + "Page at %lld has impossible (too big) pagelength", anc_page->pos); goto err; } @@ -974,8 +953,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, { _ma_check_print_error(param, "Page length and length of keys don't match at " - "page: %s", - llstr(anc_page->pos,llbuff)); + "page: %lld", anc_page->pos); goto err; } if (share->data_file_type == BLOCK_RECORD && @@ -985,8 +963,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, { _ma_check_print_error(param, "Found key marked for transid on page that is not " - "marked for transid at: %s", - llstr(anc_page->pos,llbuff)); + "marked for transid at: %lld", anc_page->pos); goto err; } @@ -1001,11 +978,11 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, DBUG_DUMP("new_in_page", old_keypos, (uint) (keypos-old_keypos)); if ((comp_flag & SEARCH_FIND) && flag == 0) - _ma_check_print_error(param,"Found duplicated key at page %s", - llstr(anc_page->pos,llbuff)); + _ma_check_print_error(param, "Found duplicated key at page %lld", + anc_page->pos); else - _ma_check_print_error(param,"Key in wrong position at page %s", - llstr(anc_page->pos,llbuff)); + _ma_check_print_error(param, "Key in wrong position at page %lld", + anc_page->pos); goto err; } @@ -1055,8 +1032,8 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, _ma_check_print_error(param, "Number of words in the 2nd level tree " "does not match the number in the header. " - "Parent word in on the page %s, offset %u", - llstr(anc_page->pos,llbuff), + "Parent word in on the page %lld, offset %u", + anc_page->pos, (uint) (old_keypos - anc_page->buff)); goto err; } @@ -1073,16 +1050,11 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, share->state.state.data_file_length) || (share->data_file_type == NO_RECORD && record != 0)) { -#ifdef DBUG_TRACE - char llbuff2[22], llbuff3[22]; -#endif _ma_check_print_error(param, - "Found key at page %s that points to record " - "outside datafile", - llstr(anc_page->pos,llbuff)); - DBUG_PRINT("test",("page: %s record: %s filelength: %s", - llstr(anc_page->pos,llbuff),llstr(record,llbuff2), - llstr(share->state.state.data_file_length,llbuff3))); + "Found key at page %lld that points to record " + "outside datafile", anc_page->pos); + DBUG_PRINT("test", ("page: %lld record: %lld filelength: %lld", + anc_page->pos, record, share->state.state.data_file_length)); DBUG_DUMP_KEY("key", &tmp_key); DBUG_DUMP("new_in_page", old_keypos, (uint) (keypos-old_keypos)); goto err; @@ -1091,10 +1063,9 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, } if (keypos != endpos) { - _ma_check_print_error(param, - "Keyblock size at page %s is not correct. " + _ma_check_print_error(param, "Keyblock size at page %lld is not correct. " "Block length: %u key length: %u", - llstr(anc_page->pos, llbuff), anc_page->size, + anc_page->pos, anc_page->size, (uint) (keypos - anc_page->buff)); goto err; } @@ -1152,7 +1123,7 @@ static char * record_pos_to_txt(MARIA_HA *info, my_off_t recpos, char *buff) { if (info->s->data_file_type != BLOCK_RECORD) - llstr(recpos, buff); + longlong10_to_str(recpos, buff, 10); else { my_off_t page= ma_recordpos_to_page(recpos); @@ -1194,7 +1165,7 @@ static int check_keys_in_record(HA_CHECK *param, MARIA_HA *info, int extend, { if (param->testflag & T_WRITE_LOOP) { - printf("%s\r", llstr(param->records, llbuff)); + printf("%lld\r", param->records); fflush(stdout); } _ma_report_progress(param, param->records, share->state.state.records); @@ -1261,7 +1232,6 @@ static int check_static_record(HA_CHECK *param, MARIA_HA *info, int extend, { MARIA_SHARE *share= info->s; my_off_t start_recpos, pos; - char llbuff[22]; pos= 0; while (pos < share->state.state.data_file_length) @@ -1272,9 +1242,7 @@ static int check_static_record(HA_CHECK *param, MARIA_HA *info, int extend, share->base.pack_reclength)) { _ma_check_print_error(param, - "got error: %d when reading datafile at position: " - "%s", - my_errno, llstr(pos, llbuff)); + "got error: %d when reading datafile at position: %lld", my_errno, pos); return 1; } start_recpos= pos; @@ -1304,7 +1272,6 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, uchar *UNINIT_VAR(to); ulong UNINIT_VAR(left_length); uint b_type; - char llbuff[22],llbuff2[22],llbuff3[22]; DBUG_ENTER("check_dynamic_record"); pos= 0; @@ -1326,15 +1293,14 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, { _ma_check_print_error(param, "got error: %d when reading datafile at " - "position: %s", - my_errno, llstr(start_block, llbuff)); + "position: %lld", my_errno, start_block); DBUG_RETURN(1); } if (start_block & (MARIA_DYN_ALIGN_SIZE-1)) { - _ma_check_print_error(param,"Wrong aligned block at %s", - llstr(start_block,llbuff)); + _ma_check_print_error(param, "Wrong aligned block at %lld", + start_block); DBUG_RETURN(1); } b_type= _ma_get_block_info(info, &block_info,-1,start_block); @@ -1345,9 +1311,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, { if (flag) { - _ma_check_print_error(param,"Unexpected byte: %d at link: %s", - (int) block_info.header[0], - llstr(start_block,llbuff)); + _ma_check_print_error(param, "Unexpected byte: %d at link: %lld", + (int) block_info.header[0], start_block); DBUG_RETURN(1); } pos=block_info.filepos+block_info.block_len; @@ -1358,9 +1323,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, if (block_info.block_len < share->base.min_block_length) { _ma_check_print_error(param, - "Deleted block with impossible length %lu " - "at %s", - block_info.block_len,llstr(pos,llbuff)); + "Deleted block with impossible length %lu at %lld", + block_info.block_len, pos); DBUG_RETURN(1); } if ((block_info.next_filepos != HA_OFFSET_ERROR && @@ -1368,9 +1332,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, (block_info.prev_filepos != HA_OFFSET_ERROR && block_info.prev_filepos >= share->state.state.data_file_length)) { - _ma_check_print_error(param,"Delete link points outside datafile " - "at %s", - llstr(pos,llbuff)); + _ma_check_print_error(param, + "Delete link points outside datafile at %lld", pos); DBUG_RETURN(1); } param->del_blocks++; @@ -1379,18 +1342,17 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, pos= block_info.filepos+block_info.block_len; goto next; } - _ma_check_print_error(param,"Wrong bytesec: %d-%d-%d at linkstart: %s", + _ma_check_print_error(param, + "Wrong bytesec: %d-%d-%d at linkstart: %lld", block_info.header[0],block_info.header[1], - block_info.header[2], - llstr(start_block,llbuff)); + block_info.header[2],start_block); DBUG_RETURN(1); } if (share->state.state.data_file_length < block_info.filepos+ block_info.block_len) { _ma_check_print_error(param, - "Recordlink that points outside datafile at %s", - llstr(pos,llbuff)); + "Recordlink that points outside datafile at %lld", pos); got_error=1; break; } @@ -1402,9 +1364,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, if (block_info.rec_len > (uint) share->base.max_pack_length) { my_errno= HA_ERR_WRONG_IN_RECORD; - _ma_check_print_error(param,"Found too long record (%lu) at %s", - (ulong) block_info.rec_len, - llstr(start_recpos,llbuff)); + _ma_check_print_error(param, "Found too long record (%lu) at %lld", + (ulong) block_info.rec_len, start_recpos); got_error=1; break; } @@ -1417,9 +1378,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, { _ma_check_print_error(param, - "Not enough memory (%lu) for blob at %s", - (ulong) block_info.rec_len, - llstr(start_recpos,llbuff)); + "Not enough memory (%lu) for blob at %lld", + (ulong) block_info.rec_len, start_recpos); got_error=1; break; } @@ -1429,9 +1389,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, } if (left_length < block_info.data_len) { - _ma_check_print_error(param,"Found too long record (%lu) at %s", - (ulong) block_info.data_len, - llstr(start_recpos,llbuff)); + _ma_check_print_error(param, "Found too long record (%lu) at %lld", + (ulong) block_info.data_len, start_recpos); got_error=1; break; } @@ -1440,9 +1399,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, flag == 1 ? READING_NEXT : 0)) { _ma_check_print_error(param, - "got error: %d when reading datafile at " - "position: %s", my_errno, - llstr(block_info.filepos, llbuff)); + "got error: %d when reading datafile at position: %lld", + my_errno, block_info.filepos); DBUG_RETURN(1); } @@ -1456,10 +1414,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, if (b_type & BLOCK_LAST) { _ma_check_print_error(param, - "Wrong record length %s of %s at %s", - llstr(block_info.rec_len-left_length,llbuff), - llstr(block_info.rec_len, llbuff2), - llstr(start_recpos,llbuff3)); + "Wrong record length %ld of %ld at %lld", + block_info.rec_len-left_length, block_info.rec_len, start_recpos); got_error=1; break; } @@ -1467,8 +1423,7 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, { _ma_check_print_error(param, "Found next-recordlink that points outside " - "datafile at %s", - llstr(block_info.filepos,llbuff)); + "datafile at %lld", block_info.filepos); got_error=1; break; } @@ -1480,8 +1435,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, if (_ma_rec_unpack(info,record,info->rec_buff,block_info.rec_len) == MY_FILE_ERROR) { - _ma_check_print_error(param,"Found wrong record at %s", - llstr(start_recpos,llbuff)); + _ma_check_print_error(param, "Found wrong record at %lld", + start_recpos); got_error=1; } else @@ -1495,8 +1450,8 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, if (_ma_rec_check(info,record, info->rec_buff,block_info.rec_len, MY_TEST(share->calc_checksum), checksum)) { - _ma_check_print_error(param,"Found wrong packed record at %s", - llstr(start_recpos,llbuff)); + _ma_check_print_error(param, "Found wrong packed record at %lld", + start_recpos); got_error= 1; } } @@ -1528,7 +1483,6 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend, MARIA_BLOCK_INFO block_info; MARIA_SHARE *share= info->s; my_off_t start_recpos, pos; - char llbuff[22]; my_bool got_error= 0; DBUG_ENTER("check_compressed_record"); @@ -1542,9 +1496,7 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend, share->pack.ref_length, READING_NEXT)) { _ma_check_print_error(param, - "got error: %d when reading datafile at position: " - "%s", - my_errno, llstr(pos, llbuff)); + "got error: %d when reading datafile at position: %lld", my_errno, pos); DBUG_RETURN(1); } @@ -1558,8 +1510,8 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend, block_info.rec_len > (uint) share->max_pack_length) { _ma_check_print_error(param, - "Found block with wrong recordlength: %lu at %s", - block_info.rec_len, llstr(start_recpos,llbuff)); + "Found block with wrong recordlength: %lu at %lld", + block_info.rec_len, start_recpos); got_error=1; goto end; } @@ -1568,16 +1520,14 @@ static int check_compressed_record(HA_CHECK *param, MARIA_HA *info, int extend, { _ma_check_print_error(param, "got error: %d when reading datafile at position: " - "%s", - my_errno, llstr(block_info.filepos, llbuff)); + "%lld", my_errno, block_info.filepos); DBUG_RETURN(1); } info->rec_buff[block_info.rec_len]= 0; /* Keep valgrind happy */ if (_ma_pack_rec_unpack(info, &info->bit_buff, record, info->rec_buff, block_info.rec_len)) { - _ma_check_print_error(param,"Found wrong record at %s", - llstr(start_recpos,llbuff)); + _ma_check_print_error(param, "Found wrong record at %lld", start_recpos); got_error=1; goto end; } @@ -1617,7 +1567,6 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info, uint empty, last_row_end, row, first_dir_entry, free_entry, block_size; uint free_entries, prev_free_entry; uchar *dir_entry; - char llbuff[22]; my_bool error_in_free_list= 0; DBUG_ENTER("check_page_layout"); @@ -1636,9 +1585,7 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info, if (free_entry > row_count) { _ma_check_print_error(param, - "Page %9s: Directory free entry points outside " - "directory", - llstr(page_pos, llbuff)); + "Page %9lld: Directory free entry points outside directory", page_pos); error_in_free_list= 1; break; } @@ -1646,18 +1593,16 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info, if (uint2korr(dir) != 0) { _ma_check_print_error(param, - "Page %9s: Directory free entry points to " - "not deleted entry", - llstr(page_pos, llbuff)); + "Page %9lld: Directory free entry points to " + "not deleted entry", page_pos); error_in_free_list= 1; break; } if (dir[2] != prev_free_entry) { _ma_check_print_error(param, - "Page %9s: Directory free list back pointer " - "points to wrong entry", - llstr(page_pos, llbuff)); + "Page %9lld: Directory free list back pointer " + "points to wrong entry", page_pos); error_in_free_list= 1; break; } @@ -1682,8 +1627,7 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info, if (row == row_count -1) { _ma_check_print_error(param, - "Page %9s: First entry in directory is 0", - llstr(page_pos, llbuff)); + "Page %9lld: First entry in directory is 0", page_pos); if (param->err_count++ > MAXERR || !(param->testflag & T_VERBOSE)) DBUG_RETURN(1); } @@ -1695,8 +1639,7 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info, if (pos < last_row_end) { _ma_check_print_error(param, - "Page %9s: Row %3u overlapps with previous row", - llstr(page_pos, llbuff), row); + "Page %9lld Row %3u overlaps with previous row", page_pos, row); DBUG_RETURN(1); } empty+= (pos - last_row_end); @@ -1704,8 +1647,7 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info, if (last_row_end > first_dir_entry) { _ma_check_print_error(param, - "Page %9s: Row %3u overlapps with directory", - llstr(page_pos, llbuff), row); + "Page %9lld: Row %3u overlaps with directory", page_pos, row); DBUG_RETURN(1); } } @@ -1714,17 +1656,15 @@ static int check_page_layout(HA_CHECK *param, MARIA_HA *info, if (empty != head_empty) { _ma_check_print_error(param, - "Page %9s: Wrong empty size. Stored: %5u " - "Actual: %5u", - llstr(page_pos, llbuff), head_empty, empty); + "Page %9lld: Wrong empty size. Stored: %5u " + "Actual: %5u", page_pos, head_empty, empty); param->err_count++; } if (free_entries != 0 && !error_in_free_list) { _ma_check_print_error(param, - "Page %9s: Directory free link don't include " - "all free entries", - llstr(page_pos, llbuff)); + "Page %9lld: Directory free link don't include " + "all free entries", page_pos); param->err_count++; } DBUG_RETURN(param->err_count && @@ -1754,7 +1694,6 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record, MARIA_SHARE *share= info->s; uchar *dir_entry; uint row; - char llbuff[22], llbuff2[22]; ulonglong page= page_pos / share->block_size; DBUG_ENTER("check_head_page"); @@ -1770,28 +1709,23 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record, if (length < share->base.min_block_length) { _ma_check_print_error(param, - "Page %9s: Row %3u is too short " - "(%d of min %d bytes)", - llstr(page, llbuff), row, length, - (uint) share->base.min_block_length); + "Page %9lld: Row %3u is too short (%d of min %d bytes)", + page, row, length, (uint) share->base.min_block_length); DBUG_RETURN(1); } flag= (uint) (uchar) page_buff[pos]; if (flag & ~(ROW_FLAG_ALL)) _ma_check_print_error(param, - "Page %9s: Row %3u has wrong flag: %u", - llstr(page, llbuff), row, flag); + "Page %9lld: Row %3u has wrong flag: %u", page, row, flag); - DBUG_PRINT("info", ("rowid: %s page: %lu row: %u", - llstr(ma_recordpos(page, row), llbuff), - (ulong) page, row)); + DBUG_PRINT("info", ("rowid: %lld page: %lu row: %u", + ma_recordpos(page, row), (ulong) page, row)); info->cur_row.trid= 0; if (_ma_read_block_record2(info, record, page_buff+pos, page_buff+pos+length)) { _ma_check_print_error(param, - "Page %9s: Row %3d is crashed", - llstr(page, llbuff), row); + "Page %9lld: Row %3d is crashed", page, row); if (param->err_count++ > MAXERR || !(param->testflag & T_VERBOSE)) DBUG_RETURN(1); continue; @@ -1804,8 +1738,8 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record, { ha_checksum checksum= (*share->calc_checksum)(info, record); if (info->cur_row.checksum != (checksum & 255)) - _ma_check_print_error(param, "Page %9s: Row %3d has wrong checksum", - llstr(page, llbuff), row); + _ma_check_print_error(param, "Page %9lld: Row %3d has wrong checksum", + page, row); param->glob_crc+= checksum; } if (info->cur_row.extents_count) @@ -1837,13 +1771,10 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record, if (_ma_check_if_right_bitmap_type(info, page_type, extent_page, &bitmap_pattern)) { - _ma_check_print_error(param, - "Page %9s: Row: %3d has an extent with " - "wrong information in bitmap: " - "Page: %9s Page_type: %d Bitmap: %d", - llstr(page, llbuff), row, - llstr(extent_page, llbuff2), - page_type, bitmap_pattern); + _ma_check_print_error(param, "Page %9lld: " + "Row: %3d has an extent with wrong information in bitmap: " + "Page: %9lld Page_type: %d Bitmap: %d", + page, row, extent_page, page_type, bitmap_pattern); if (param->err_count++ > MAXERR || !(param->testflag & T_VERBOSE)) DBUG_RETURN(1); } @@ -1871,7 +1802,6 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, my_off_t pos; pgcache_page_no_t page; uchar *page_buff, *bitmap_buff, *data; - char llbuff[22], llbuff2[22]; uint block_size= share->block_size; ha_rows full_page_count, tail_count; my_bool UNINIT_VAR(full_dir), now_transactional; @@ -1920,8 +1850,7 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, PAGECACHE_LOCK_LEFT_UNLOCKED, 0) == 0) { _ma_check_print_error(param, - "Page %9s: Got error: %d when reading datafile", - llstr(page, llbuff), my_errno); + "Page %9lld: Got error: %d when reading datafile", page, my_errno); goto err; } param->used+= block_size; @@ -1950,17 +1879,15 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, PAGECACHE_LOCK_LEFT_UNLOCKED, 0) == 0) { _ma_check_print_error(param, - "Page %9s: Got error: %d when reading datafile", - llstr(page, llbuff), my_errno); + "Page %9lld: Got error: %d when reading datafile", page, my_errno); goto err; } page_type= page_buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK; if (page_type == UNALLOCATED_PAGE || page_type >= MAX_PAGE_TYPE) { _ma_check_print_error(param, - "Page: %9s Found wrong page type %d. Bitmap: %d '%s'", - llstr(page, llbuff), page_type, - bitmap_for_page, bits_to_txt[bitmap_for_page]); + "Page: %9lld Found wrong page type %d. Bitmap: %d '%s'", + page, page_type, bitmap_for_page, bits_to_txt[bitmap_for_page]); if (param->err_count++ > MAXERR || !(param->testflag & T_VERBOSE)) goto err; continue; @@ -2012,10 +1939,10 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, bitmap_for_page)) { _ma_check_print_error(param, - "Page %9s: Wrong data in bitmap. Page_type: " + "Page %9lld: Wrong data in bitmap. Page_type: " "%d full: %d empty_space: %u Bitmap-bits: %d " "'%s'", - llstr(page, llbuff), page_type, full_dir, + page, page_type, full_dir, empty_space, bitmap_for_page, bits_to_txt[bitmap_for_page]); if (param->err_count++ > MAXERR || !(param->testflag & T_VERBOSE)) @@ -2030,11 +1957,8 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, if (param->skip_lsn_error_count++ < MAX_LSN_ERRORS) { _ma_check_print_error(param, - "Page %9s: Wrong LSN " LSN_FMT ". Current " - "LSN is " LSN_FMT, - llstr(page, llbuff), - LSN_IN_PARTS(lsn), - LSN_IN_PARTS(param->max_allowed_lsn)); + "Page %9lld: Wrong LSN " LSN_FMT ". Current LSN is " LSN_FMT, + page, LSN_IN_PARTS(lsn), LSN_IN_PARTS(param->max_allowed_lsn)); } } } @@ -2079,9 +2003,8 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, bitmap_page*= share->bitmap.pages_covered; _ma_check_print_error(param, - "Bitmap at page %s has pages reserved outside of " - "data file length", - llstr(bitmap_page, llbuff)); + "Bitmap at page %lld has pages reserved outside of " + "data file length", bitmap_page); DBUG_EXECUTE("bitmap", _ma_print_bitmap(&share->bitmap, bitmap_buff, bitmap_page);); } @@ -2090,15 +2013,13 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, _ma_scan_end_block_record(info); if (full_page_count != param->full_page_count) - _ma_check_print_error(param, "Full page count read through records was %s " - "but we found %s pages while scanning table", - llstr(param->full_page_count, llbuff), - llstr(full_page_count, llbuff2)); + _ma_check_print_error(param, "Full page count read through records was %lld " + "but we found %lld pages while scanning table", + param->full_page_count, full_page_count); if (tail_count != param->tail_count) - _ma_check_print_error(param, "Tail count read through records was %s but " - "we found %s tails while scanning table", - llstr(param->tail_count, llbuff), - llstr(tail_count, llbuff2)); + _ma_check_print_error(param, "Tail count read through records was %lld but " + "we found %lld tails while scanning table", + param->tail_count, tail_count); info->s->now_transactional= now_transactional; return param->error_printed != 0; @@ -2117,7 +2038,6 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend) MARIA_SHARE *share= info->s; int error; uchar *record; - char llbuff[22],llbuff2[22],llbuff3[22]; DBUG_ENTER("maria_chk_data_link"); if (!(param->testflag & T_SILENT)) @@ -2183,9 +2103,8 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend) if (param->records != share->state.state.records) { _ma_check_print_error(param, - "Record-count is not ok; found %-10s Should be: %s", - llstr(param->records,llbuff), - llstr(share->state.state.records,llbuff2)); + "Record-count is not ok; found %-10lld Should be: %lld", + param->records, share->state.state.records); error=1; } if (param->record_checksum && @@ -2223,9 +2142,8 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend) if (param->del_length != share->state.state.empty) { _ma_check_print_warning(param, - "Found %s deleted space. Should be %s", - llstr(param->del_length,llbuff2), - llstr(share->state.state.empty,llbuff)); + "Found %lld deleted space. Should be %lld", + param->del_length, share->state.state.empty); } /* Skip following checks for BLOCK RECORD as they don't make any sence */ if (share->data_file_type != BLOCK_RECORD) @@ -2234,31 +2152,23 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend) share->state.state.data_file_length) { _ma_check_print_warning(param, - "Found %s record data and %s unused data and %s " - "deleted data", - llstr(param->used, llbuff), - llstr(param->empty,llbuff2), - llstr(param->del_length,llbuff3)); - _ma_check_print_warning(param, - "Total %s Should be: %s", - llstr((param->used+param->empty + - param->del_length), llbuff), - llstr(share->state.state.data_file_length, - llbuff2)); + "Found %lld record data and %lld unused data and %lld deleted data", + param->used, param->empty, param->del_length); + _ma_check_print_warning(param, "Total %lld Should be: %lld", + param->used + param->empty + param->del_length, + share->state.state.data_file_length); } if (param->del_blocks != share->state.state.del) { _ma_check_print_warning(param, - "Found %10s deleted blocks. Should be: %s", - llstr(param->del_blocks,llbuff), - llstr(share->state.state.del,llbuff2)); + "Found %10lld deleted blocks. Should be: %lld", + param->del_blocks, share->state.state.del); } if (param->splits != share->state.split) { _ma_check_print_warning(param, - "Found %10s parts. Should be: %s", - llstr(param->splits, llbuff), - llstr(share->state.split,llbuff2)); + "Found %10lld parts. Should be: %lld", + param->splits, share->state.split); } } if (param->testflag & T_INFO) @@ -2269,8 +2179,8 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend) { if (param->records) { - printf("Records:%18s M.recordlength:%9lu Packed:%14.0f%%\n", - llstr(param->records,llbuff), + printf("Records:%18lld M.recordlength:%9lu Packed:%14.0f%%\n", + param->records, (long)((param->used - param->link_used)/param->records), (share->base.blobs ? 0.0 : (ulonglong2double((ulonglong) share->base.reclength * @@ -2292,24 +2202,20 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info, my_bool extend) else printf("Records:%18s\n", "0"); } - printf("Record blocks:%12s Delete blocks:%10s\n", - llstr(param->splits - param->del_blocks, llbuff), - llstr(param->del_blocks, llbuff2)); - printf("Record data: %12s Deleted data: %10s\n", - llstr(param->used - param->link_used,llbuff), - llstr(param->del_length, llbuff2)); - printf("Empty space: %12s Linkdata: %10s\n", - llstr(param->empty, llbuff),llstr(param->link_used, llbuff2)); + printf("Record blocks:%12lld Delete blocks:%10lld\n", + param->splits - param->del_blocks, param->del_blocks); + printf("Record data: %12lld Deleted data: %10lld\n", + param->used - param->link_used, param->del_length); + printf("Empty space: %12lld Linkdata: %10lld\n", + param->empty,param->link_used); if (share->data_file_type == BLOCK_RECORD) { - printf("Full pages: %12s Tail count: %12s\n", - llstr(param->full_page_count, llbuff), - llstr(param->tail_count, llbuff2)); - printf("Lost space: %12s\n", llstr(param->lost, llbuff)); + printf("Full pages: %12lld Tail count: %12lld\n", + param->full_page_count, param->tail_count); + printf("Lost space: %12lld\n", param->lost); if (param->max_found_trid) { - printf("Max trans. id: %11s\n", - llstr(param->max_found_trid, llbuff)); + printf("Max trans. id: %11lld\n", param->max_found_trid); } } } @@ -2704,7 +2610,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, if (!(param->testflag & T_SILENT)) { printf("- recovering (with keycache) Aria-table '%s'\n",name); - printf("Data records: %s\n", llstr(start_records, llbuff)); + printf("Data records: %lld\n", start_records); } if (initialize_variables_for_repair(param, &sort_info, &sort_param, info, @@ -2956,12 +2862,11 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, if (!(param->testflag & T_SILENT)) { if (start_records != share->state.state.records) - printf("Data records: %s\n", llstr(share->state.state.records,llbuff)); + printf("Data records: %lld\n", share->state.state.records); } if (sort_info.dupp) _ma_check_print_warning(param, - "%s records have been removed", - llstr(sort_info.dupp,llbuff)); + "%lld records have been removed", sort_info.dupp); got_error= 0; /* If invoked by external program that uses thr_lock */ @@ -2986,9 +2891,9 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, if (got_error) { if (! param->error_printed) - _ma_check_print_error(param,"Got error %d for record at pos %s when creating index", - my_errno, - llstr(sort_param.start_recpos,llbuff)); + _ma_check_print_error(param, + "Got error %d for record at pos %lld when creating index", + my_errno, sort_param.start_recpos); (void)_ma_flush_table_files_before_swap(param, info); if (sort_info.new_info && sort_info.new_info != sort_info.info) { @@ -3430,7 +3335,6 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info, { MARIA_SHARE *share= info->s; MARIA_PINNED_PAGE page_link; - char llbuff[21]; uchar *buff; pgcache_page_no_t page; my_off_t pos; @@ -3464,8 +3368,7 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info, PAGECACHE_UNPIN, LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, 0, FALSE); _ma_check_print_error(param, - "Page %9s: Got error %d when reading index file", - llstr(pos, llbuff), my_errno); + "Page %9lld: Got error %d when reading index file", pos, my_errno); goto end; } if (zero_lsn) @@ -3483,9 +3386,7 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info, if (_ma_compact_keypage(&page, ~(TrID) 0)) { _ma_check_print_error(param, - "Page %9s: Got error %d when reading index " - "file", - llstr(pos, llbuff), my_errno); + "Page %9lld: Got error %d when reading index file", pos, my_errno); goto end; } } @@ -3527,7 +3428,6 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, { MARIA_SHARE *share= info->s; MARIA_PINNED_PAGE page_link; - char llbuff[21]; my_off_t pos; pgcache_page_no_t page; uint block_size= share->block_size; @@ -3563,8 +3463,7 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, &page_link.link))) { _ma_check_print_error(param, - "Page %9s: Got error: %d when reading datafile", - llstr(pos, llbuff), my_errno); + "Page %9lld: Got error: %d when reading datafile", pos, my_errno); goto err; } page_type= (enum en_page_type) (buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK); @@ -3626,8 +3525,7 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, } default: _ma_check_print_error(param, - "Page %9s: Found unrecognizable block of type %d", - llstr(pos, llbuff), page_type); + "Page %9lld: Found unrecognizable block of type %d", pos, page_type); goto err; } pagecache_unlock_by_link(share->pagecache, page_link.link, @@ -3798,7 +3696,6 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, MARIA_SHARE *share= info->s; HA_KEYSEG *keyseg; double *rec_per_key_part; - char llbuff[22]; MARIA_SORT_INFO sort_info; ulonglong UNINIT_VAR(key_map); myf sync_dir= ((share->now_transactional && !share->temporary) ? @@ -3813,7 +3710,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, if (!(param->testflag & T_SILENT)) { printf("- recovering (with sort) Aria-table '%s'\n",name); - printf("Data records: %s\n", llstr(start_records,llbuff)); + printf("Data records: %lld\n", start_records); } if (initialize_variables_for_repair(param, &sort_info, &sort_param, info, @@ -4202,12 +4099,11 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, if (!(param->testflag & T_SILENT)) { if (start_records != share->state.state.records) - printf("Data records: %s\n", llstr(share->state.state.records,llbuff)); + printf("Data records: %lld\n", share->state.state.records); } if (sort_info.dupp) _ma_check_print_warning(param, - "%s records have been removed", - llstr(sort_info.dupp,llbuff)); + "%lld records have been removed", sort_info.dupp); got_error=0; /* If invoked by external program that uses thr_lock */ if (&share->state.state != info->state) @@ -4334,7 +4230,6 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, MARIA_SHARE *share= info->s; double *rec_per_key_part; HA_KEYSEG *keyseg; - char llbuff[22]; IO_CACHE new_data_cache; /* For non-quick repair. */ IO_CACHE_SHARE io_share; MARIA_SORT_INFO sort_info; @@ -4352,7 +4247,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, if (!(param->testflag & T_SILENT)) { printf("- parallel recovering (with sort) Aria-table '%s'\n",name); - printf("Data records: %s\n", llstr(start_records, llbuff)); + printf("Data records: %lld\n", start_records); } bzero(&new_data_cache, sizeof(new_data_cache)); @@ -4752,12 +4647,11 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, if (!(param->testflag & T_SILENT)) { if (start_records != share->state.state.records) - printf("Data records: %s\n", llstr(share->state.state.records,llbuff)); + printf("Data records: %lld\n", share->state.state.records); } if (sort_info.dupp) _ma_check_print_warning(param, - "%s records have been removed", - llstr(sort_info.dupp,llbuff)); + "%lld records have been removed", sort_info.dupp); got_error=0; /* If invoked by external program that uses thr_lock */ if (&share->state.state != info->state) @@ -4975,7 +4869,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) HA_CHECK *param=sort_info->param; MARIA_HA *info=sort_info->info; MARIA_SHARE *share= info->s; - char llbuff[22],llbuff2[22]; + char llbuff[22]; DBUG_ENTER("sort_get_next_record"); if (_ma_killed_ptr(param)) @@ -5130,15 +5024,13 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) if (pos & (MARIA_DYN_ALIGN_SIZE-1)) { if ((param->testflag & T_VERBOSE) || searching == 0) - _ma_check_print_info(param,"Wrong aligned block at %s", - llstr(pos,llbuff)); + _ma_check_print_info(param, "Wrong aligned block at %lld", pos); if (searching) goto try_next; } if (found_record && pos == param->search_after_block) - _ma_check_print_info(param,"Block: %s used by record at %s", - llstr(param->search_after_block,llbuff), - llstr(sort_param->start_recpos,llbuff2)); + _ma_check_print_info(param, "Block: %lld used by record at %lld", + param->search_after_block, sort_param->start_recpos); if (_ma_read_cache(info, &sort_param->read_cache, block_info.header, pos, MARIA_BLOCK_INFO_HEADER_LENGTH, @@ -5148,8 +5040,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) if (found_record) { _ma_check_print_info(param, - "Can't read whole record at %s (errno: %d)", - llstr(sort_param->start_recpos,llbuff),errno); + "Can't read whole record at %lld (errno: %d)", + sort_param->start_recpos, errno); goto try_next; } DBUG_RETURN(-1); @@ -5171,9 +5063,9 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) uint i; if (param->testflag & T_VERBOSE || searching == 0) _ma_check_print_info(param, - "Wrong bytesec: %3d-%3d-%3d at %10s; Skipped", - block_info.header[0],block_info.header[1], - block_info.header[2],llstr(pos,llbuff)); + "Wrong bytesec: %3d-%3d-%3d at %10lld; Skipped", + block_info.header[0], block_info.header[1], + block_info.header[2], pos); if (found_record) goto try_next; block_info.second_read=0; @@ -5198,8 +5090,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) if (!searching) _ma_check_print_info(param, "Deleted block with impossible length %lu " - "at %s", - block_info.block_len,llstr(pos,llbuff)); + "at %lld", block_info.block_len, pos); error=1; } else @@ -5213,9 +5104,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) { if (!searching) _ma_check_print_info(param, - "Delete link points outside datafile at " - "%s", - llstr(pos,llbuff)); + "Delete link points outside datafile at %lld", pos); error=1; } } @@ -5239,11 +5128,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) { if (!searching) _ma_check_print_info(param, - "Found block with impossible length %lu " - "at %s; Skipped", - block_info.block_len+ - (uint) (block_info.filepos-pos), - llstr(pos,llbuff)); + "Found block with impossible length %lu at %lld; Skipped", + block_info.block_len + (uint) (block_info.filepos-pos), pos); if (found_record) goto try_next; searching=1; @@ -5298,18 +5184,16 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) { if (param->max_record_length >= block_info.rec_len) { - _ma_check_print_error(param,"Not enough memory for blob at %s " - "(need %lu)", - llstr(sort_param->start_recpos,llbuff), - (ulong) block_info.rec_len); + _ma_check_print_error(param, + "Not enough memory for blob at %lld (need %lu)", + sort_param->start_recpos, (ulong) block_info.rec_len); DBUG_RETURN(1); } else { - _ma_check_print_info(param,"Not enough memory for blob at %s " - "(need %lu); Row skipped", - llstr(sort_param->start_recpos,llbuff), - (ulong) block_info.rec_len); + _ma_check_print_info(param, + "Not enough memory for blob at %lld (need %lu); Row skipped", + sort_param->start_recpos, (ulong) block_info.rec_len); goto try_next; } } @@ -5319,9 +5203,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) if (left_length < block_info.data_len || ! block_info.data_len) { _ma_check_print_info(param, - "Found block with too small length at %s; " - "Skipped", - llstr(sort_param->start_recpos,llbuff)); + "Found block with too small length at %lld; " + "Skipped", sort_param->start_recpos); goto try_next; } if (block_info.filepos + block_info.data_len > @@ -5329,8 +5212,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) { _ma_check_print_info(param, "Found block that points outside data file " - "at %s", - llstr(sort_param->start_recpos,llbuff)); + "at %lld", sort_param->start_recpos); goto try_next; } /* @@ -5360,9 +5242,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) parallel_flag)) { _ma_check_print_info(param, - "Read error for block at: %s (error: %d); " - "Skipped", - llstr(block_info.filepos,llbuff),my_errno); + "Read error for block at: %lld (error: %d); " + "Skipped", block_info.filepos, my_errno); goto try_next; } left_length-=block_info.data_len; @@ -5372,18 +5253,15 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) { _ma_check_print_info(param, "Wrong block with wrong total length " - "starting at %s", - llstr(sort_param->start_recpos,llbuff)); + "starting at %lld", sort_param->start_recpos); goto try_next; } if (pos + MARIA_BLOCK_INFO_HEADER_LENGTH > sort_param->read_cache.end_of_file) { _ma_check_print_info(param, - "Found link that points at %s (outside data " - "file) at %s", - llstr(pos,llbuff2), - llstr(sort_param->start_recpos,llbuff)); + "Found link that points at %lld (outside data " + "file) at %lld", pos, sort_param->start_recpos); goto try_next; } } while (left_length); @@ -5403,8 +5281,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) sort_param->calc_checksum && MY_TEST(share->calc_checksum), checksum)) { - _ma_check_print_info(param,"Found wrong packed record at %s", - llstr(sort_param->start_recpos,llbuff)); + _ma_check_print_info(param, "Found wrong packed record at %lld", + sort_param->start_recpos); goto try_next; } } @@ -5413,9 +5291,9 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) DBUG_RETURN(0); } if (!searching) - _ma_check_print_info(param,"Key %d - Found wrong stored record at %s", - sort_param->key+1, - llstr(sort_param->start_recpos,llbuff)); + _ma_check_print_info(param, + "Key %d - Found wrong stored record at %lld", + sort_param->key+1, sort_param->start_recpos); try_next: pos=(sort_param->start_recpos+=MARIA_DYN_ALIGN_SIZE); searching=1; @@ -5452,10 +5330,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) { if (! searching) _ma_check_print_info(param, - "Found block with wrong recordlength: %lu " - "at %s\n", - block_info.rec_len, - llstr(sort_param->pos,llbuff)); + "Found block with wrong recordlength: %lu at %lld\n", + block_info.rec_len, sort_param->pos); continue; } if (_ma_read_cache(info, &sort_param->read_cache, sort_param->rec_buff, @@ -5463,8 +5339,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) READING_NEXT)) { if (! searching) - _ma_check_print_info(param,"Couldn't read whole record from %s", - llstr(sort_param->pos,llbuff)); + _ma_check_print_info(param, "Couldn't read whole record from %lld", + sort_param->pos); continue; } sort_param->rec_buff[block_info.rec_len]= 0; /* Keep valgrind happy */ @@ -5472,8 +5348,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) sort_param->rec_buff, block_info.rec_len)) { if (! searching) - _ma_check_print_info(param,"Found wrong record at %s", - llstr(sort_param->pos,llbuff)); + _ma_check_print_info(param, "Found wrong record at %lld", + sort_param->pos); continue; } if (!sort_param->fix_datafile) @@ -5638,8 +5514,7 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param) if ((param->testflag & T_WRITE_LOOP) && (share->state.state.records % WRITE_COUNT) == 0) { - char llbuff[22]; - printf("%s\r", llstr(share->state.state.records,llbuff)); + printf("%lld\r", share->state.state.records); fflush(stdout); } } @@ -6826,7 +6701,6 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info, { uint length, offset; uchar *data, *end_of_data; - char llbuff[22]; while (!(offset= uint2korr(info->scan.dir))) { @@ -6835,8 +6709,7 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info, if (info->scan.dir < info->scan.dir_end) { _ma_check_print_info(sort_info->param, - "Wrong directory on page %s", - llstr(page, llbuff)); + "Wrong directory on page %lld", page); goto read_next_page; } } @@ -6853,8 +6726,7 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info, length < share->base.min_block_length) { _ma_check_print_info(sort_info->param, - "Wrong directory entry %3u at page %s", - (uint) record_pos, llstr(page, llbuff)); + "Wrong directory entry %3u at page %lld", (uint) record_pos, page); record_pos++; continue; } @@ -6870,7 +6742,6 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info, for (;;) { uint page_type; - char llbuff[22]; sort_info->page++; /* In case of errors */ page++; @@ -6902,8 +6773,7 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info, page))) { _ma_check_print_info(sort_info->param, - "Wrong CRC on datapage at %s", - llstr(page, llbuff)); + "Wrong CRC on datapage at %lld", page); } continue; } @@ -6917,14 +6787,12 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info, (uint) (uchar) info->scan.page_buff[DIR_COUNT_OFFSET]) != 0) break; _ma_check_print_info(sort_info->param, - "Wrong head page at page %s", - llstr(page, llbuff)); + "Wrong head page at page %lld", page); } else if (page_type >= MAX_PAGE_TYPE) { _ma_check_print_info(sort_info->param, - "Found wrong page type: %d at page %s", - page_type, llstr(page, llbuff)); + "Found wrong page type: %d at page %lld", page_type, page); } } @@ -7054,42 +6922,36 @@ my_bool write_log_record_for_bulk_insert(MARIA_HA *info) static void report_keypage_fault(HA_CHECK *param, MARIA_HA *info, my_off_t position) { - char buff[11]; uint32 block_size= info->s->block_size; if (my_errno == HA_ERR_CRASHED) _ma_check_print_error(param, - "Wrong base information on indexpage at page: %s", - llstr(position / block_size, buff)); + "Wrong base information on indexpage at page: %lld", + position / block_size); else _ma_check_print_error(param, - "Can't read indexpage from page: %s, " - "error: %d", - llstr(position / block_size, buff), my_errno); + "Can't read indexpage from page: %lld, error: %d", + position / block_size, my_errno); } static void _ma_check_print_not_visible_error(HA_CHECK *param, TrID used_trid) { - char buff[22], buff2[22]; if (!param->not_visible_rows_found++) { if (!ma_control_file_inited()) { _ma_check_print_warning(param, - "Found row with transaction id %s but no " + "Found row with transaction id %lld but no " "aria_control_file was used or specified. " - "The table may be corrupted", - llstr(used_trid, buff)); + "The table may be corrupted", used_trid); } else { _ma_check_print_error(param, - "Found row with transaction id %s when max " + "Found row with transaction id %lld when max " "transaction id according to aria_control_file " - "is %s", - llstr(used_trid, buff), - llstr(param->max_trid, buff2)); + "is %lld", used_trid, param->max_trid); } } } diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 7bdc902f92c5f..cd023ad415e53 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -3272,9 +3272,6 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr, my_off_t file_size; uint32 file_no= LSN_FILE_NO(*addr); TRANSLOG_FILE *file; -#ifdef DBUG_TRACE - char buff[21]; -#endif DBUG_ENTER("translog_get_last_page_addr"); if (likely((file= get_logfile_by_number(file_no)) != NULL)) @@ -3306,7 +3303,7 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr, file_size= mysql_file_seek(fd, 0, SEEK_END, MYF(0)); mysql_file_close(fd, MYF(0)); } - DBUG_PRINT("info", ("File size: %s", llstr(file_size, buff))); + DBUG_PRINT("info", ("File size: %lld", file_size)); if (file_size == MY_FILEPOS_ERROR) DBUG_RETURN(1); DBUG_ASSERT(file_size < 0xffffffffULL); @@ -9093,7 +9090,6 @@ void translog_soft_sync_end(void) static void dump_header_page(uchar *buff) { LOGHANDLER_FILE_INFO desc; - char strbuff[21]; struct tm tmp_tm; time_t header_time; @@ -9102,14 +9098,14 @@ static void dump_header_page(uchar *buff) localtime_r(&header_time, &tmp_tm); printf(" This can be header page:\n" - " Timestamp: %04d.%02d.%02d %02d.%02d.%02d (%s)\n" + " Timestamp: %04d.%02d.%02d %02d.%02d.%02d (%lld)\n" " Aria log version: %lu\n" " Server version: %lu\n" " Server id %lu\n" " Page size %lu\n", tmp_tm.tm_year+1900, tmp_tm.tm_mon+1, tmp_tm.tm_mday, tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, - llstr(desc.timestamp, strbuff), + desc.timestamp, desc.maria_version, desc.mysql_version, desc.server_id, diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 9fe262c1847c9..7e49992981b13 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -3717,14 +3717,10 @@ uchar *pagecache_read(PAGECACHE *pagecache, unlock_pin= lock_to_pin[buff==0][lock].unlock_pin; PAGECACHE_BLOCK_LINK *fake_link; my_bool reg_request; -#ifdef DBUG_TRACE - char llbuf[22]; -#endif DBUG_ENTER("pagecache_read"); - DBUG_PRINT("enter", ("fd: %u page: %s buffer: %p level: %u " + DBUG_PRINT("enter", ("fd: %u page: %llu buffer: %p level: %u " "t:%s (%d)%s->%s %s->%s big block: %d", - (uint) file->file, ullstr(pageno, llbuf), - buff, level, + (uint) file->file, pageno, buff, level, page_cache_page_type_str[type], lock_to_read[lock].need_lock_change, page_cache_page_lock_str[lock_to_read[lock].new_lock], @@ -4378,13 +4374,10 @@ my_bool pagecache_write_part(PAGECACHE *pagecache, my_bool error= 0; int need_lock_change= write_lock_change_table[lock].need_lock_change; my_bool reg_request; -#ifdef DBUG_TRACE - char llbuf[22]; -#endif DBUG_ENTER("pagecache_write_part"); - DBUG_PRINT("enter", ("fd: %u page: %s level: %u type: %s lock: %s " + DBUG_PRINT("enter", ("fd: %u page: %llu level: %u type: %s lock: %s " "pin: %s mode: %s offset: %u size %u", - (uint) file->file, ullstr(pageno, llbuf), level, + (uint) file->file, pageno, level, page_cache_page_type_str[type], page_cache_page_lock_str[lock], page_cache_page_pin_str[pin], diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 8a6060562b846..05d966dbc3c82 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -631,12 +631,10 @@ prototype_redo_exec_hook(LONG_TRANSACTION_ID) if ((ulsn != LSN_IMPOSSIBLE) && (cmp_translog_addr(ulsn, rec->lsn) < 0)) { - char llbuf[22]; - llstr(long_trid, llbuf); - eprint(tracef, "Found an old transaction long_trid %s short_trid %u" + eprint(tracef, "Found an old transaction long_trid %lld short_trid %u" " with same short id as this new transaction, and has neither" " committed nor rollback (undo_lsn: " LSN_FMT ")", - llbuf, sid, LSN_IN_PARTS(ulsn)); + long_trid, sid, LSN_IN_PARTS(ulsn)); goto err; } } @@ -654,12 +652,10 @@ prototype_redo_exec_hook(LONG_TRANSACTION_ID) static void new_transaction(uint16 sid, TrID long_id, LSN undo_lsn, LSN first_undo_lsn) { - char llbuf[22]; all_active_trans[sid].long_trid= long_id; - llstr(long_id, llbuf); - tprint(tracef, "Transaction long_trid %s short_trid %u starts," + tprint(tracef, "Transaction long_trid %lld short_trid %u starts," " undo_lsn " LSN_FMT " first_undo_lsn " LSN_FMT "\n", - llbuf, sid, LSN_IN_PARTS(undo_lsn), LSN_IN_PARTS(first_undo_lsn)); + long_id, sid, LSN_IN_PARTS(undo_lsn), LSN_IN_PARTS(first_undo_lsn)); all_active_trans[sid].undo_lsn= undo_lsn; all_active_trans[sid].first_undo_lsn= first_undo_lsn; set_if_bigger(max_long_trid, long_id); @@ -1668,7 +1664,6 @@ prototype_redo_exec_hook(REDO_INSERT_ROW_BLOBS) uchar *buff; uint number_of_blobs, number_of_ranges; pgcache_page_no_t first_page, last_page; - char llbuf1[22], llbuf2[22]; MARIA_HA *info= get_MARIA_HA_from_REDO_record(rec); if (info == NULL || maria_is_crashed(info)) return 0; @@ -1687,10 +1682,8 @@ prototype_redo_exec_hook(REDO_INSERT_ROW_BLOBS) &number_of_ranges, &first_page, &last_page)) goto end; - llstr(first_page, llbuf1); - llstr(last_page, llbuf2); - tprint(tracef, " %u blobs %u ranges, first page %s last %s", - number_of_blobs, number_of_ranges, llbuf1, llbuf2); + tprint(tracef, " %u blobs %u ranges, first page %lld last %lld", + number_of_blobs, number_of_ranges, first_page, last_page); error= 0; @@ -2042,7 +2035,6 @@ prototype_redo_exec_hook(UNDO_KEY_INSERT) { const HA_KEYSEG *keyseg= info->s->keyinfo[keynr].seg; ulonglong value; - char llbuf[22]; uchar reversed[MARIA_MAX_KEY_BUFF], *to; tprint(tracef, " state older than record\n"); /* we read the record to find the auto_increment value */ @@ -2071,8 +2063,7 @@ prototype_redo_exec_hook(UNDO_KEY_INSERT) } value= ma_retrieve_auto_increment(to, keyseg->type); set_if_bigger(share->state.auto_increment, value); - llstr(share->state.auto_increment, llbuf); - tprint(tracef, " auto-inc %s\n", llbuf); + tprint(tracef, " auto-inc %lld\n", share->state.auto_increment); } } _ma_unpin_all_pages(info, rec->lsn); @@ -2150,7 +2141,6 @@ prototype_redo_exec_hook(COMMIT) { uint16 sid= rec->short_trid; TrID long_trid= all_active_trans[sid].long_trid; - char llbuf[22]; if (long_trid == 0) { tprint(tracef, "We don't know about transaction with short_trid %u;" @@ -2158,9 +2148,8 @@ prototype_redo_exec_hook(COMMIT) bzero(&all_active_trans[sid], sizeof(all_active_trans[sid])); return 0; } - llstr(long_trid, llbuf); - tprint(tracef, "Transaction long_trid %s short_trid %u committed\n", - llbuf, sid); + tprint(tracef, "Transaction long_trid %lld short_trid %u committed\n", + long_trid, sid); bzero(&all_active_trans[sid], sizeof(all_active_trans[sid])); #ifdef MARIA_VERSIONING /* @@ -2843,7 +2832,6 @@ PRAGMA_REENABLE_CHECK_STACK_FRAME static uint end_of_redo_phase(my_bool prepare_for_undo_phase) { uint sid, uncommitted= 0; - char llbuf[22]; LSN addr; my_hash_free(&all_dirty_pages); @@ -2855,11 +2843,9 @@ static uint end_of_redo_phase(my_bool prepare_for_undo_phase) my_free(dirty_pages_pool); dirty_pages_pool= NULL; - llstr(max_long_trid, llbuf); - tprint(tracef, "Maximum transaction long id seen: %s\n", llbuf); - llstr(max_trid_in_control_file, llbuf); - tprint(tracef, "Maximum transaction long id seen in control file: %s\n", - llbuf); + tprint(tracef, "Maximum transaction long id seen: %lld\n", max_long_trid); + tprint(tracef, "Maximum transaction long id seen in control file: %lld\n", + max_trid_in_control_file); /* If logs were deleted, or lost, trid in control file is needed to set trnman's generator: @@ -2883,9 +2869,8 @@ static uint end_of_redo_phase(my_bool prepare_for_undo_phase) } if (all_active_trans[sid].undo_lsn != LSN_IMPOSSIBLE) { - llstr(long_trid, llbuf); - tprint(tracef, "Transaction long_trid %s short_trid %u uncommitted\n", - llbuf, sid); + tprint(tracef, "Transaction long_trid %lld short_trid %u uncommitted\n", + long_trid, sid); /* dummy_transaction_object serves only for DDLs, where there is never a rollback or incomplete group. And unknown transactions (which have @@ -2975,7 +2960,6 @@ static int run_undo_phase(LSN end_undo_lsn, uint uncommitted) tprint(tracef, "%u transactions will be rolled back\n", uncommitted); for( ; ; ) { - char llbuf[22]; TRN *trn; if (recovery_message_printed == REC_MSG_UNDO) { @@ -2999,8 +2983,7 @@ static int run_undo_phase(LSN end_undo_lsn, uint uncommitted) trn= trnman_get_any_trn(); DBUG_ASSERT(trn != NULL); - llstr(trn->trid, llbuf); - tprint(tracef, "Rolling back transaction of long id %s\n", llbuf); + tprint(tracef, "Rolling back transaction of long id %lld\n", trn->trid); last_undo= trn->undo_lsn + 1; /* Execute all undo entries */ @@ -3124,7 +3107,6 @@ static MARIA_HA *get_MARIA_HA_from_REDO_record(const pgcache_page_no_t UNINIT_VAR(page); MARIA_HA *info; MARIA_SHARE *share; - char llbuf[22]; my_bool index_page_redo_entry= FALSE, page_redo_entry= FALSE; print_redo_phase_progress(rec->lsn); @@ -3145,7 +3127,6 @@ static MARIA_HA *get_MARIA_HA_from_REDO_record(const case LOGREC_REDO_FREE_HEAD_OR_TAIL: page_redo_entry= TRUE; page= page_korr(rec->header + FILEID_STORE_SIZE); - llstr(page, llbuf); break; case LOGREC_REDO_FREE_BLOCKS: /* diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c index b8123c422c1c0..6361c599acd12 100644 --- a/storage/maria/ma_recovery_util.c +++ b/storage/maria/ma_recovery_util.c @@ -128,7 +128,6 @@ my_bool _ma_redo_not_needed_for_page(uint16 shortid, LSN lsn, Next 2 bytes: table's short id Next 5 bytes: page number */ - char llbuf[22]; uint64 file_and_page_id= (((uint64)((index << 16) | shortid)) << 40) | page; struct st_dirty_page *dirty_page= (struct st_dirty_page *) @@ -140,8 +139,8 @@ my_bool _ma_redo_not_needed_for_page(uint16 shortid, LSN lsn, if ((dirty_page == NULL) || cmp_translog_addr(lsn, dirty_page->rec_lsn) < 0) { - tprint(tracef, ", ignoring page %s because of dirty_pages list\n", - llstr((ulonglong) page, llbuf)); + tprint(tracef, ", ignoring page %llu because of dirty_pages list\n", + page); return TRUE; } } diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index cf01b3ecc8e5c..b67a0d6415cdc 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1195,13 +1195,9 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) if (!error && start_records != file->state->records && !(check_opt->flags & T_VERY_SILENT)) - { - char llbuff[22],llbuff2[22]; - sql_print_information("Found %s of %s rows when repairing '%s'", - llstr(file->state->records, llbuff), - llstr(start_records, llbuff2), + sql_print_information("Found %lld of %lld rows when repairing '%s'", + file->state->records, start_records, table->s->path.str); - } return error; } @@ -1417,12 +1413,8 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | HA_STATUS_CONST); if (rows != file->state->records && ! (param.testflag & T_VERY_SILENT)) - { - char llbuff[22],llbuff2[22]; - mi_check_print_warning(¶m,"Number of rows changed from %s to %s", - llstr(rows,llbuff), - llstr(file->state->records,llbuff2)); - } + mi_check_print_warning(¶m, + "Number of rows changed from %lld to %lld", rows, file->state->records); } else { diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index e308243505b92..049620e1589d1 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -132,7 +132,7 @@ int chk_del(HA_CHECK *param, register MI_INFO *info, ulonglong test_flag) reg2 ha_rows i; uint delete_link_length; my_off_t empty,next_link,UNINIT_VAR(old_link); - char buff[22],buff2[22]; + char buff[22]; DBUG_ENTER("chk_del"); param->record_checksum=0; @@ -160,22 +160,22 @@ int chk_del(HA_CHECK *param, register MI_INFO *info, ulonglong test_flag) if (killed_ptr(param)) DBUG_RETURN(1); if (test_flag & T_VERBOSE) - printf(" %9s",llstr(next_link,buff)); + printf(" %9lld", next_link); if (next_link >= info->state->data_file_length) goto wrong; if (mysql_file_pread(info->dfile, (uchar*) buff, delete_link_length, next_link, MYF(MY_NABP))) { if (test_flag & T_VERBOSE) puts(""); - mi_check_print_error(param,"Can't read delete-link at filepos: %s", - llstr(next_link,buff)); + mi_check_print_error(param, "Can't read delete-link at filepos: %lld", + next_link); DBUG_RETURN(1); } if (*buff != '\0') { if (test_flag & T_VERBOSE) puts(""); - mi_check_print_error(param,"Record at pos: %s is not remove-marked", - llstr(next_link,buff)); + mi_check_print_error(param, "Record at pos: %lld is not remove-marked", + next_link); goto wrong; } if (info->s->options & HA_OPTION_PACK_RECORD) @@ -184,7 +184,9 @@ int chk_del(HA_CHECK *param, register MI_INFO *info, ulonglong test_flag) if (empty && prev_link != old_link) { if (test_flag & T_VERBOSE) puts(""); - mi_check_print_error(param,"Deleted block at %s doesn't point back at previous delete link",llstr(next_link,buff2)); + mi_check_print_error(param, + "Deleted block at %lld doesn't point back at previous delete link", + next_link); goto wrong; } old_link=next_link; @@ -203,23 +205,21 @@ int chk_del(HA_CHECK *param, register MI_INFO *info, ulonglong test_flag) if (empty != info->state->empty) { mi_check_print_warning(param, - "Found %s deleted space in delete link chain. Should be %s", - llstr(empty,buff2), - llstr(info->state->empty,buff)); + "Found %lld deleted space in delete link chain. Should be %lld", + empty, info->state->empty); } if (next_link != HA_OFFSET_ERROR) { mi_check_print_error(param, - "Found more than the expected %s deleted rows in delete link chain", - llstr(info->state->del, buff)); + "Found more than the expected %lld deleted rows in delete link chain", + info->state->del); goto wrong; } if (i != 0) { mi_check_print_error(param, - "Found %s deleted rows in delete link chain. Should be %s", - llstr(info->state->del - i, buff2), - llstr(info->state->del, buff)); + "Found %lld deleted rows in delete link chain. Should be %lld", + info->state->del - i, info->state->del); goto wrong; } } @@ -240,7 +240,6 @@ static int check_k_link(HA_CHECK *param, register MI_INFO *info, uint nr) my_off_t next_link; uint block_size=(nr+1)*MI_MIN_KEY_BLOCK_LENGTH; ha_rows records; - char llbuff[21], llbuff2[21]; uchar *buff; DBUG_ENTER("check_k_link"); DBUG_PRINT("enter", ("block_size: %u", block_size)); @@ -255,16 +254,15 @@ static int check_k_link(HA_CHECK *param, register MI_INFO *info, uint nr) if (killed_ptr(param)) DBUG_RETURN(1); if (param->testflag & T_VERBOSE) - printf("%16s",llstr(next_link,llbuff)); + printf("%16lld", next_link); /* Key blocks must lay within the key file length entirely. */ if (next_link + block_size > info->state->key_file_length) { /* purecov: begin tested */ - mi_check_print_error(param, "Invalid key block position: %s " - "key block size: %u file_length: %s", - llstr(next_link, llbuff), block_size, - llstr(info->state->key_file_length, llbuff2)); + mi_check_print_error(param, "Invalid key block position: %lld " + "key block size: %u file_length: %lld", + next_link, block_size, info->state->key_file_length); DBUG_RETURN(1); /* purecov: end */ } @@ -273,9 +271,9 @@ static int check_k_link(HA_CHECK *param, register MI_INFO *info, uint nr) if (next_link & (MI_MIN_KEY_BLOCK_LENGTH - 1)) { /* purecov: begin tested */ - mi_check_print_error(param, "Mis-aligned key block: %s " + mi_check_print_error(param, "Mis-aligned key block: %lld " "minimum key block length: %u", - llstr(next_link, llbuff), MI_MIN_KEY_BLOCK_LENGTH); + next_link, MI_MIN_KEY_BLOCK_LENGTH); DBUG_RETURN(1); /* purecov: end */ } @@ -291,8 +289,8 @@ static int check_k_link(HA_CHECK *param, register MI_INFO *info, uint nr) MI_MIN_KEY_BLOCK_LENGTH, 1))) { /* purecov: begin tested */ - mi_check_print_error(param, "key cache read error for block: %s", - llstr(next_link,llbuff)); + mi_check_print_error(param, "key cache read error for block: %lld", + next_link); DBUG_RETURN(1); /* purecov: end */ } @@ -303,7 +301,7 @@ static int check_k_link(HA_CHECK *param, register MI_INFO *info, uint nr) if (param->testflag & T_VERBOSE) { if (next_link != HA_OFFSET_ERROR) - printf("%16s\n",llstr(next_link,llbuff)); + printf("%16lld\n", next_link); else puts(""); } @@ -317,7 +315,6 @@ int chk_size(HA_CHECK *param, register MI_INFO *info) { int error=0; register my_off_t skr,size; - char buff[22],buff2[22]; DBUG_ENTER("chk_size"); if (!(param->testflag & T_SILENT)) puts("- check file-size"); @@ -335,21 +332,19 @@ int chk_size(HA_CHECK *param, register MI_INFO *info) { error=1; mi_check_print_error(param, - "Size of indexfile is: %-8s Should be: %s", - llstr(size,buff), llstr(skr,buff2)); + "Size of indexfile is: %-8lld Should be: %lld", size, skr); } else mi_check_print_warning(param, - "Size of indexfile is: %-8s Should be: %s", - llstr(size,buff), llstr(skr,buff2)); + "Size of indexfile is: %-8lld Should be: %lld", size, skr); } if (!(param->testflag & T_VERY_SILENT) && ! (info->s->options & HA_OPTION_COMPRESS_RECORD) && ulonglong2double(info->state->key_file_length) > ulonglong2double(info->s->base.margin_key_file_length)*0.9) - mi_check_print_warning(param,"Keyfile is almost full, %10s of %10s used", - llstr(info->state->key_file_length,buff), - llstr(info->s->base.max_key_file_length-1,buff)); + mi_check_print_warning(param, + "Keyfile is almost full, %10lld of %10lld used", + info->state->key_file_length, info->s->base.max_key_file_length-1); size= mysql_file_seek(info->dfile, 0L, MY_SEEK_END, MYF(0)); skr=(my_off_t) info->state->data_file_length; @@ -366,24 +361,24 @@ int chk_size(HA_CHECK *param, register MI_INFO *info) if (skr > size && skr != size + MEMMAP_EXTRA_MARGIN) { error=1; - mi_check_print_error(param,"Size of datafile is: %-9s Should be: %s", - llstr(size,buff), llstr(skr,buff2)); + mi_check_print_error(param, + "Size of datafile is: %-9lld Should be: %lld", size, skr); param->testflag|=T_RETRY_WITHOUT_QUICK; } else { mi_check_print_warning(param, - "Size of datafile is: %-9s Should be: %s", - llstr(size,buff), llstr(skr,buff2)); + "Size of datafile is: %-9lld Should be: %lld", size, skr); } } if (!(param->testflag & T_VERY_SILENT) && !(info->s->options & HA_OPTION_COMPRESS_RECORD) && ulonglong2double(info->state->data_file_length) > (ulonglong2double(info->s->base.max_data_file_length)*0.9)) - mi_check_print_warning(param, "Datafile is almost full, %10s of %10s used", - llstr(info->state->data_file_length,buff), - llstr(info->s->base.max_data_file_length-1,buff2)); + mi_check_print_warning(param, + "Datafile is almost full, %10lld of %10lld used", + info->state->data_file_length, + info->s->base.max_data_file_length-1); DBUG_RETURN(error); } /* chk_size */ @@ -399,7 +394,6 @@ int chk_key(HA_CHECK *param, register MI_INFO *info) ulong *rec_per_key_part; MYISAM_SHARE *share=info->s; MI_KEYDEF *keyinfo; - char buff[22],buff2[22]; DBUG_ENTER("chk_key"); if (!(param->testflag & T_SILENT)) @@ -454,8 +448,8 @@ int chk_key(HA_CHECK *param, register MI_INFO *info) if (!_mi_fetch_keypage(info,keyinfo,share->state.key_root[key], DFLT_INIT_HITS,info->buff,0)) { - mi_check_print_error(param,"Can't read indexpage from filepos: %s", - llstr(share->state.key_root[key],buff)); + mi_check_print_error(param, "Can't read indexpage from filepos: %lld", + share->state.key_root[key]); if (!(param->testflag & T_INFO)) DBUG_RETURN(-1); result= -1; @@ -473,8 +467,8 @@ int chk_key(HA_CHECK *param, register MI_INFO *info) { if (keys != info->state->records) { - mi_check_print_error(param,"Found %s keys of %s",llstr(keys,buff), - llstr(info->state->records,buff2)); + mi_check_print_error(param, "Found %lld keys of %lld", keys, + info->state->records); if (!(param->testflag & T_INFO)) DBUG_RETURN(-1); result= -1; @@ -507,10 +501,10 @@ int chk_key(HA_CHECK *param, register MI_INFO *info) auto_increment= retrieve_auto_increment(info, info->rec_buff); if (auto_increment > info->s->state.auto_increment) { - mi_check_print_warning(param, "Auto-increment value: %s is smaller " - "than max used value: %s", - llstr(info->s->state.auto_increment,buff2), - llstr(auto_increment, buff)); + mi_check_print_warning(param, "Auto-increment value: %lld is smaller " + "than max used value: %lld", + info->s->state.auto_increment, + auto_increment); } if (param->testflag & T_AUTO_INC) { @@ -579,7 +573,6 @@ static int chk_index_down(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t page, uchar *buff, ha_rows *keys, ha_checksum *key_checksum, uint level) { - char llbuff[22],llbuff2[22]; DBUG_ENTER("chk_index_down"); /* Key blocks must lay within the key file length entirely. */ @@ -589,10 +582,10 @@ static int chk_index_down(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, /* Give it a chance to fit in the real file size. */ my_off_t max_length= mysql_file_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)); - mi_check_print_error(param, "Invalid key block position: %s " - "key block size: %u file_length: %s", - llstr(page, llbuff), keyinfo->block_length, - llstr(info->state->key_file_length, llbuff2)); + mi_check_print_error(param, "Invalid key block position: %lld " + "key block size: %u file_length: %lld", + page, keyinfo->block_length, + info->state->key_file_length); if (page + keyinfo->block_length > max_length) goto err; /* Fix the remebered key file length. */ @@ -605,17 +598,16 @@ static int chk_index_down(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, if (page & (MI_MIN_KEY_BLOCK_LENGTH - 1)) { /* purecov: begin tested */ - mi_check_print_error(param, "Mis-aligned key block: %s " + mi_check_print_error(param, "Mis-aligned key block: %lld " "minimum key block length: %u", - llstr(page, llbuff), MI_MIN_KEY_BLOCK_LENGTH); + page, MI_MIN_KEY_BLOCK_LENGTH); goto err; /* purecov: end */ } if (!_mi_fetch_keypage(info,keyinfo,page, DFLT_INIT_HITS,buff,0)) { - mi_check_print_error(param,"Can't read key from filepos: %s", - llstr(page,llbuff)); + mi_check_print_error(param, "Can't read key from filepos: %lld", page); goto err; } param->key_file_blocks+=keyinfo->block_length; @@ -730,7 +722,6 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, uint used_length,comp_flag,nod_flag,key_length=0; uchar key[HA_MAX_POSSIBLE_KEY_BUFF],*temp_buff,*keypos,*old_keypos,*endpos; my_off_t next_page,record; - char llbuff[22]; uint diff_pos[2]; DBUG_ENTER("chk_index"); DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff)); @@ -764,8 +755,7 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, if (used_length > keyinfo->block_length) { - mi_check_print_error(param,"Wrong pageinfo at page: %s", - llstr(page,llbuff)); + mi_check_print_error(param, "Wrong pageinfo at page: %lld", page); goto err; } for ( ;; ) @@ -787,7 +777,7 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, break; if (keypos > endpos) { - mi_check_print_error(param,"Wrong key block length at page: %s",llstr(page,llbuff)); + mi_check_print_error(param, "Wrong key block length at page: %lld", page); goto err; } if ((*keys)++ && @@ -799,9 +789,9 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, DBUG_DUMP("new_in_page",old_keypos,(uint) (keypos-old_keypos)); if (comp_flag & SEARCH_FIND && flag == 0) - mi_check_print_error(param,"Found duplicated key at page %s",llstr(page,llbuff)); + mi_check_print_error(param, "Found duplicated key at page %lld", page); else - mi_check_print_error(param,"Key in wrong position at page %s",llstr(page,llbuff)); + mi_check_print_error(param, "Key in wrong position at page %lld", page); goto err; } if (param->testflag & T_STATISTICS) @@ -847,8 +837,8 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, mi_check_print_error(param, "Number of words in the 2nd level tree " "does not match the number in the header. " - "Parent word in on the page %s, offset %u", - llstr(page,llbuff), (uint) (old_keypos-buff)); + "Parent word in on the page %lld, offset %u", + page, (uint) (old_keypos-buff)); goto err; } (*keys)+=tmp_keys-1; @@ -858,13 +848,10 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, } if (record >= info->state->data_file_length) { -#ifdef DBUG_TRACE - char llbuff2[22], llbuff3[22]; -#endif - mi_check_print_error(param,"Found key at page %s that points to record outside datafile",llstr(page,llbuff)); - DBUG_PRINT("test",("page: %s record: %s filelength: %s", - llstr(page,llbuff),llstr(record,llbuff2), - llstr(info->state->data_file_length,llbuff3))); + mi_check_print_error(param, + "Found key at page %lld that points to record outside datafile", page); + DBUG_PRINT("test", ("page: %lld record: %lld filelength: %lld", + page, record, info->state->data_file_length)); DBUG_DUMP("key",key,key_length); DBUG_DUMP("new_in_page",old_keypos,(uint) (keypos-old_keypos)); goto err; @@ -873,8 +860,9 @@ static int chk_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, } if (keypos != endpos) { - mi_check_print_error(param,"Keyblock size at page %s is not correct. Block length: %d key length: %d", - llstr(page,llbuff), used_length, (int) (keypos - buff)); + mi_check_print_error(param, "Keyblock size at page %lld is not correct. " + "Block length: %d key length: %d", + page, used_length, (int) (keypos - buff)); goto err; } my_afree((uchar*) temp_buff); @@ -936,7 +924,6 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) my_off_t used,empty,pos,splits,UNINIT_VAR(start_recpos), del_length,link_used,start_block; uchar *record= 0, *UNINIT_VAR(to); - char llbuff[22],llbuff2[22],llbuff3[22]; ha_checksum intern_record_checksum; ha_checksum key_checksum[HA_MAX_POSSIBLE_KEY]; MI_KEYDEF *keyinfo; @@ -997,8 +984,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) goto err; if (start_block & (MI_DYN_ALIGN_SIZE-1)) { - mi_check_print_error(param,"Wrong aligned block at %s", - llstr(start_block,llbuff)); + mi_check_print_error(param, "Wrong aligned block at %lld", + start_block); goto err2; } b_type=_mi_get_block_info(&block_info,-1,start_block); @@ -1009,9 +996,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) { if (flag) { - mi_check_print_error(param,"Unexpected byte: %d at link: %s", - (int) block_info.header[0], - llstr(start_block,llbuff)); + mi_check_print_error(param, "Unexpected byte: %d at link: %lld", + (int) block_info.header[0], start_block); goto err2; } pos=block_info.filepos+block_info.block_len; @@ -1022,8 +1008,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) if (block_info.block_len < info->s->base.min_block_length) { mi_check_print_error(param, - "Deleted block with impossible length %lu at %s", - block_info.block_len,llstr(pos,llbuff)); + "Deleted block with impossible length %lu at %lld", + block_info.block_len, pos); goto err2; } if ((block_info.next_filepos != HA_OFFSET_ERROR && @@ -1031,8 +1017,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) (block_info.prev_filepos != HA_OFFSET_ERROR && block_info.prev_filepos >= info->state->data_file_length)) { - mi_check_print_error(param,"Delete link points outside datafile at %s", - llstr(pos,llbuff)); + mi_check_print_error(param, + "Delete link points outside datafile at %lld", pos); goto err2; } del_blocks++; @@ -1041,18 +1027,17 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) splits++; goto next; } - mi_check_print_error(param,"Wrong bytesec: %d-%d-%d at linkstart: %s", + mi_check_print_error(param, + "Wrong bytesec: %d-%d-%d at linkstart: %lld", block_info.header[0],block_info.header[1], - block_info.header[2], - llstr(start_block,llbuff)); + block_info.header[2], start_block); goto err2; } if (info->state->data_file_length < block_info.filepos+ block_info.block_len) { mi_check_print_error(param, - "Recordlink that points outside datafile at %s", - llstr(pos,llbuff)); + "Recordlink that points outside datafile at %lld", pos); got_error=1; break; } @@ -1063,9 +1048,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) pos=block_info.filepos+block_info.block_len; if (block_info.rec_len > (uint) info->s->base.max_pack_length) { - mi_check_print_error(param,"Found too long record (%lu) at %s", - (ulong) block_info.rec_len, - llstr(start_recpos,llbuff)); + mi_check_print_error(param, "Found too long record (%lu) at %lld", + (ulong) block_info.rec_len, start_recpos); got_error=1; break; } @@ -1075,9 +1059,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) &info->rec_buff))) { mi_check_print_error(param, - "Not enough memory (%lu) for blob at %s", - (ulong) block_info.rec_len, - llstr(start_recpos,llbuff)); + "Not enough memory (%lu) for blob at %lld", + (ulong) block_info.rec_len, start_recpos); got_error=1; break; } @@ -1088,9 +1071,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) } if (left_length < block_info.data_len) { - mi_check_print_error(param,"Found too long record (%lu) at %s", - (ulong) block_info.data_len, - llstr(start_recpos,llbuff)); + mi_check_print_error(param, "Found too long record (%lu) at %lld", + (ulong) block_info.data_len, start_recpos); got_error=1; break; } @@ -1108,18 +1090,16 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) if (b_type & BLOCK_LAST) { mi_check_print_error(param, - "Wrong record length %s of %s at %s", - llstr(block_info.rec_len-left_length,llbuff), - llstr(block_info.rec_len, llbuff2), - llstr(start_recpos,llbuff3)); + "Wrong record length %lld of %lld at %lld", + block_info.rec_len-left_length, block_info.rec_len, start_recpos); got_error=1; break; } if (info->state->data_file_length < block_info.next_filepos) { mi_check_print_error(param, - "Found next-recordlink that points outside datafile at %s", - llstr(block_info.filepos,llbuff)); + "Found next-recordlink that points outside datafile at %lld", + block_info.filepos); got_error=1; break; } @@ -1130,8 +1110,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) if (_mi_rec_unpack(info,record,info->rec_buff,block_info.rec_len) == MY_FILE_ERROR) { - mi_check_print_error(param,"Found wrong record at %s", - llstr(start_recpos,llbuff)); + mi_check_print_error(param, "Found wrong record at %lld", + start_recpos); got_error=1; } else @@ -1142,8 +1122,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) if (_mi_rec_check(info,record, info->rec_buff,block_info.rec_len, MY_TEST(info->s->calc_checksum))) { - mi_check_print_error(param,"Found wrong packed record at %s", - llstr(start_recpos,llbuff)); + mi_check_print_error(param, "Found wrong packed record at %lld", + start_recpos); got_error=1; } } @@ -1167,8 +1147,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) block_info.rec_len > (uint) info->s->max_pack_length) { mi_check_print_error(param, - "Found block with wrong recordlength: %lu at %s", - block_info.rec_len, llstr(start_recpos,llbuff)); + "Found block with wrong recordlength: %lu at %lld", + block_info.rec_len, start_recpos); got_error=1; break; } @@ -1179,8 +1159,7 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) if (_mi_pack_rec_unpack(info, &info->bit_buff, record, info->rec_buff, block_info.rec_len)) { - mi_check_print_error(param,"Found wrong record at %s", - llstr(start_recpos,llbuff)); + mi_check_print_error(param, "Found wrong record at %lld", start_recpos); got_error=1; } param->glob_crc+= (*info->s->calc_check_checksum)(info,record); @@ -1199,7 +1178,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) records++; if (param->testflag & T_WRITE_LOOP && records % WRITE_COUNT == 0) { - printf("%s\r", llstr(records,llbuff)); (void) fflush(stdout); + printf("%lld\r", records); + fflush(stdout); } /* Check if keys match the record */ @@ -1225,9 +1205,9 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) SEARCH_SAME, info->s->state.key_root[key]); if (search_result) { - mi_check_print_error(param,"Record at: %10s " + mi_check_print_error(param, "Record at: %10lld " "Can't find key for index: %2d", - llstr(start_recpos,llbuff),key+1); + start_recpos, key+1); if (error++ > MAXERR || !(param->testflag & T_VERBOSE)) goto err2; } @@ -1253,8 +1233,9 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) } if (records != info->state->records) { - mi_check_print_error(param,"Record-count is not ok; is %-10s Should be: %s", - llstr(records,llbuff), llstr(info->state->records,llbuff2)); + mi_check_print_error(param, + "Record-count is not ok; is %-10lld Should be: %lld", + records, info->state->records); error=1; } else if (param->record_checksum && @@ -1289,34 +1270,29 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) if (del_length != info->state->empty) { mi_check_print_warning(param, - "Found %s deleted space. Should be %s", - llstr(del_length,llbuff2), - llstr(info->state->empty,llbuff)); + "Found %lld deleted space. Should be %lld", + del_length, info->state->empty); } if (used+empty+del_length != info->state->data_file_length) { mi_check_print_warning(param, - "Found %s record-data and %s unused data and %s deleted-data", - llstr(used,llbuff),llstr(empty,llbuff2), - llstr(del_length,llbuff3)); + "Found %lld record-data and %lld unused data and %lld deleted-data", + used, empty, del_length); mi_check_print_warning(param, - "Total %s, Should be: %s", - llstr((used+empty+del_length),llbuff), - llstr(info->state->data_file_length,llbuff2)); + "Total %lld, Should be: %lld", + (used+empty+del_length), info->state->data_file_length); } if (del_blocks != info->state->del) { mi_check_print_warning(param, - "Found %10s deleted blocks Should be: %s", - llstr(del_blocks,llbuff), - llstr(info->state->del,llbuff2)); + "Found %10lld deleted blocks Should be: %lld", + del_blocks, info->state->del); } if (splits != info->s->state.split) { mi_check_print_warning(param, - "Found %10s key parts. Should be: %s", - llstr(splits,llbuff), - llstr(info->s->state.split,llbuff2)); + "Found %10lld key parts. Should be: %lld", + splits, info->s->state.split); } if (param->testflag & T_INFO) { @@ -1324,8 +1300,8 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) puts(""); if (used != 0 && ! param->error_printed) { - printf("Records:%18s M.recordlength:%9lu Packed:%14.0f%%\n", - llstr(records,llbuff), (long)((used-link_used)/records), + printf("Records:%18lld M.recordlength:%9lu Packed:%14.0f%%\n", + records, (long)((used-link_used)/records), (info->s->base.blobs ? 0.0 : (ulonglong2double((ulonglong) info->s->base.reclength*records)- my_off_t2double(used))/ @@ -1336,17 +1312,18 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) my_off_t2double(used)*100.0)), ulonglong2double(splits - del_blocks) / records); } - printf("Record blocks:%12s Delete blocks:%10s\n", - llstr(splits-del_blocks,llbuff),llstr(del_blocks,llbuff2)); - printf("Record data: %12s Deleted data: %10s\n", - llstr(used-link_used,llbuff),llstr(del_length,llbuff2)); - printf("Lost space: %12s Linkdata: %10s\n", - llstr(empty,llbuff),llstr(link_used,llbuff2)); + printf("Record blocks:%12lld Delete blocks:%10lld\n", + splits-del_blocks, del_blocks); + printf("Record data: %12lld Deleted data: %10lld\n", + used-link_used, del_length); + printf("Lost space: %12lld Linkdata: %10lld\n", + empty, link_used); } my_free(mi_get_rec_buff_ptr(info, record)); DBUG_RETURN (error); err: - mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff)); + mi_check_print_error(param, + "got error: %d when reading datafile at record: %lld", my_errno, records); err2: my_free(mi_get_rec_buff_ptr(info, record)); param->testflag|=T_RETRY_WITHOUT_QUICK; @@ -1500,7 +1477,6 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info, my_off_t del; File new_file; MYISAM_SHARE *share=info->s; - char llbuff[22],llbuff2[22]; MI_SORT_INFO sort_info; MI_SORT_PARAM sort_param; DBUG_ENTER("mi_repair"); @@ -1520,7 +1496,7 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info, if (!(param->testflag & T_SILENT)) { printf("- recovering (with keycache) MyISAM-table '%s'\n",name); - printf("Data records: %s\n", llstr(info->state->records,llbuff)); + printf("Data records: %lld\n", info->state->records); } param->testflag|=T_REP; /* for easy checking */ @@ -1617,10 +1593,9 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info, if (my_errno != HA_ERR_FOUND_DUPP_KEY) goto err; DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength); - mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s", - info->errkey+1, - llstr(sort_param.start_recpos,llbuff), - llstr(info->dupp_key_pos,llbuff2)); + mi_check_print_info(param, + "Duplicate key %2d for record at %10lld against new record at %10lld", + info->errkey+1, sort_param.start_recpos, info->dupp_key_pos); if (param->testflag & T_VERBOSE) { (void) _mi_make_key(info,(uint) info->errkey,info->lastkey, @@ -1693,11 +1668,10 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info, if (!(param->testflag & T_SILENT)) { if (start_records != info->state->records) - printf("Data records: %s\n", llstr(info->state->records,llbuff)); + printf("Data records: %lld\n", info->state->records); if (sort_info.dupp) mi_check_print_warning(param, - "%s records have been removed", - llstr(sort_info.dupp,llbuff)); + "%lld records have been removed", sort_info.dupp); } got_error=0; @@ -1719,8 +1693,8 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info, if (got_error) { if (! param->error_printed) - mi_check_print_error(param,"%d for record at pos %s",my_errno, - llstr(sort_param.start_recpos,llbuff)); + mi_check_print_error(param, "%d for record at pos %lld", my_errno, + sort_param.start_recpos); if (new_file >= 0) { (void) mysql_file_close(new_file, MYF(0)); @@ -2006,7 +1980,6 @@ static int sort_one_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, uchar *buff,*keypos,*endpos; uchar key[HA_MAX_POSSIBLE_KEY_BUFF]; my_off_t new_page_pos,next_page; - char llbuff[22]; DBUG_ENTER("sort_one_index"); /* cannot walk over R-tree indices */ @@ -2021,8 +1994,8 @@ static int sort_one_index(HA_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, } if (!_mi_fetch_keypage(info,keyinfo,pagepos,DFLT_INIT_HITS,buff,0)) { - mi_check_print_error(param,"Can't read key block from filepos: %s", - llstr(pagepos,llbuff)); + mi_check_print_error(param, "Can't read key block from filepos: %lld", + pagepos); goto err; } if ((nod_flag=mi_test_if_nod(buff)) || keyinfo->key_alg == HA_KEY_ALG_FULLTEXT) @@ -2193,7 +2166,6 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, MYISAM_SHARE *share=info->s; HA_KEYSEG *keyseg; ulong *rec_per_key_part; - char llbuff[22], llbuff2[22]; MI_SORT_INFO sort_info; ulonglong UNINIT_VAR(key_map); DBUG_ENTER("mi_repair_by_sort"); @@ -2206,7 +2178,7 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, if (!(param->testflag & T_SILENT)) { printf("- recovering (with sort) MyISAM-table '%s'\n",name); - printf("Data records: %s\n", llstr(start_records,llbuff)); + printf("Data records: %lld\n", start_records); } param->testflag|=T_REP_BY_SORT; /* for easy checking */ param->retry_repair= 0; @@ -2440,8 +2412,9 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, if (info->state->records+1 < start_records) { mi_check_print_error(param, - "Couldn't fix table as SAFE_REPAIR was requested and we would loose too many rows. %s -> %s", - llstr(start_records, llbuff), llstr(info->state->records, llbuff2)); + "Couldn't fix table as SAFE_REPAIR was requested" + "and we would loose too many rows. %lld -> %lld", + start_records, info->state->records); info->state->records= start_records; goto err; } @@ -2506,11 +2479,10 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, if (!(param->testflag & T_SILENT)) { if (start_records != info->state->records) - printf("Data records: %s\n", llstr(info->state->records,llbuff)); + printf("Data records: %lld\n", info->state->records); if (sort_info.dupp) mi_check_print_warning(param, - "%s records have been removed", - llstr(sort_info.dupp,llbuff)); + "%lld records have been removed", sort_info.dupp); } got_error=0; @@ -2621,7 +2593,6 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, MYISAM_SHARE *share=info->s; ulong *rec_per_key_part; HA_KEYSEG *keyseg; - char llbuff[22]; IO_CACHE new_data_cache; /* For non-quick repair. */ IO_CACHE_SHARE io_share; MI_SORT_INFO sort_info; @@ -2639,7 +2610,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, if (!(param->testflag & T_SILENT)) { printf("- parallel recovering (with sort) MyISAM-table '%s'\n",name); - printf("Data records: %s\n", llstr(start_records,llbuff)); + printf("Data records: %lld\n", start_records); } param->testflag|=T_REP_PARALLEL; /* for easy checking */ param->retry_repair= 0; @@ -3044,11 +3015,10 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, if (!(param->testflag & T_SILENT)) { if (start_records != info->state->records) - printf("Data records: %s\n", llstr(info->state->records,llbuff)); + printf("Data records: %lld\n", info->state->records); if (sort_info.dupp) mi_check_print_warning(param, - "%s records have been removed", - llstr(sort_info.dupp,llbuff)); + "%lld records have been removed", sort_info.dupp); } got_error=0; @@ -3251,7 +3221,6 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) HA_CHECK *param=sort_info->param; MI_INFO *info=sort_info->info; MYISAM_SHARE *share=info->s; - char llbuff[22],llbuff2[22]; DBUG_ENTER("sort_get_next_record"); if (killed_ptr(param)) @@ -3316,15 +3285,13 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) if (pos & (MI_DYN_ALIGN_SIZE-1)) { if ((param->testflag & T_VERBOSE) || searching == 0) - mi_check_print_info(param,"Wrong aligned block at %s", - llstr(pos,llbuff)); + mi_check_print_info(param, "Wrong aligned block at %lld", pos); if (searching) goto try_next; } if (found_record && pos == param->search_after_block) - mi_check_print_info(param,"Block: %s used by record at %s", - llstr(param->search_after_block,llbuff), - llstr(sort_param->start_recpos,llbuff2)); + mi_check_print_info(param,"Block: %lld used by record at %lld", + param->search_after_block, sort_param->start_recpos); if (_mi_read_cache(&sort_param->read_cache, (uchar*) block_info.header,pos, MI_BLOCK_INFO_HEADER_LENGTH, @@ -3334,8 +3301,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) if (found_record) { mi_check_print_info(param, - "Can't read whole record at %s (errno: %d)", - llstr(sort_param->start_recpos,llbuff),errno); + "Can't read whole record at %lld (errno: %d)", + sort_param->start_recpos, errno); goto try_next; } DBUG_RETURN(-1); @@ -3359,9 +3326,9 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) uint i; if (param->testflag & T_VERBOSE || searching == 0) mi_check_print_info(param, - "Wrong bytesec: %3d-%3d-%3d at %10s; Skipped", + "Wrong bytesec: %3d-%3d-%3d at %10lld; Skipped", block_info.header[0],block_info.header[1], - block_info.header[2],llstr(pos,llbuff)); + block_info.header[2],pos); if (found_record) goto try_next; block_info.second_read=0; @@ -3385,8 +3352,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) { if (!searching) mi_check_print_info(param, - "Deleted block with impossible length %lu at %s", - block_info.block_len,llstr(pos,llbuff)); + "Deleted block with impossible length %lu at %lld", + block_info.block_len, pos); error=1; } else @@ -3399,8 +3366,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) { if (!searching) mi_check_print_info(param, - "Delete link points outside datafile at %s", - llstr(pos,llbuff)); + "Delete link points outside datafile at %lld", pos); error=1; } } @@ -3425,9 +3391,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) { if (!searching) mi_check_print_info(param, - "Found block with impossible length %u at %s; Skipped", - block_info.block_len+ (uint) (block_info.filepos-pos), - llstr(pos,llbuff)); + "Found block with impossible length %u at %lld; Skipped", + block_info.block_len + (uint) (block_info.filepos-pos), pos); if (found_record) goto try_next; searching=1; @@ -3482,17 +3447,17 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) { if (param->max_record_length >= block_info.rec_len) { - mi_check_print_error(param,"Not enough memory for blob at %s (need %lu)", - llstr(sort_param->start_recpos,llbuff), - (ulong) block_info.rec_len); + mi_check_print_error(param, + "Not enough memory for blob at %lld (need %lu)", + sort_param->start_recpos, (ulong) block_info.rec_len); DBUG_ASSERT(param->error_printed); DBUG_RETURN(1); } else { - mi_check_print_info(param,"Not enough memory for blob at %s (need %lu); Row skipped", - llstr(sort_param->start_recpos,llbuff), - (ulong) block_info.rec_len); + mi_check_print_info(param, + "Not enough memory for blob at %lld (need %lu); Row skipped", + sort_param->start_recpos, (ulong) block_info.rec_len); goto try_next; } } @@ -3503,16 +3468,16 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) if (left_length < block_info.data_len || ! block_info.data_len) { mi_check_print_info(param, - "Found block with too small length at %s; Skipped", - llstr(sort_param->start_recpos,llbuff)); + "Found block with too small length at %lld; Skipped", + sort_param->start_recpos); goto try_next; } if (block_info.filepos + block_info.data_len > sort_param->read_cache.end_of_file) { mi_check_print_info(param, - "Found block that points outside data file at %s", - llstr(sort_param->start_recpos,llbuff)); + "Found block that points outside data file at %lld", + sort_param->start_recpos); goto try_next; } /* @@ -3542,8 +3507,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) parallel_flag)) { mi_check_print_info(param, - "Read error for block at: %s (error: %d); Skipped", - llstr(block_info.filepos,llbuff),my_errno); + "Read error for block at: %lld (error: %d); Skipped", + block_info.filepos, my_errno); goto try_next; } left_length-=block_info.data_len; @@ -3551,15 +3516,16 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) pos=block_info.next_filepos; if (pos == HA_OFFSET_ERROR && left_length) { - mi_check_print_info(param,"Wrong block with wrong total length starting at %s", - llstr(sort_param->start_recpos,llbuff)); + mi_check_print_info(param, + "Wrong block with wrong total length starting at %lld", + sort_param->start_recpos); goto try_next; } if (pos + MI_BLOCK_INFO_HEADER_LENGTH > sort_param->read_cache.end_of_file) { - mi_check_print_info(param,"Found link that points at %s (outside data file) at %s", - llstr(pos,llbuff2), - llstr(sort_param->start_recpos,llbuff)); + mi_check_print_info(param, + "Found link that points at %lld (outside data file) at %lld", + pos, sort_param->start_recpos); goto try_next; } } while (left_length); @@ -3578,17 +3544,16 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) sort_param->calc_checksum && MY_TEST(info->s->calc_checksum))) { - mi_check_print_info(param,"Found wrong packed record at %s", - llstr(sort_param->start_recpos,llbuff)); + mi_check_print_info(param, "Found wrong packed record at %lld", + sort_param->start_recpos); goto try_next; } } goto finish; } if (!searching) - mi_check_print_info(param,"Key %d - Found wrong stored record at %s", - sort_param->key+1, - llstr(sort_param->start_recpos,llbuff)); + mi_check_print_info(param, "Key %d - Found wrong stored record at %lld", + sort_param->key+1, sort_param->start_recpos); try_next: DBUG_ASSERT(param->error_printed || param->note_printed); pos=(sort_param->start_recpos+=MI_DYN_ALIGN_SIZE); @@ -3621,9 +3586,9 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) block_info.rec_len > (uint) share->max_pack_length) { if (! searching) - mi_check_print_info(param,"Found block with wrong recordlength: %ld at %s\n", - block_info.rec_len, - llstr(sort_param->pos,llbuff)); + mi_check_print_info(param, + "Found block with wrong recordlength: %ld at %lld\n", + block_info.rec_len, sort_param->pos); continue; } if (_mi_read_cache(&sort_param->read_cache,(uchar*) sort_param->rec_buff, @@ -3631,8 +3596,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) READING_NEXT)) { if (! searching) - mi_check_print_info(param,"Couldn't read whole record from %s", - llstr(sort_param->pos,llbuff)); + mi_check_print_info(param, "Couldn't read whole record from %lld", + sort_param->pos); continue; } sort_param->rec_buff[block_info.rec_len]= 0; /* Keep valgrind happy */ @@ -3640,8 +3605,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) sort_param->rec_buff, block_info.rec_len)) { if (! searching) - mi_check_print_info(param,"Found wrong record at %s", - llstr(sort_param->pos,llbuff)); + mi_check_print_info(param, "Found wrong record at %lld", + sort_param->pos); continue; } if (!sort_param->fix_datafile) @@ -3790,8 +3755,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param) if ((param->testflag & T_WRITE_LOOP) && (info->state->records % WRITE_COUNT) == 0) { - char llbuff[22]; - printf("%s\r", llstr(info->state->records,llbuff)); + printf("%lld\r", info->state->records); (void) fflush(stdout); } } @@ -3815,7 +3779,6 @@ static int sort_key_cmp(void *sort_param_, const void *a_, const void *b_) static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a) { uint diff_pos[2]; - char llbuff[22],llbuff2[22]; MI_SORT_INFO *sort_info=sort_param->sort_info; HA_CHECK *param= sort_info->param; int cmp; @@ -3857,13 +3820,9 @@ static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a) == T_CREATE_UNIQUE_BY_SORT) param->testflag|= T_SUPPRESS_ERR_HANDLING; mi_check_print_warning(param, - "Duplicate key for record at %10s against record at %10s", - llstr(sort_info->info->lastpos,llbuff), - llstr(get_record_for_key(sort_info->info, - sort_param->keyinfo, - (uchar*) sort_info-> - key_block->lastkey), - llbuff2)); + "Duplicate key for record at %10lld against record at %10lld", + sort_info->info->lastpos, get_record_for_key(sort_info->info, + sort_param->keyinfo, (uchar*) sort_info->key_block->lastkey)); param->testflag|=T_RETRY_WITHOUT_QUICK; if (sort_info->param->testflag & T_VERBOSE) _mi_print_key(stdout,sort_param->seg,(uchar*) a, USE_WHOLE_KEY); diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 1a34bb8560291..7020674ca8caf 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -113,11 +113,11 @@ int main(int argc, char **argv) } if (check_param.total_files > 1) { /* Only if descript */ - char buff[22],buff2[22]; if (!(check_param.testflag & T_SILENT) || check_param.testflag & T_INFO) puts("\n---------\n"); - printf("\nTotal of all %d MyISAM-files:\nData records: %9s Deleted blocks: %9s\n",check_param.total_files,llstr(check_param.total_records,buff), - llstr(check_param.total_deleted,buff2)); + printf("\nTotal of all %d MyISAM-files:\nData records: %9lld " + "Deleted blocks: %9lld\n", check_param.total_files, + check_param.total_records, check_param.total_deleted); } free_defaults(default_argv); free_tmpdir(&myisamchk_tmpdir); @@ -803,7 +803,6 @@ static int myisamchk(HA_CHECK *param, char * filename) int rep_quick= MY_TEST(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS)); MI_INFO *info; File datafile; - char llbuff[22],llbuff2[22]; my_bool state_updated=0; MYISAM_SHARE *share; int open_mode; @@ -1080,9 +1079,8 @@ static int myisamchk(HA_CHECK *param, char * filename) if (!(param->testflag & T_SILENT) || param->testflag & T_INFO) printf("Checking MyISAM file: %s\n",filename); if (!(param->testflag & T_SILENT)) - printf("Data records: %7s Deleted blocks: %7s\n", - llstr(info->state->records,llbuff), - llstr(info->state->del,llbuff2)); + printf("Data records: %7lld Deleted blocks: %7lld\n", + info->state->records, info->state->del); error =chk_status(param,info); mi_intersect_keys_active(share->state.key_map, param->keys_in_use); error =chk_size(param,info); @@ -1211,7 +1209,6 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name) char buff[160],length[10],*pos,*end; enum en_fieldtype type; MYISAM_SHARE *share=info->s; - char llbuff[22],llbuff2[22]; DBUG_ENTER("describe"); printf("\nMyISAM file: %s\n",name); @@ -1263,35 +1260,32 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name) printf("Status: %s\n",buff); if (share->base.auto_key) { - printf("Auto increment key: %13d Last value: %13s\n", - share->base.auto_key, - llstr(share->state.auto_increment,llbuff)); + printf("Auto increment key: %13d Last value: %13lld\n", + share->base.auto_key, share->state.auto_increment); } if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)) - printf("Checksum: %23s\n",llstr(info->state->checksum,llbuff)); + printf("Checksum: %23lu\n", (unsigned long) info->state->checksum); if (share->options & HA_OPTION_DELAY_KEY_WRITE) printf("Keys are only flushed at close\n"); } - printf("Data records: %13s Deleted blocks: %13s\n", - llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2)); + printf("Data records: %13lld Deleted blocks: %13lld\n", + info->state->records, info->state->del); if (param->testflag & T_SILENT) DBUG_VOID_RETURN; /* This is enough */ if (param->testflag & T_VERBOSE) { #ifdef USE_RELOC - printf("Init-relocation: %13s\n",llstr(share->base.reloc,llbuff)); + printf("Init-relocation: %13lld\n", share->base.reloc); #endif - printf("Datafile parts: %13s Deleted data: %13s\n", - llstr(share->state.split,llbuff), - llstr(info->state->empty,llbuff2)); + printf("Datafile parts: %13lld Deleted data: %13lld\n", + share->state.split, info->state->empty); printf("Datafile pointer (bytes):%9d Keyfile pointer (bytes):%9d\n", share->rec_reflength,share->base.key_reflength); - printf("Datafile length: %13s Keyfile length: %13s\n", - llstr(info->state->data_file_length,llbuff), - llstr(info->state->key_file_length,llbuff2)); + printf("Datafile length: %13lld Keyfile length: %13lld\n", + info->state->data_file_length, info->state->key_file_length); if (info->s->base.reloc == 1L && info->s->base.records == 1L) puts("This is a one-record table"); @@ -1299,9 +1293,9 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name) { if (share->base.max_data_file_length != HA_OFFSET_ERROR || share->base.max_key_file_length != HA_OFFSET_ERROR) - printf("Max datafile length: %13s Max keyfile length: %13s\n", - llstr(share->base.max_data_file_length-1,llbuff), - ullstr(share->base.max_key_file_length - 1, llbuff2)); + printf("Max datafile length: %13lld Max keyfile length: %13llu\n", + share->base.max_data_file_length-1, + share->base.max_key_file_length - 1); } } @@ -1347,14 +1341,16 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name) printf("%-4d%-6ld%-3d %-8s%-21s", key+1,(long) keyseg->start+1,keyseg->length,text,buff); - if (share->state.key_root[key] != HA_OFFSET_ERROR) - llstr(share->state.key_root[key],buff); - else - buff[0]=0; if (param->testflag & T_VERBOSE) + { + if (share->state.key_root[key] == HA_OFFSET_ERROR) + buff[0]= '\0'; + else + longlong10_to_str(share->state.key_root[key], buff, 10); printf("%11lu %12s %10d", share->state.rec_per_key_part[keyseg_nr++], - buff,keyinfo->block_length); + buff, keyinfo->block_length); + } (void) putchar('\n'); while ((++keyseg)->type != HA_KEYTYPE_END) { @@ -1479,7 +1475,6 @@ static int mi_sort_records(HA_CHECK *param, uchar *temp_buff; ha_rows old_record_count; MYISAM_SHARE *share=info->s; - char llbuff[22],llbuff2[22]; MI_SORT_INFO sort_info; MI_SORT_PARAM sort_param; DBUG_ENTER("sort_records"); @@ -1518,9 +1513,8 @@ static int mi_sort_records(HA_CHECK *param, { printf("- Sorting records for MyISAM-table '%s'\n",name); if (write_info) - printf("Data records: %9s Deleted: %9s\n", - llstr(info->state->records,llbuff), - llstr(info->state->del,llbuff2)); + printf("Data records: %9lld Deleted: %9lld\n", + info->state->records, info->state->del); } if (share->state.key_root[sort_key] == HA_OFFSET_ERROR) DBUG_RETURN(0); /* Nothing to do */ @@ -1596,9 +1590,8 @@ static int mi_sort_records(HA_CHECK *param, if (info->state->records != old_record_count) { - mi_check_print_error(param,"found %s of %s records", - llstr(info->state->records,llbuff), - llstr(old_record_count,llbuff2)); + mi_check_print_error(param, "found %lld of %lld records", + info->state->records, old_record_count); goto err; } @@ -1654,7 +1647,6 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, uchar *temp_buff,*keypos,*endpos; my_off_t next_page,rec_pos; uchar lastkey[HA_MAX_KEY_BUFF]; - char llbuff[22]; MI_SORT_INFO *sort_info= sort_param->sort_info; HA_CHECK *param=sort_info->param; DBUG_ENTER("sort_record_index"); @@ -1682,8 +1674,8 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, (uint) keyinfo->block_length, next_page, MYF(MY_NABP+MY_WME))) { - mi_check_print_error(param,"Can't read keys from filepos: %s", - llstr(next_page,llbuff)); + mi_check_print_error(param, "Can't read keys from filepos: %lld", + next_page); goto err; } if (sort_record_index(sort_param, info,keyinfo,next_page,temp_buff,sort_key, diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index cb0096a878a9c..e6a0fb928948a 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -303,7 +303,7 @@ static int examine_log(char * file_name, char **table_names) ulong access_time,length; my_off_t filepos; int lock_command,mi_result; - char isam_file_name[FN_REFLEN],llbuff[21],llbuff2[21]; + char isam_file_name[FN_REFLEN]; uchar head[20]; uchar* buff; struct test_if_open_param open_param; @@ -493,9 +493,8 @@ static int examine_log(char * file_name, char **table_names) { fflush(stdout); (void) fprintf(stderr, - "Warning: error %d, expected %d on command %s at %s\n", - my_errno,result,command_name[command], - llstr(isamlog_filepos,llbuff)); + "Warning: error %d, expected %d on command %s at %lld\n", + my_errno, result, command_name[command], isamlog_filepos); fflush(stderr); } } @@ -608,9 +607,8 @@ static int examine_log(char * file_name, char **table_names) } if (!recover && filepos != curr_file_info->isam->lastpos) { - printf("error: Wrote at position: %s, should have been %s", - llstr(curr_file_info->isam->lastpos,llbuff), - llstr(filepos,llbuff2)); + printf("error: Wrote at position: %lld, should have been %lld", + curr_file_info->isam->lastpos, filepos); goto end; } } @@ -662,9 +660,8 @@ static int examine_log(char * file_name, char **table_names) goto end; com_err: fflush(stdout); - (void) fprintf(stderr,"Got error %d, expected %d on command %s at %s\n", - my_errno,result,command_name[command], - llstr(isamlog_filepos,llbuff)); + (void) fprintf(stderr, "Got error %d, expected %d on command %s at %lld\n", + my_errno,result, command_name[command], isamlog_filepos); fflush(stderr); end: end_key_cache(dflt_key_cache, 1); @@ -831,11 +828,10 @@ static int find_record_with_key(struct file_info *file_info, uchar *record) static void printf_log(const char *format,...) { - char llbuff[21]; va_list args; va_start(args,format); if (verbose > 2) - printf("%9s:",llstr(isamlog_filepos,llbuff)); + printf("%9lld:", isamlog_filepos); if (verbose > 1) printf("%5ld ",isamlog_process); /* Write process number */ (void) vprintf((char*) format,args); diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 077507e897c71..19b0300dcaf83 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -1133,7 +1133,6 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) { uint idx; my_off_t total_count; - char llbuf[32]; DBUG_PRINT("info", ("column: %3u", (uint) (count - huff_counts + 1))); if (verbose >= 2) @@ -1154,19 +1153,17 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) if (count->counts[idx]) { total_count+= count->counts[idx]; - DBUG_PRINT("info", ("counts[0x%02x]: %12s", idx, - llstr((longlong) count->counts[idx], llbuf))); + DBUG_PRINT("info", ("counts[0x%02x]: %12lld", idx, + (longlong) count->counts[idx])); if (verbose >= 2) - printf("counts[0x%02x]: %12s\n", idx, - llstr((longlong) count->counts[idx], llbuf)); + printf("counts[0x%02x]: %12lld\n", idx, + (longlong) count->counts[idx]); } } - DBUG_PRINT("info", ("total: %12s", llstr((longlong) total_count, - llbuf))); + DBUG_PRINT("info", ("total: %12lld", (longlong) total_count)); if ((verbose >= 2) && total_count) { - printf("total: %12s\n", - llstr((longlong) total_count, llbuf)); + printf("total: %12lld\n", (longlong) total_count); } } @@ -2438,7 +2435,6 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) uint i,max_calc_length,pack_ref_length,min_record_length,max_record_length, intervall,field_length,max_pack_length,pack_blob_length; my_off_t record_count; - char llbuf[32]; ulong length,pack_length; uchar *record,*pos,*end_pos,*record_pos,*start_pos; HUFF_COUNTS *count,*end_count; @@ -2798,7 +2794,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts) my_progname, error); } if (verbose >= 2) - printf("wrote %s records.\n", llstr((longlong) record_count, llbuf)); + printf("wrote %lld records.\n", (longlong) record_count); my_afree((uchar*) record); mrg->ref_length=max_pack_length; diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 099f3c6766012..e0480db1360ae 100644 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -23,7 +23,7 @@ SET(STRINGS_SOURCES bchange.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c ctype-unidata.c - is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c + is_prefix.c longlong2str.c my_strtoll10.c my_vsnprintf.c str2int.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c strxmov.c strxnmov.c xml.c strmov_overlapp.c diff --git a/strings/llstr.c b/strings/llstr.c deleted file mode 100644 index 3525cab79ca32..0000000000000 --- a/strings/llstr.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2000 TXT DataKonsult Ab & Monty Program Ab - Copyright (c) 2009-2011, Monty Program Ab - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. -*/ - -/* - Defines: llstr(); - - llstr(value, buff); - - This function saves a longlong value in a buffer and returns the pointer to - the buffer. This is useful when trying to portable print longlong - variables with printf() as there is no usable printf() standard one can use. -*/ - - -#include "strings_def.h" - -char *llstr(longlong value,char *buff) -{ - longlong10_to_str(value,buff,-10); - return buff; -} - -char *ullstr(longlong value,char *buff) -{ - longlong10_to_str(value,buff,10); - return buff; -} - diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index df28696f2bea0..5d2d1ad02177f 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -1419,7 +1419,6 @@ static void test_prepare() double double_data, o_double_data; ulong length[7], len; my_bool is_null[7]; - char llbuf[22]; MYSQL_BIND my_bind[7]; char query[MAX_TEST_QUERY_LENGTH]; @@ -1538,8 +1537,7 @@ static void test_prepare() fprintf(stdout, "\n\t tiny : %d (%lu)", tiny_data, length[0]); fprintf(stdout, "\n\t short : %d (%lu)", small_data, length[3]); fprintf(stdout, "\n\t int : %d (%lu)", int_data, length[2]); - fprintf(stdout, "\n\t big : %s (%lu)", llstr(big_data, llbuf), - length[4]); + fprintf(stdout, "\n\t big : %lld (%lu)", big_data, length[4]); fprintf(stdout, "\n\t float : %f (%lu)", real_data, length[5]); fprintf(stdout, "\n\t double : %f (%lu)", double_data, length[6]); @@ -3727,7 +3725,6 @@ static void test_bind_result_ext() MYSQL_BIND my_bind[8]; ulong length[8]; my_bool is_null[8]; - char llbuf[22]; myheader("test_bind_result_ext"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_result"); @@ -3801,7 +3798,7 @@ static void test_bind_result_ext() fprintf(stdout, "\n data (tiny) : %d", t_data); fprintf(stdout, "\n data (short) : %d", s_data); fprintf(stdout, "\n data (int) : %d", i_data); - fprintf(stdout, "\n data (big) : %s", llstr(b_data, llbuf)); + fprintf(stdout, "\n data (big) : %lld", b_data); fprintf(stdout, "\n data (float) : %f", f_data); fprintf(stdout, "\n data (double) : %f", d_data); @@ -6968,7 +6965,6 @@ static void test_ushort_bug() ulonglong longlong_value; int rc; uchar tiny_value; - char llbuf[22]; myheader("test_ushort_bug"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_ushort"); @@ -7020,8 +7016,7 @@ static void test_ushort_bug() { fprintf(stdout, "\n ushort : %d (%ld)", short_value, s_length); fprintf(stdout, "\n ulong : %lu (%ld)", (ulong) long_value, l_length); - fprintf(stdout, "\n longlong : %s (%ld)", llstr(longlong_value, llbuf), - ll_length); + fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); } @@ -7056,7 +7051,6 @@ static void test_sshort_bug() ulonglong longlong_value; int rc; uchar tiny_value; - char llbuf[22]; myheader("test_sshort_bug"); @@ -7107,8 +7101,7 @@ static void test_sshort_bug() { fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length); fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length); - fprintf(stdout, "\n longlong : %s (%ld)", llstr(longlong_value, llbuf), - ll_length); + fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); } @@ -7143,7 +7136,6 @@ static void test_stiny_bug() ulonglong longlong_value; int rc; uchar tiny_value; - char llbuf[22]; myheader("test_stiny_bug"); @@ -7193,8 +7185,7 @@ static void test_stiny_bug() { fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length); fprintf(stdout, "\n slong : %ld (%ld)", (long) long_value, l_length); - fprintf(stdout, "\n longlong : %s (%ld)", llstr(longlong_value, llbuf), - ll_length); + fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); }