diff --git a/config/ac-macros/plugins.m4 b/config/ac-macros/plugins.m4 index 41abdd159f2..e05bbc48d0e 100644 --- a/config/ac-macros/plugins.m4 +++ b/config/ac-macros/plugins.m4 @@ -267,7 +267,6 @@ dnl we have to recompile these modules when we want to dnl to compile server parts with the different #defines dnl Normally it happens when we compile the embedded server dnl Thus one should mark such files in his handler using this macro -dnl (currently only one such a file per plugin is supported) dnl dnl --------------------------------------------------------------------------- @@ -463,11 +462,13 @@ dnl Although this is "pretty", it breaks libmysqld build mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]" [with_plugin_]$2=yes AC_MSG_RESULT([yes]) - m4_ifdef([$11],[ - condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp($11, [[^/]+$], [\&])" - condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp($11, [[^/]+\.], [\&o])" - condition_dependent_plugin_links="$condition_dependent_plugin_links $6/$11" - condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp($11, [^.+[/$]], [\&])" + m4_ifdef([$11], [ + m4_foreach([plugin], [$11], [ + condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp(plugin, [[^/]+$], [\&])" + condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp(plugin, [[^/]+\.], [\&o])" + condition_dependent_plugin_links="$condition_dependent_plugin_links $6/plugin" + condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp(plugin, [^.+[/$]], [\&])" + ]) ]) fi fi diff --git a/mysql-test/suite/pbxt/t/load_unique_error1.inc b/mysql-test/std_data/pbxt_load_unique_error1.inc similarity index 100% rename from mysql-test/suite/pbxt/t/load_unique_error1.inc rename to mysql-test/std_data/pbxt_load_unique_error1.inc diff --git a/mysql-test/suite/pbxt/r/pbxt_bugs.result b/mysql-test/suite/pbxt/r/pbxt_bugs.result index a6db895d3d2..a9f62ff69bc 100644 --- a/mysql-test/suite/pbxt/r/pbxt_bugs.result +++ b/mysql-test/suite/pbxt/r/pbxt_bugs.result @@ -1212,7 +1212,7 @@ c1 2147483647 DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(255)); -LOAD DATA LOCAL INFILE 'suite/pbxt/t/load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/pbxt_load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2; SELECT * FROM t1 ORDER BY c1; c1 c2 0 opq diff --git a/mysql-test/suite/pbxt/t/pbxt_bugs.test b/mysql-test/suite/pbxt/t/pbxt_bugs.test index b774e9e3034..bff98e36bf3 100644 --- a/mysql-test/suite/pbxt/t/pbxt_bugs.test +++ b/mysql-test/suite/pbxt/t/pbxt_bugs.test @@ -921,7 +921,8 @@ SELECT c1 FROM t2; DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(255)); -LOAD DATA LOCAL INFILE 'suite/pbxt/t/load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/pbxt_load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2; --sorted_result SELECT * FROM t1 ORDER BY c1; DROP TABLE t1; diff --git a/mysql-test/suite/pbxt/t/pbxt_locking.test b/mysql-test/suite/pbxt/t/pbxt_locking.test index 975015b22e2..cdc54df5441 100644 --- a/mysql-test/suite/pbxt/t/pbxt_locking.test +++ b/mysql-test/suite/pbxt/t/pbxt_locking.test @@ -1,6 +1,9 @@ # This test covers various aspects of PBXT locking mechanism, including # internal permanent/temporary row locking and MySQL locking +# SHOW PROCESSLIST has hardcoded "Writing to net" as state. +-- source include/not_embedded.inc + # TEST: select for update test drop table if exists t1; diff --git a/mysql-test/suite/pbxt/t/pbxt_transactions.test b/mysql-test/suite/pbxt/t/pbxt_transactions.test index 815d2258d0e..65a008ff7eb 100644 --- a/mysql-test/suite/pbxt/t/pbxt_transactions.test +++ b/mysql-test/suite/pbxt/t/pbxt_transactions.test @@ -1,3 +1,6 @@ +# We cannot run mysqldump against embedded server. +-- source include/not_embedded.inc + --disable_warnings drop table if exists t1, t2, t3; --enable_warnings diff --git a/mysql-test/suite/pbxt/t/ps_1general.test b/mysql-test/suite/pbxt/t/ps_1general.test index 96cc04dbb75..8cfb2534b7b 100644 --- a/mysql-test/suite/pbxt/t/ps_1general.test +++ b/mysql-test/suite/pbxt/t/ps_1general.test @@ -582,7 +582,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ; create table t5 (a int) ; # rename must fail, t7 does not exist # Clean up the filename here because embedded server reports whole path ---replace_result $MYSQLTEST_VARDIR . master-data/ '' t7.frm t7 +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' t7.frm t7 --error 1017 execute stmt1 ; create table t7 (a int) ; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 37e5a583840..56d181bdda2 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1168,22 +1168,7 @@ int plugin_init(int *argc, char **argv, int flags) !my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name, 6, (const uchar*) "InnoDB", 6)) continue; -#ifdef EMBEDDED_LIBRARY - /* - MariaDB: disable PBXT in embedded server. We do this for two reasons - - PBXT currently doesn't work in embedded server (see - https://bugs.launchpad.net/maria/+bug/439889) - - Embedded server is supposed to be "leaner" and our current - understanding of that is "without PBXT". At the same time, we want - regular server to be with PBXT, and since we don't support compiling - embedded server with different options than the regular server, - the only way was to disable PBXT from here. - */ - if (!my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name, - 4, (const uchar*) "PBXT", 4)) - continue; -#endif bzero(&tmp, sizeof(tmp)); tmp.plugin= plugin; tmp.name.str= (char *)plugin->name; diff --git a/storage/pbxt/plug.in b/storage/pbxt/plug.in index 67a8e7b0ac9..02c5d8adcbe 100644 --- a/storage/pbxt/plug.in +++ b/storage/pbxt/plug.in @@ -5,3 +5,4 @@ MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt.a]) MYSQL_PLUGIN_ACTIONS(pbxt, [ # AC_CONFIG_FILES(storage/pbxt/src/Makefile) ]) +MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(pbxt, [[src/ha_pbxt.cc],[src/myxt_xt.cc],[src/discover_xt.cc]]) diff --git a/storage/pbxt/src/Makefile.am b/storage/pbxt/src/Makefile.am index 5644517bcc0..fc4c4ef8f1e 100644 --- a/storage/pbxt/src/Makefile.am +++ b/storage/pbxt/src/Makefile.am @@ -46,7 +46,5 @@ libpbxt_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99 EXTRA_LIBRARIES = libpbxt.a noinst_LIBRARIES = libpbxt.a libpbxt_a_SOURCES = $(libpbxt_la_SOURCES) -libpbxt_a_CXXFLAGS = $(AM_CXXFLAGS) -libpbxt_a_CFLAGS = $(AM_CFLAGS) -std=c99 EXTRA_DIST = pbms_enabled.cc win_inttypes.h diff --git a/storage/pbxt/src/ha_pbxt.cc b/storage/pbxt/src/ha_pbxt.cc index 0db6d9556c7..01f2927983d 100644 --- a/storage/pbxt/src/ha_pbxt.cc +++ b/storage/pbxt/src/ha_pbxt.cc @@ -1175,8 +1175,12 @@ static int pbxt_init(void *p) * +1 Temporary thread (e.g. TempForClose, TempForEnd) */ #ifndef DRIZZLED +#ifdef EMBEDDED_LIBRARY + pbxt_max_threads = 100; +#else if (pbxt_max_threads == 0) pbxt_max_threads = max_connections + 7; +#endif #endif self = xt_init_threading(pbxt_max_threads); /* Create the main self: */ if (!self) diff --git a/storage/pbxt/src/table_xt.cc b/storage/pbxt/src/table_xt.cc index 55cc695e7c2..1aef77ef253 100644 --- a/storage/pbxt/src/table_xt.cc +++ b/storage/pbxt/src/table_xt.cc @@ -1297,7 +1297,7 @@ xtPublic void xt_create_table(XTThreadPtr self, XTPathStrPtr name, XTDictionaryP XTSortedListInfoRec li_undo; #ifdef TRACE_CREATE_TABLES - printf("CREATE %s\n", name->ps_path); + fprintf(stderr, "CREATE %s\n", name->ps_path); #endif enter_(); if (strlen(xt_last_name_of_path(name->ps_path)) > XT_TABLE_NAME_SIZE-1) @@ -1619,7 +1619,7 @@ xtPublic void xt_drop_table(XTThreadPtr self, XTPathStrPtr tab_name, xtBool drop enter_(); #ifdef TRACE_CREATE_TABLES - printf("DROP %s\n", tab_name->ps_path); + fprintf(stderr, "DROP %s\n", tab_name->ps_path); #endif table_pool = tab_lock_table(self, tab_name, FALSE, TRUE, TRUE, &tab); @@ -1777,7 +1777,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) u_llong ext_data_len = 0; #if defined(DUMP_CHECK_TABLE) || defined(CHECK_TABLE_STATS) - printf("\nCHECK TABLE: %s\n", tab->tab_name->ps_path); + fprintf(stderr, "\nCHECK TABLE: %s\n", tab->tab_name->ps_path); #endif xt_lock_mutex(self, &tab->tab_db->db_co_ext_lock); @@ -1787,38 +1787,38 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) pushr_(xt_unlock_mutex, &tab->tab_rec_lock); #ifdef CHECK_TABLE_STATS - printf("Record buffer size = %lu\n", (u_long) tab->tab_dic.dic_mysql_buf_size); - printf("Fixed length rec. len. = %lu\n", (u_long) tab->tab_dic.dic_mysql_rec_size); - printf("Handle data record size = %lu\n", (u_long) tab->tab_dic.dic_rec_size); - printf("Min/max header size = %d/%d\n", (int) offsetof(XTTabRecFix, rf_data), tab->tab_dic.dic_rec_fixed ? (int) offsetof(XTTabRecFix, rf_data) : (int) offsetof(XTTabRecExtDRec, re_data)); - printf("Min/avg/max record size = %llu/%llu/%llu\n", (u_llong) tab->tab_dic.dic_min_row_size, (u_llong) tab->tab_dic.dic_ave_row_size, (u_llong) tab->tab_dic.dic_max_row_size); + fprintf(stderr, "Record buffer size = %lu\n", (u_long) tab->tab_dic.dic_mysql_buf_size); + fprintf(stderr, "Fixed length rec. len. = %lu\n", (u_long) tab->tab_dic.dic_mysql_rec_size); + fprintf(stderr, "Handle data record size = %lu\n", (u_long) tab->tab_dic.dic_rec_size); + fprintf(stderr, "Min/max header size = %d/%d\n", (int) offsetof(XTTabRecFix, rf_data), tab->tab_dic.dic_rec_fixed ? (int) offsetof(XTTabRecFix, rf_data) : (int) offsetof(XTTabRecExtDRec, re_data)); + fprintf(stderr, "Min/avg/max record size = %llu/%llu/%llu\n", (u_llong) tab->tab_dic.dic_min_row_size, (u_llong) tab->tab_dic.dic_ave_row_size, (u_llong) tab->tab_dic.dic_max_row_size); if (tab->tab_dic.dic_def_ave_row_size) - printf("Avg row len set for tab = %lu\n", (u_long) tab->tab_dic.dic_def_ave_row_size); + fprintf(stderr, "Avg row len set for tab = %lu\n", (u_long) tab->tab_dic.dic_def_ave_row_size); else - printf("Avg row len set for tab = not specified\n"); - printf("Rows fixed length = %s\n", tab->tab_dic.dic_rec_fixed ? "YES" : "NO"); + fprintf(stderr, "Avg row len set for tab = not specified\n"); + fprintf(stderr, "Rows fixed length = %s\n", tab->tab_dic.dic_rec_fixed ? "YES" : "NO"); if (tab->tab_dic.dic_tab_flags & XT_TAB_FLAGS_TEMP_TAB) - printf("Table type = TEMP\n"); + fprintf(stderr, "Table type = TEMP\n"); if (tab->tab_dic.dic_def_ave_row_size) - printf("Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH_SPEC); + fprintf(stderr, "Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH_SPEC); else - printf("Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH); - printf("Minimum variable size = %lu\n", (u_long) XT_TAB_MIN_VAR_REC_LENGTH); - printf("Minimum auto-increment = %llu\n", (u_llong) tab->tab_dic.dic_min_auto_inc); - printf("Number of columns = %lu\n", (u_long) tab->tab_dic.dic_no_of_cols); - printf("Number of fixed columns = %lu\n", (u_long) tab->tab_dic.dic_fix_col_count); - printf("Columns req. for index = %lu\n", (u_long) tab->tab_dic.dic_ind_cols_req); + fprintf(stderr, "Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH); + fprintf(stderr, "Minimum variable size = %lu\n", (u_long) XT_TAB_MIN_VAR_REC_LENGTH); + fprintf(stderr, "Minimum auto-increment = %llu\n", (u_llong) tab->tab_dic.dic_min_auto_inc); + fprintf(stderr, "Number of columns = %lu\n", (u_long) tab->tab_dic.dic_no_of_cols); + fprintf(stderr, "Number of fixed columns = %lu\n", (u_long) tab->tab_dic.dic_fix_col_count); + fprintf(stderr, "Columns req. for index = %lu\n", (u_long) tab->tab_dic.dic_ind_cols_req); if (tab->tab_dic.dic_ind_rec_len) - printf("Rec len req. for index = %llu\n", (u_llong) tab->tab_dic.dic_ind_rec_len); - printf("Columns req. for blobs = %lu\n", (u_long) tab->tab_dic.dic_blob_cols_req); - printf("Number of blob columns = %lu\n", (u_long) tab->tab_dic.dic_blob_count); - printf("Number of indices = %lu\n", (u_long) tab->tab_dic.dic_key_count); + fprintf(stderr, "Rec len req. for index = %llu\n", (u_llong) tab->tab_dic.dic_ind_rec_len); + fprintf(stderr, "Columns req. for blobs = %lu\n", (u_long) tab->tab_dic.dic_blob_cols_req); + fprintf(stderr, "Number of blob columns = %lu\n", (u_long) tab->tab_dic.dic_blob_count); + fprintf(stderr, "Number of indices = %lu\n", (u_long) tab->tab_dic.dic_key_count); #endif #ifdef DUMP_CHECK_TABLE - printf("Records:-\n"); - printf("Free list: %llu (%llu)\n", (u_llong) tab->tab_rec_free_id, (u_llong) tab->tab_rec_fnum); - printf("EOF: %llu\n", (u_llong) tab->tab_rec_eof_id); + fprintf(stderr, "Records:-\n"); + fprintf(stderr, "Free list: %llu (%llu)\n", (u_llong) tab->tab_rec_free_id, (u_llong) tab->tab_rec_fnum); + fprintf(stderr, "EOF: %llu\n", (u_llong) tab->tab_rec_eof_id); #endif rec_size = XT_REC_EXT_HEADER_SIZE; @@ -1830,24 +1830,24 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) xt_throw(self); #ifdef DUMP_CHECK_TABLE - printf("%-4llu ", (u_llong) rec_id); + fprintf(stderr, "%-4llu ", (u_llong) rec_id); #endif switch (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_MASK) { case XT_TAB_STATUS_FREED: #ifdef DUMP_CHECK_TABLE - printf("======== "); + fprintf(stderr, "======== "); #endif free_rec_count++; break; case XT_TAB_STATUS_DELETE: #ifdef DUMP_CHECK_TABLE - printf("delete "); + fprintf(stderr, "delete "); #endif delete_rec_count++; break; case XT_TAB_STATUS_FIXED: #ifdef DUMP_CHECK_TABLE - printf("record-F "); + fprintf(stderr, "record-F "); #endif alloc_rec_count++; row_size = myxt_store_row_length(ot, (char *) ot->ot_row_rbuffer + XT_REC_FIX_HEADER_SIZE); @@ -1859,7 +1859,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) break; case XT_TAB_STATUS_VARIABLE: #ifdef DUMP_CHECK_TABLE - printf("record-V "); + fprintf(stderr, "record-V "); #endif alloc_rec_count++; row_size = myxt_load_row_length(ot, tab->tab_dic.dic_rec_size, ot->ot_row_rbuffer + XT_REC_FIX_HEADER_SIZE, NULL); @@ -1871,7 +1871,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) break; case XT_TAB_STATUS_EXT_DLOG: #ifdef DUMP_CHECK_TABLE - printf("record-X "); + fprintf(stderr, "record-X "); #endif alloc_rec_count++; ext_data_len += XT_GET_DISK_4(rec_buf->re_log_dat_siz_4); @@ -1885,9 +1885,9 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) } #ifdef DUMP_CHECK_TABLE if (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_CLEANED_BIT) - printf("C"); + fprintf(stderr, "C"); else - printf(" "); + fprintf(stderr, " "); #endif prev_rec_id = XT_GET_DISK_4(rec_buf->tr_prev_rec_id_4); xn_id = XT_GET_DISK_4(rec_buf->tr_xact_id_4); @@ -1895,12 +1895,12 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) switch (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_MASK) { case XT_TAB_STATUS_FREED: #ifdef DUMP_CHECK_TABLE - printf(" prev=%-3llu (xact=%-3llu row=%lu)\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); + fprintf(stderr, " prev=%-3llu (xact=%-3llu row=%lu)\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); #endif break; case XT_TAB_STATUS_EXT_DLOG: #ifdef DUMP_CHECK_TABLE - printf(" prev=%-3llu xact=%-3llu row=%lu Xlog=%lu Xoff=%llu Xsiz=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id, (u_long) XT_GET_DISK_2(rec_buf->re_log_id_2), (u_llong) XT_GET_DISK_6(rec_buf->re_log_offs_6), (u_long) XT_GET_DISK_4(rec_buf->re_log_dat_siz_4)); + fprintf(stderr, " prev=%-3llu xact=%-3llu row=%lu Xlog=%lu Xoff=%llu Xsiz=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id, (u_long) XT_GET_DISK_2(rec_buf->re_log_id_2), (u_llong) XT_GET_DISK_6(rec_buf->re_log_offs_6), (u_long) XT_GET_DISK_4(rec_buf->re_log_dat_siz_4)); #endif log_size = XT_GET_DISK_4(rec_buf->re_log_dat_siz_4); @@ -1922,7 +1922,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) break; default: #ifdef DUMP_CHECK_TABLE - printf(" prev=%-3llu xact=%-3llu row=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); + fprintf(stderr, " prev=%-3llu xact=%-3llu row=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); #endif break; } @@ -1931,16 +1931,16 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) #ifdef CHECK_TABLE_STATS if (!tab->tab_dic.dic_rec_fixed) - printf("Extendend data length = %llu\n", ext_data_len); + fprintf(stderr, "Extendend data length = %llu\n", ext_data_len); if (alloc_rec_count) { - printf("Minumum comp. rec. len. = %llu\n", (u_llong) min_comp_rec_len); - printf("Average comp. rec. len. = %llu\n", (u_llong) ((double) alloc_rec_bytes / (double) alloc_rec_count + (double) 0.5)); - printf("Maximum comp. rec. len. = %llu\n", (u_llong) max_comp_rec_len); + fprintf(stderr, "Minumum comp. rec. len. = %llu\n", (u_llong) min_comp_rec_len); + fprintf(stderr, "Average comp. rec. len. = %llu\n", (u_llong) ((double) alloc_rec_bytes / (double) alloc_rec_count + (double) 0.5)); + fprintf(stderr, "Maximum comp. rec. len. = %llu\n", (u_llong) max_comp_rec_len); } - printf("Free record count = %llu\n", (u_llong) free_rec_count); - printf("Deleted record count = %llu\n", (u_llong) delete_rec_count); - printf("Allocated record count = %llu\n", (u_llong) alloc_rec_count); + fprintf(stderr, "Free record count = %llu\n", (u_llong) free_rec_count); + fprintf(stderr, "Deleted record count = %llu\n", (u_llong) delete_rec_count); + fprintf(stderr, "Allocated record count = %llu\n", (u_llong) alloc_rec_count); #endif if (tab->tab_rec_fnum != free_rec_count) xt_logf(XT_INFO, "Table %s: incorrect number of free blocks, %llu, should be: %llu\n", tab->tab_name, (u_llong) free_rec_count, (u_llong) tab->tab_rec_fnum); @@ -1978,9 +1978,9 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) pushr_(xt_unlock_mutex, &tab->tab_row_lock); #ifdef DUMP_CHECK_TABLE - printf("Rows:-\n"); - printf("Free list: %llu (%llu)\n", (u_llong) tab->tab_row_free_id, (u_llong) tab->tab_row_fnum); - printf("EOF: %llu\n", (u_llong) tab->tab_row_eof_id); + fprintf(stderr, "Rows:-\n"); + fprintf(stderr, "Free list: %llu (%llu)\n", (u_llong) tab->tab_row_free_id, (u_llong) tab->tab_row_fnum); + fprintf(stderr, "EOF: %llu\n", (u_llong) tab->tab_row_eof_id); #endif rec_id = 1; @@ -1988,13 +1988,13 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) if (!tab->tab_rows.xt_tc_read_4(ot->ot_row_file, rec_id, &ref_id, self)) xt_throw(self); #ifdef DUMP_CHECK_TABLE - printf("%-3llu ", (u_llong) rec_id); + fprintf(stderr, "%-3llu ", (u_llong) rec_id); #endif #ifdef DUMP_CHECK_TABLE if (ref_id == 0) - printf("====== 0\n"); + fprintf(stderr, "====== 0\n"); else - printf("in use %llu\n", (u_llong) ref_id); + fprintf(stderr, "in use %llu\n", (u_llong) ref_id); #endif rec_id++; } @@ -2026,7 +2026,7 @@ xtPublic void xt_rename_table(XTThreadPtr self, XTPathStrPtr old_name, XTPathStr memset(&dic, 0, sizeof(dic)); #ifdef TRACE_CREATE_TABLES - printf("RENAME %s --> %s\n", old_name->ps_path, new_name->ps_path); + fprintf(stderr, "RENAME %s --> %s\n", old_name->ps_path, new_name->ps_path); #endif if (strlen(xt_last_name_of_path(new_name->ps_path)) > XT_TABLE_NAME_SIZE-1) xt_throw_taberr(XT_CONTEXT, XT_ERR_NAME_TOO_LONG, new_name); @@ -2221,7 +2221,7 @@ xtPublic xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtB xt_tab_store_header(ot, &rec_head); #ifdef TRACE_FLUSH - printf("FLUSH rec/row %d %s\n", (int) tab->tab_bytes_to_flush, tab->tab_name->ps_path); + fprintf(stderr, "FLUSH rec/row %d %s\n", (int) tab->tab_bytes_to_flush, tab->tab_name->ps_path); fflush(stdout); #endif /* Write the table header: */ @@ -2276,7 +2276,7 @@ xtPublic xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtB xt_unlock_mutex_ns(&cp->cp_state_lock); #ifdef TRACE_FLUSH - printf("FLUSH --end-- %s\n", tab->tab_name->ps_path); + fprintf(stderr, "FLUSH --end-- %s\n", tab->tab_name->ps_path); fflush(stdout); #endif xt_unlock_mutex_ns(&tab->tab_rec_flush_lock); diff --git a/storage/pbxt/src/thread_xt.cc b/storage/pbxt/src/thread_xt.cc index 524c5bc5ac3..14c2a5e3b09 100644 --- a/storage/pbxt/src/thread_xt.cc +++ b/storage/pbxt/src/thread_xt.cc @@ -96,7 +96,7 @@ xtPublic xtBool xt_init_logging(void) { int err; - log_file = stdout; + log_file = stderr; log_level = XT_LOG_TRACE; err = xt_p_mutex_init_with_autoname(&log_mutex, NULL); if (err) { diff --git a/storage/pbxt/src/trace_xt.cc b/storage/pbxt/src/trace_xt.cc index a913e2ae385..fed4eb59036 100644 --- a/storage/pbxt/src/trace_xt.cc +++ b/storage/pbxt/src/trace_xt.cc @@ -109,10 +109,10 @@ xtPublic void xt_print_trace(void) xt_lock_mutex_ns(&trace_mutex); if (trace_log_end > trace_log_offset+1) { trace_log_buffer[trace_log_end] = 0; - printf("%s", trace_log_buffer + trace_log_offset + 1); + fprintf(stderr, "%s", trace_log_buffer + trace_log_offset + 1); } trace_log_buffer[trace_log_offset] = 0; - printf("%s", trace_log_buffer); + fprintf(stderr, "%s", trace_log_buffer); trace_log_offset = 0; trace_log_end = 0; xt_unlock_mutex_ns(&trace_mutex); @@ -379,9 +379,9 @@ xtPublic void xt_dump_conn_tracking(void) ptr = conn_info; for (int i=0; ici_curr_xact_id || ptr->ci_prev_xact_id) { - printf("%3d curr=%d prev=%d prev-time=%ld\n", (int) ptr->cu_t_id, (int) ptr->ci_curr_xact_id, (int) ptr->ci_prev_xact_id, (long) ptr->ci_prev_xact_time); + fprintf(stderr, "%3d curr=%d prev=%d prev-time=%ld\n", (int) ptr->cu_t_id, (int) ptr->ci_curr_xact_id, (int) ptr->ci_prev_xact_id, (long) ptr->ci_prev_xact_time); if (i+1ci_curr_xact_id - (int) ptr->ci_curr_xact_id); + fprintf(stderr, " diff=%d\n", (int) (ptr+1)->ci_curr_xact_id - (int) ptr->ci_curr_xact_id); } } ptr++;