WL#3072 Maria Recovery
- new program maria_read_log to display and apply log records
found in a Maria log (see file's revision comment)
- minor, misc fixes
storage/maria/Makefile.am:
new program maria_read_log
storage/maria/ha_maria.cc:
create control file if missing
storage/maria/ma_blockrec.c:
0 -> LSN_IMPOSSIBLE; comments
storage/maria/ma_checkpoint.h:
preparations for Checkpoint module
storage/maria/ma_close.c:
comment
storage/maria/ma_control_file.c:
renaming constants.
Possibility to say "open control file but don't create it if it's
missing" (used by maria_read_log which does not want to create
anything)
storage/maria/ma_control_file.h:
renaming constants
storage/maria/ma_create.c:
I had duplicated "linkname" and "linkname_ptr", now I see it's not
needed, reverting. Indeed those variables don't contain interesting
information; fixing log record accordingly (the links are in
ci->data/index_file_name). Storing keystart in log record is needed,
to know at which size we must extend the file if we replay
LOGREC_CREATE_TABLE.
storage/maria/ma_loghandler.c:
some structures need to be known to maria_read_log.c, taking
them to ma_loghandler.h
storage/maria/ma_loghandler.h:
we have page_store, adding page_korr.
translog_lock() made public, because Checkpoint will need it (to
write to control file).
Some structures moved from ma_loghandler.c because maria_read_log.c
needs them (needs to know the execute-in-REDO-phase hooks of each
record).
storage/maria/ma_loghandler_lsn.h:
constants defined in ma_control_file.h serve everywhere,
and they relate to LSNs, so putting them in ma_loghandler_lsn.h.
Stronger constraints in LSN_VALID().
storage/maria/ma_pagecache.c:
renaming constants
storage/maria/ma_recovery.h:
copyright
storage/maria/ma_test1.c:
new prototype
storage/maria/ma_test2.c:
new prototype
storage/maria/trnman_public.h:
double-inclusion safe
storage/maria/unittest/ma_control_file-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
constants renamed, new prototype
storage/myisam/mi_close.c:
comment
storage/maria/maria_read_log.c:
program to read and print log records from a Maria transaction log,
and optionally apply them to tables. Very basic, early version.
Should serve as a base for Recovery's code. Designed to be idempotent.
Create a log by running maria.test, then cd to var/master-data
and run "maria_read_log --only-display" to see info about records;
run "maria_read_log --display-and-apply" to also apply the records
to tables (it's more interesting if you first wipe out the
tables in var/master-data/test, to see how they get re-created).
Only a few records are handled by now: LONG_TRANSACTION_ID,
COMMIT, FILE_ID, REDO_CREATE_TABLE; place is ready for
REDO_INSERT_ROW_HEAD where I could use Monty's help (search for
"Monty" in the file). Note: changes to the index pages, index's header
and bitmap pages are not properly logged yet, so don't expect
the program to work with that.
2007-06-26 16:49:23 +02:00
|
|
|
/* Copyright (C) 2006,2007 MySQL AB
|
2006-09-14 19:06:51 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-03-02 11:20:23 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2006-09-14 19:06:51 +02:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
Update FSF address
This commit is based on the work of Michal Schorm, rebased on the
earliest MariaDB version.
Th command line used to generate this diff was:
find ./ -type f \
-exec sed -i -e 's/Foundation, Inc., 59 Temple Place, Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
-exec sed -i -e 's/Foundation, Inc. 59 Temple Place.* Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
-exec sed -i -e 's/MA.*.....-1307.*USA/MA 02110-1335 USA/g' {} \; \
-exec sed -i -e 's/Foundation, Inc., 59 Temple/Foundation, Inc., 51 Franklin/g' {} \; \
-exec sed -i -e 's/Place, Suite 330, Boston, MA.*02111-1307.*USA/Street, Fifth Floor, Boston, MA 02110-1335 USA/g' {} \; \
-exec sed -i -e 's/MA.*.....-1307/MA 02110-1335/g' {} \;
2019-05-10 19:49:46 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
|
2006-09-14 19:06:51 +02:00
|
|
|
|
Maria: first version of checkpoint (WL#3071), least-recently-dirtied page flushing (WL#3261), recovery (WL#3072),
control file (WL#3234), to serve as a detailed LLD. It looks like C code, but does not compile (no point in making it compile,
as other modules on which I depend are not yet fully speficied or written); some pieces are not coded and just marked in comments.
Files' organization (names, directories of C files) does not matter at this point.
I don't think I had to commit so early, but it feels good to publish something, gives me the impression of moving forward :)
storage/maria/checkpoint.c:
WL#3071 Maria checkpoint, implementation
storage/maria/checkpoint.h:
WL#3071 Maria checkpoint, interface
storage/maria/control_file.c:
WL#3234 Maria control file, implementation
storage/maria/control_file.h:
WL#3234 Maria control file, interface
storage/maria/least_recently_dirtied.c:
WL#3261 Maria background flushing of least-recently-dirtied pages, implementation
storage/maria/least_recently_dirtied.h:
WL#3261 Maria background flushing of least-recently-dirtied pages, interface
storage/maria/recovery.c:
WL#3072 Maria recovery, implementation
storage/maria/recovery.h:
WL#3072 Maria recovery, interface
2006-04-27 16:06:46 +02:00
|
|
|
/*
|
|
|
|
WL#3071 Maria checkpoint
|
|
|
|
First version written by Guilhem Bichot on 2006-04-27.
|
|
|
|
Does not compile yet.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This is the interface of this module. */
|
|
|
|
|
WL#3072 Maria Recovery
- new program maria_read_log to display and apply log records
found in a Maria log (see file's revision comment)
- minor, misc fixes
storage/maria/Makefile.am:
new program maria_read_log
storage/maria/ha_maria.cc:
create control file if missing
storage/maria/ma_blockrec.c:
0 -> LSN_IMPOSSIBLE; comments
storage/maria/ma_checkpoint.h:
preparations for Checkpoint module
storage/maria/ma_close.c:
comment
storage/maria/ma_control_file.c:
renaming constants.
Possibility to say "open control file but don't create it if it's
missing" (used by maria_read_log which does not want to create
anything)
storage/maria/ma_control_file.h:
renaming constants
storage/maria/ma_create.c:
I had duplicated "linkname" and "linkname_ptr", now I see it's not
needed, reverting. Indeed those variables don't contain interesting
information; fixing log record accordingly (the links are in
ci->data/index_file_name). Storing keystart in log record is needed,
to know at which size we must extend the file if we replay
LOGREC_CREATE_TABLE.
storage/maria/ma_loghandler.c:
some structures need to be known to maria_read_log.c, taking
them to ma_loghandler.h
storage/maria/ma_loghandler.h:
we have page_store, adding page_korr.
translog_lock() made public, because Checkpoint will need it (to
write to control file).
Some structures moved from ma_loghandler.c because maria_read_log.c
needs them (needs to know the execute-in-REDO-phase hooks of each
record).
storage/maria/ma_loghandler_lsn.h:
constants defined in ma_control_file.h serve everywhere,
and they relate to LSNs, so putting them in ma_loghandler_lsn.h.
Stronger constraints in LSN_VALID().
storage/maria/ma_pagecache.c:
renaming constants
storage/maria/ma_recovery.h:
copyright
storage/maria/ma_test1.c:
new prototype
storage/maria/ma_test2.c:
new prototype
storage/maria/trnman_public.h:
double-inclusion safe
storage/maria/unittest/ma_control_file-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
constants renamed, new prototype
storage/myisam/mi_close.c:
comment
storage/maria/maria_read_log.c:
program to read and print log records from a Maria transaction log,
and optionally apply them to tables. Very basic, early version.
Should serve as a base for Recovery's code. Designed to be idempotent.
Create a log by running maria.test, then cd to var/master-data
and run "maria_read_log --only-display" to see info about records;
run "maria_read_log --display-and-apply" to also apply the records
to tables (it's more interesting if you first wipe out the
tables in var/master-data/test, to see how they get re-created).
Only a few records are handled by now: LONG_TRANSACTION_ID,
COMMIT, FILE_ID, REDO_CREATE_TABLE; place is ready for
REDO_INSERT_ROW_HEAD where I could use Monty's help (search for
"Monty" in the file). Note: changes to the index pages, index's header
and bitmap pages are not properly logged yet, so don't expect
the program to work with that.
2007-06-26 16:49:23 +02:00
|
|
|
typedef enum enum_ma_checkpoint_level {
|
|
|
|
CHECKPOINT_NONE= 0,
|
|
|
|
/* just write dirty_pages, transactions table and sync files */
|
|
|
|
CHECKPOINT_INDIRECT,
|
|
|
|
/* also flush all dirty pages which were already dirty at prev checkpoint */
|
|
|
|
CHECKPOINT_MEDIUM,
|
|
|
|
/* also flush all dirty pages */
|
|
|
|
CHECKPOINT_FULL
|
Maria: first version of checkpoint (WL#3071), least-recently-dirtied page flushing (WL#3261), recovery (WL#3072),
control file (WL#3234), to serve as a detailed LLD. It looks like C code, but does not compile (no point in making it compile,
as other modules on which I depend are not yet fully speficied or written); some pieces are not coded and just marked in comments.
Files' organization (names, directories of C files) does not matter at this point.
I don't think I had to commit so early, but it feels good to publish something, gives me the impression of moving forward :)
storage/maria/checkpoint.c:
WL#3071 Maria checkpoint, implementation
storage/maria/checkpoint.h:
WL#3071 Maria checkpoint, interface
storage/maria/control_file.c:
WL#3234 Maria control file, implementation
storage/maria/control_file.h:
WL#3234 Maria control file, interface
storage/maria/least_recently_dirtied.c:
WL#3261 Maria background flushing of least-recently-dirtied pages, implementation
storage/maria/least_recently_dirtied.h:
WL#3261 Maria background flushing of least-recently-dirtied pages, interface
storage/maria/recovery.c:
WL#3072 Maria recovery, implementation
storage/maria/recovery.h:
WL#3072 Maria recovery, interface
2006-04-27 16:06:46 +02:00
|
|
|
} CHECKPOINT_LEVEL;
|
|
|
|
|
WL#3072 Maria Recovery
- new program maria_read_log to display and apply log records
found in a Maria log (see file's revision comment)
- minor, misc fixes
storage/maria/Makefile.am:
new program maria_read_log
storage/maria/ha_maria.cc:
create control file if missing
storage/maria/ma_blockrec.c:
0 -> LSN_IMPOSSIBLE; comments
storage/maria/ma_checkpoint.h:
preparations for Checkpoint module
storage/maria/ma_close.c:
comment
storage/maria/ma_control_file.c:
renaming constants.
Possibility to say "open control file but don't create it if it's
missing" (used by maria_read_log which does not want to create
anything)
storage/maria/ma_control_file.h:
renaming constants
storage/maria/ma_create.c:
I had duplicated "linkname" and "linkname_ptr", now I see it's not
needed, reverting. Indeed those variables don't contain interesting
information; fixing log record accordingly (the links are in
ci->data/index_file_name). Storing keystart in log record is needed,
to know at which size we must extend the file if we replay
LOGREC_CREATE_TABLE.
storage/maria/ma_loghandler.c:
some structures need to be known to maria_read_log.c, taking
them to ma_loghandler.h
storage/maria/ma_loghandler.h:
we have page_store, adding page_korr.
translog_lock() made public, because Checkpoint will need it (to
write to control file).
Some structures moved from ma_loghandler.c because maria_read_log.c
needs them (needs to know the execute-in-REDO-phase hooks of each
record).
storage/maria/ma_loghandler_lsn.h:
constants defined in ma_control_file.h serve everywhere,
and they relate to LSNs, so putting them in ma_loghandler_lsn.h.
Stronger constraints in LSN_VALID().
storage/maria/ma_pagecache.c:
renaming constants
storage/maria/ma_recovery.h:
copyright
storage/maria/ma_test1.c:
new prototype
storage/maria/ma_test2.c:
new prototype
storage/maria/trnman_public.h:
double-inclusion safe
storage/maria/unittest/ma_control_file-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
constants renamed, new prototype
storage/myisam/mi_close.c:
comment
storage/maria/maria_read_log.c:
program to read and print log records from a Maria transaction log,
and optionally apply them to tables. Very basic, early version.
Should serve as a base for Recovery's code. Designed to be idempotent.
Create a log by running maria.test, then cd to var/master-data
and run "maria_read_log --only-display" to see info about records;
run "maria_read_log --display-and-apply" to also apply the records
to tables (it's more interesting if you first wipe out the
tables in var/master-data/test, to see how they get re-created).
Only a few records are handled by now: LONG_TRANSACTION_ID,
COMMIT, FILE_ID, REDO_CREATE_TABLE; place is ready for
REDO_INSERT_ROW_HEAD where I could use Monty's help (search for
"Monty" in the file). Note: changes to the index pages, index's header
and bitmap pages are not properly logged yet, so don't expect
the program to work with that.
2007-06-26 16:49:23 +02:00
|
|
|
C_MODE_START
|
WL#3071 - Maria checkpoint
- serializing calls to flush_pagecache_blocks_int() on the same file
to avoid known concurrency bugs
- having that, we can now enable the background thread, as the
flushes it does are now supposedly safe in concurrent situations.
- new type of flush FLUSH_KEEP_LAZY: when the background checkpoint
thread is flushing a packet of dirty pages between two checkpoints,
it uses this flush type, indeed if a file is already being flushed
by another thread it's smarter to move on to the next file than wait.
- maria_checkpoint_frequency renamed to maria_checkpoint_interval.
include/my_sys.h:
new type of flushing for the page cache: FLUSH_KEEP_LAZY
mysql-test/r/maria.result:
result update
mysys/mf_keycache.c:
indentation. No FLUSH_KEEP_LAZY support in key cache.
storage/maria/ha_maria.cc:
maria_checkpoint_frequency was somehow a hidden part of the
Checkpoint API and that was not good. Now we have checkpoint_interval,
local to ha_maria.cc, which serves as container for the user-visible
maria_checkpoint_interval global variable; setting it calls
update_checkpoint_interval which passes the new value to
ma_checkpoint_init(). There is no hiding anymore.
By default, enable background thread which does checkpoints
every 30 seconds, and dirty page flush in between. That thread takes
a checkpoint when it ends, so no need for maria_hton_panic to take one.
The | is | and not ||, because maria_panic() must always be called.
frequency->interval.
storage/maria/ma_checkpoint.c:
Use FLUSH_KEEP_LAZY for background thread when it flushes packets of
dirty pages between two checkpoints: it is smarter to move on to
the next file than wait for it to have been completely flushed, which
may take long.
Comments about flush concurrency bugs moved from ma_pagecache.c.
Removing out-of-date comment.
frequency->interval.
create_background_thread -> (interval>0).
In ma_checkpoint_background(), some variables need to be preserved
between iterations.
storage/maria/ma_checkpoint.h:
new prototype
storage/maria/ma_pagecache.c:
- concurrent calls of flush_pagecache_blocks_int() on the same file
cause bugs (see @note in that function); we fix them by serializing
in this situation. For that we use a global hash of (file, wqueue).
When flush_pagecache_blocks_int() starts it looks into the hash,
using the file as key. If not found, it inserts (file,wqueue) into the
hash, flushes the file, and finally removes itself from the hash and
wakes up any waiter in the queue. If found, it adds itself to the
wqueue and waits.
- As a by-product, we can remove changed_blocks_is_incomplete
and replace it by scanning the hash, replace the sleep() by a queue wait.
- new type of flush FLUSH_KEEP_LAZY: when flushing a file, if it's
already being flushed by another thread (even partially), return
immediately.
storage/maria/ma_pagecache.h:
In pagecache, a hash of files currently being flushed (i.e. there
is a call to flush_pagecache_blocks_int() for them).
storage/maria/ma_recovery.c:
new prototype
storage/maria/ma_test1.c:
new prototype
storage/maria/ma_test2.c:
new prototype
2007-10-19 14:15:13 +02:00
|
|
|
int ma_checkpoint_init(ulong interval);
|
2007-09-20 16:11:46 +02:00
|
|
|
void ma_checkpoint_end(void);
|
WL#3072 Maria Recovery
- new program maria_read_log to display and apply log records
found in a Maria log (see file's revision comment)
- minor, misc fixes
storage/maria/Makefile.am:
new program maria_read_log
storage/maria/ha_maria.cc:
create control file if missing
storage/maria/ma_blockrec.c:
0 -> LSN_IMPOSSIBLE; comments
storage/maria/ma_checkpoint.h:
preparations for Checkpoint module
storage/maria/ma_close.c:
comment
storage/maria/ma_control_file.c:
renaming constants.
Possibility to say "open control file but don't create it if it's
missing" (used by maria_read_log which does not want to create
anything)
storage/maria/ma_control_file.h:
renaming constants
storage/maria/ma_create.c:
I had duplicated "linkname" and "linkname_ptr", now I see it's not
needed, reverting. Indeed those variables don't contain interesting
information; fixing log record accordingly (the links are in
ci->data/index_file_name). Storing keystart in log record is needed,
to know at which size we must extend the file if we replay
LOGREC_CREATE_TABLE.
storage/maria/ma_loghandler.c:
some structures need to be known to maria_read_log.c, taking
them to ma_loghandler.h
storage/maria/ma_loghandler.h:
we have page_store, adding page_korr.
translog_lock() made public, because Checkpoint will need it (to
write to control file).
Some structures moved from ma_loghandler.c because maria_read_log.c
needs them (needs to know the execute-in-REDO-phase hooks of each
record).
storage/maria/ma_loghandler_lsn.h:
constants defined in ma_control_file.h serve everywhere,
and they relate to LSNs, so putting them in ma_loghandler_lsn.h.
Stronger constraints in LSN_VALID().
storage/maria/ma_pagecache.c:
renaming constants
storage/maria/ma_recovery.h:
copyright
storage/maria/ma_test1.c:
new prototype
storage/maria/ma_test2.c:
new prototype
storage/maria/trnman_public.h:
double-inclusion safe
storage/maria/unittest/ma_control_file-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
constants renamed, new prototype
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
constants renamed, new prototype
storage/myisam/mi_close.c:
comment
storage/maria/maria_read_log.c:
program to read and print log records from a Maria transaction log,
and optionally apply them to tables. Very basic, early version.
Should serve as a base for Recovery's code. Designed to be idempotent.
Create a log by running maria.test, then cd to var/master-data
and run "maria_read_log --only-display" to see info about records;
run "maria_read_log --display-and-apply" to also apply the records
to tables (it's more interesting if you first wipe out the
tables in var/master-data/test, to see how they get re-created).
Only a few records are handled by now: LONG_TRANSACTION_ID,
COMMIT, FILE_ID, REDO_CREATE_TABLE; place is ready for
REDO_INSERT_ROW_HEAD where I could use Monty's help (search for
"Monty" in the file). Note: changes to the index pages, index's header
and bitmap pages are not properly logged yet, so don't expect
the program to work with that.
2007-06-26 16:49:23 +02:00
|
|
|
int ma_checkpoint_execute(CHECKPOINT_LEVEL level, my_bool no_wait);
|
|
|
|
C_MODE_END
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief reads some LSNs with special trickery
|
|
|
|
|
|
|
|
If a 64-bit variable transitions between both halves being zero to both
|
|
|
|
halves being non-zero, and back, this function can be used to do a read of
|
|
|
|
it (without mutex, without atomic load) which always produces a correct
|
|
|
|
(though maybe slightly old) value (even on 32-bit CPUs). The value is at
|
|
|
|
least as new as the latest mutex unlock done by the calling thread.
|
|
|
|
The assumption is that the system sets both 4-byte halves either at the
|
|
|
|
same time, or one after the other (in any order), but NOT some bytes of the
|
|
|
|
first half then some bytes of the second half then the rest of bytes of the
|
|
|
|
first half. With this assumption, the function can detect when it is
|
|
|
|
seeing an inconsistent value.
|
|
|
|
|
|
|
|
@param LSN pointer to the LSN variable to read
|
|
|
|
|
|
|
|
@return LSN part (most significant byte always 0)
|
|
|
|
*/
|
|
|
|
#if ( SIZEOF_CHARP >= 8 )
|
|
|
|
/* 64-bit CPU, 64-bit reads are atomic */
|
|
|
|
#define lsn_read_non_atomic LSN_WITH_FLAGS_TO_LSN
|
|
|
|
#else
|
|
|
|
static inline LSN lsn_read_non_atomic_32(const volatile LSN *x)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
32-bit CPU, 64-bit reads may give a mixed of old half and new half (old
|
|
|
|
low bits and new high bits, or the contrary).
|
|
|
|
*/
|
|
|
|
for (;;) /* loop until no atomicity problems */
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
Remove most significant byte in case this is a LSN_WITH_FLAGS object.
|
|
|
|
Those flags in TRN::first_undo_lsn break the condition on transitions so
|
|
|
|
they must be removed below.
|
|
|
|
*/
|
|
|
|
LSN y= LSN_WITH_FLAGS_TO_LSN(*x);
|
|
|
|
if (likely((y == LSN_IMPOSSIBLE) || LSN_VALID(y)))
|
|
|
|
return y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#define lsn_read_non_atomic(x) lsn_read_non_atomic_32(&x)
|
|
|
|
#endif
|
WL#3071 Maria checkpoint, WL#3072 Maria recovery
instead of fprintf(stderr) when a task (with no user connected) gets
an error, use my_printf_error(). Flags ME_JUST_WARNING and ME_JUST_INFO
added to my_error()/my_printf_error(), which pass it to
my_message_sql() which is modified to call the appropriate
sql_print_*(). This way recovery can signal its start and end with
[Note] and not [ERROR] (but failure with [ERROR]).
Recovery's detailed progress (percents etc) still uses stderr as they
have to stay on one single line.
sql_print_error() changed to use my_progname_short (nicer display).
mysql-test-run.pl --gdb/--ddd does not run mysqld, because
a breakpoint in mysql_parse is too late to debug startup problems;
instead, dev should set the breakpoints it wants and then "run" ("r").
include/my_sys.h:
new flags to tell error_handler_hook that this is not an error
but an information or warning
mysql-test/mysql-test-run.pl:
when running with --gdb/--ddd to debug mysqld, breaking at mysql_parse
is too late to debug startup problems; now, it does not run mysqld,
does not set breakpoints, developer can set as early breakpoints
as it wants and is responsible for typing "run" (or "r")
mysys/my_init.c:
set my_progname_short
mysys/my_static.c:
my_progname_short added
sql/mysqld.cc:
* my_message_sql() can now receive info or warning, not only error;
this allows mysys to tell the user (or the error log if no user)
about an info or warning. Used from Maria.
* plugins (or engines like Maria) may want to call my_error(), so
set up the error handler hook (my_message_sql) before initializing
plugins; otherwise they get my_message_no_curses which is less
integrated into mysqld (is just fputs())
* using my_progname_short instead of my_progname, in my_message_sql()
(less space on screen)
storage/maria/ma_checkpoint.c:
fprintf(stderr) -> ma_message_no_user()
storage/maria/ma_checkpoint.h:
function for any Maria task, not connected to a user (example:
checkpoint, recovery; soon could be deleted records purger)
to report a message (calls my_printf_error() which, when inside ha_maria,
leads to sql_print_*(), and when outside, leads to
my_message_no_curses i.e. stderr).
storage/maria/ma_recovery.c:
To tell that recovery starts and ends we use ma_message_no_user()
(sql_print_*() in practice). Detailed progress info still uses
stderr as sql_print() cannot put several messages on one line.
071116 18:42:16 [Note] mysqld: Maria engine: starting recovery
recovered pages: 0% 67% 100% (0.0 seconds); transactions to roll back: 1 0 (0.0
seconds); tables to flush: 1 0 (0.0 seconds);
071116 18:42:16 [Note] mysqld: Maria engine: recovery done
storage/maria/maria_chk.c:
my_progname_short moved to mysys
storage/maria/maria_read_log.c:
my_progname_short moved to mysys
storage/myisam/myisamchk.c:
my_progname_short moved to mysys
2007-11-16 17:09:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
prints a message from a task not connected to any user (checkpoint
|
|
|
|
and recovery for example).
|
|
|
|
|
2018-05-29 23:54:25 +02:00
|
|
|
@param level 0 if error, ME_WARNING if warning,
|
|
|
|
ME_NOTE if info
|
WL#3071 Maria checkpoint, WL#3072 Maria recovery
instead of fprintf(stderr) when a task (with no user connected) gets
an error, use my_printf_error(). Flags ME_JUST_WARNING and ME_JUST_INFO
added to my_error()/my_printf_error(), which pass it to
my_message_sql() which is modified to call the appropriate
sql_print_*(). This way recovery can signal its start and end with
[Note] and not [ERROR] (but failure with [ERROR]).
Recovery's detailed progress (percents etc) still uses stderr as they
have to stay on one single line.
sql_print_error() changed to use my_progname_short (nicer display).
mysql-test-run.pl --gdb/--ddd does not run mysqld, because
a breakpoint in mysql_parse is too late to debug startup problems;
instead, dev should set the breakpoints it wants and then "run" ("r").
include/my_sys.h:
new flags to tell error_handler_hook that this is not an error
but an information or warning
mysql-test/mysql-test-run.pl:
when running with --gdb/--ddd to debug mysqld, breaking at mysql_parse
is too late to debug startup problems; now, it does not run mysqld,
does not set breakpoints, developer can set as early breakpoints
as it wants and is responsible for typing "run" (or "r")
mysys/my_init.c:
set my_progname_short
mysys/my_static.c:
my_progname_short added
sql/mysqld.cc:
* my_message_sql() can now receive info or warning, not only error;
this allows mysys to tell the user (or the error log if no user)
about an info or warning. Used from Maria.
* plugins (or engines like Maria) may want to call my_error(), so
set up the error handler hook (my_message_sql) before initializing
plugins; otherwise they get my_message_no_curses which is less
integrated into mysqld (is just fputs())
* using my_progname_short instead of my_progname, in my_message_sql()
(less space on screen)
storage/maria/ma_checkpoint.c:
fprintf(stderr) -> ma_message_no_user()
storage/maria/ma_checkpoint.h:
function for any Maria task, not connected to a user (example:
checkpoint, recovery; soon could be deleted records purger)
to report a message (calls my_printf_error() which, when inside ha_maria,
leads to sql_print_*(), and when outside, leads to
my_message_no_curses i.e. stderr).
storage/maria/ma_recovery.c:
To tell that recovery starts and ends we use ma_message_no_user()
(sql_print_*() in practice). Detailed progress info still uses
stderr as sql_print() cannot put several messages on one line.
071116 18:42:16 [Note] mysqld: Maria engine: starting recovery
recovered pages: 0% 67% 100% (0.0 seconds); transactions to roll back: 1 0 (0.0
seconds); tables to flush: 1 0 (0.0 seconds);
071116 18:42:16 [Note] mysqld: Maria engine: recovery done
storage/maria/maria_chk.c:
my_progname_short moved to mysys
storage/maria/maria_read_log.c:
my_progname_short moved to mysys
storage/myisam/myisamchk.c:
my_progname_short moved to mysys
2007-11-16 17:09:51 +01:00
|
|
|
@param sentence text to write
|
|
|
|
*/
|
|
|
|
#define ma_message_no_user(level, sentence) \
|
2010-09-12 18:40:01 +02:00
|
|
|
my_printf_error(HA_ERR_GENERIC, "Aria engine: %s", MYF(level), sentence)
|