diff --git a/core/log_io.c b/core/log_io.c index 963ab38368af36f0bc0353be908186e0a604240f..0ecbe30eef84a93929df012b858143f6bc4c09d2 100644 --- a/core/log_io.c +++ b/core/log_io.c @@ -39,7 +39,6 @@ #include <fiber.h> #include <log_io.h> -#include <log_io_internal.h> #include <palloc.h> #include <say.h> #include <third_party/crc32.h> diff --git a/core/log_io_remote.c b/core/log_io_remote.c index d25ca20456644356e01debde4be8e896e10f1035..264485fa7ca5e65043db89b81a0144d61a379ecf 100644 --- a/core/log_io_remote.c +++ b/core/log_io_remote.c @@ -36,7 +36,6 @@ #include <say.h> #include <log_io.h> -#include <log_io_internal.h> struct remote_state { struct recovery_state *r; diff --git a/core/tarantool.c b/core/tarantool.c index 08fa581d01e978be06a34cf8a031a82525d24cae..df5c458ed48285e5cbf0def05cdb3fb6b36e2f33 100644 --- a/core/tarantool.c +++ b/core/tarantool.c @@ -44,7 +44,6 @@ #include <fiber.h> #include <iproto.h> #include <log_io.h> -#include <log_io_internal.h> #include <palloc.h> #include <salloc.h> #include <say.h> diff --git a/include/log_io.h b/include/log_io.h index 76c7dd6fc96d2ba37b69a9ece5ca750106220827..eaab7e64ac17996ce6275ec908ff45dd43bbf50e 100644 --- a/include/log_io.h +++ b/include/log_io.h @@ -40,10 +40,64 @@ extern const u16 default_tag; extern const u32 default_version; -struct log_io; struct recovery_state; typedef int (row_handler) (struct recovery_state *, struct tbuf *); typedef struct tbuf *(row_reader) (FILE *f, struct palloc_pool *pool); + +enum log_mode { + LOG_READ, + LOG_WRITE +}; + +struct log_io_class { + row_reader *reader; + u64 marker, eof_marker; + size_t marker_size, eof_marker_size; + size_t rows_per_file; + double fsync_delay; + + const char *filetype; + const char *version; + const char *suffix; + const char *dirname; +}; + +struct log_io { + struct log_io_class *class; + FILE *f; + + ev_stat stat; + enum log_mode mode; + size_t rows; + size_t retry; + char filename[PATH_MAX + 1]; +}; + +struct recovery_state { + i64 lsn, confirmed_lsn; + + struct log_io *current_wal; /* the WAL we'r currently reading/writing from/to */ + struct log_io_class **snap_class, **wal_class, *snap_prefered_class, *wal_prefered_class; + struct child *wal_writer; + + /* handlers will be presented by most new format of data + log_io_class->reader is responsible of converting data from old format */ + row_handler *wal_row_handler, *snap_row_handler; + ev_timer wal_timer; + ev_tstamp recovery_lag; + + int snap_io_rate_limit; + + /* pointer to user supplied custom data */ + void *data; +}; + +struct wal_write_request { + i64 lsn; + u32 len; + u8 data[]; +} __packed__; + struct row_v04 { i64 lsn; /* this used to be tid */ u16 type; @@ -97,4 +151,5 @@ struct fiber *recover_follow_remote(struct recovery_state *r, char *ip_addr, int struct log_io_iter; void snapshot_write_row(struct log_io_iter *i, struct tbuf *row); void snapshot_save(struct recovery_state *r, void (*loop) (struct log_io_iter *)); + #endif diff --git a/include/log_io_internal.h b/include/log_io_internal.h deleted file mode 100644 index 056d3389edc59eeee2cd7f8d14343ac783be475f..0000000000000000000000000000000000000000 --- a/include/log_io_internal.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2010 Mail.RU - * Copyright (C) 2010 Yuriy Vostrikov - * - * 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 reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. - */ - -#ifndef TARANTOOL_LOG_IO_INTERNAL_H -#define TARANTOOL_LOG_IO_INTERNAL_H - -enum log_mode { - LOG_READ, - LOG_WRITE -}; - -struct log_io_class { - row_reader *reader; - u64 marker, eof_marker; - size_t marker_size, eof_marker_size; - size_t rows_per_file; - double fsync_delay; - - const char *filetype; - const char *version; - const char *suffix; - const char *dirname; -}; - -struct log_io { - struct log_io_class *class; - FILE *f; - - ev_stat stat; - enum log_mode mode; - size_t rows; - size_t retry; - char filename[PATH_MAX + 1]; -}; - -struct recovery_state { - i64 lsn, confirmed_lsn; - - struct log_io *current_wal; /* the WAL we'r currently reading/writing from/to */ - struct log_io_class **snap_class, **wal_class, *snap_prefered_class, *wal_prefered_class; - struct child *wal_writer; - - /* handlers will be presented by most new format of data - log_io_class->reader is responsible of converting data from old format */ - row_handler *wal_row_handler, *snap_row_handler; - ev_timer wal_timer; - ev_tstamp recovery_lag; - - int snap_io_rate_limit; - - /* pointer to user supplied custom data */ - void *data; -}; - -struct wal_write_request { - i64 lsn; - u32 len; - u8 data[]; -} __packed__; - -bool wal_write(struct recovery_state *r, i64 lsn, struct tbuf *data); - -#endif diff --git a/mod/silverbox/box.c b/mod/silverbox/box.c index 6224c6957d475c627e663305f4d478829f778847..6c758d3157c0464f40572b43d0ae9a0222d239fa 100644 --- a/mod/silverbox/box.c +++ b/mod/silverbox/box.c @@ -32,7 +32,6 @@ #include <fiber.h> #include <iproto.h> #include <log_io.h> -#include <log_io_internal.h> #include <pickle.h> #include <salloc.h> #include <say.h>