Commit 21f63e41 authored by unknown's avatar unknown

Trivial postreview changes.


storage/maria/ma_blockrec.c:
  Layout fix.
storage/maria/ma_loghandler.c:
  Renamed struct variable 'class' to avoid problems with c++ compiler.
  Renamed translog_init_scanner to fit othere init functions naming pattern.
  translog_relative_LSN_encode can't return error for now.
  Other trivial postreview changes.
storage/maria/ma_loghandler_lsn.h:
  trivial postreview changes.
storage/maria/ma_recovery.c:
  Renamed translog_init_scanner to fit othere init functions naming pattern.
storage/maria/unittest/ma_loghandler_examples.c:
  Renamed struct variable 'class' to avoid problems with c++ compiler.
storage/maria/unittest/ma_test_loghandler-t.c:
  Renamed translog_init_scanner to fit othere init functions naming pattern.
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Renamed translog_init_scanner to fit othere init functions naming pattern.
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Renamed translog_init_scanner to fit othere init functions naming pattern.
parent 571ab016
......@@ -5006,7 +5006,7 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
DBUG_ENTER("_ma_apply_redo_insert_row_head_or_tail");
page= page_korr(header);
rownr= dirpos_korr(header+PAGE_STORE_SIZE);
rownr= dirpos_korr(header + PAGE_STORE_SIZE);
DBUG_PRINT("enter", ("rowid: %lu page: %lu rownr: %u data_length: %u",
(ulong) ma_recordpos(page, rownr),
......
This diff is collapsed.
......@@ -76,29 +76,23 @@ struct st_maria_handler;
#define ha_checksum_store(T,A) int4store(T,A)
#define fileid_korr(P) uint2korr(P)
#define page_korr(P) uint5korr(P)
#define dirpos_korr(P) ((P)[0])
#define dirpos_korr(P) (*(uchar *) (P))
#define pagerange_korr(P) uint2korr(P)
#define clr_type_korr(P) ((P)[0])
#define clr_type_korr(P) (*(uchar *) (P))
#define key_nr_korr(P) ((P)[0])
#define ha_checksum_korr(P) uint4korr(P)
/*
Length of disk drive sector size (we assume that writing it
to disk is atomic operation)
to disk is an atomic operation)
*/
#define DISK_DRIVE_SECTOR_SIZE 512
/*
Number of empty entries we need to have in LEX_STRING for
translog_write_record()
*/
#define LOG_INTERNAL_PARTS 1
/* position reserved in an array of parts of a log record */
#define TRANSLOG_INTERNAL_PARTS 2
/* types of records in the transaction log */
/* Todo: Set numbers for these when we have all entries figured out */
/* TODO: Set numbers for these when we have all entries figured out */
enum translog_record_type
{
......@@ -228,7 +222,7 @@ typedef struct st_translog_scanner_data
} TRANSLOG_SCANNER_DATA;
struct st_translog_reader_data
typedef struct st_translog_reader_data
{
TRANSLOG_HEADER_BUFFER header; /* Header */
TRANSLOG_SCANNER_DATA scanner; /* chunks scanner */
......@@ -241,9 +235,8 @@ struct st_translog_reader_data
uint current_group; /* current group */
uint current_chunk; /* current chunk in the group */
my_bool eor; /* end of the record */
};
} TRANSLOG_READER_DATA;
struct st_transaction;
C_MODE_START
/* Records types for unittests */
......@@ -259,8 +252,7 @@ extern my_bool translog_init(const char *directory, uint32 log_file_max_size,
PAGECACHE *pagecache, uint flags);
extern my_bool
translog_write_record(LSN *lsn, enum translog_record_type type,
struct st_transaction *trn,
translog_write_record(LSN *lsn, enum translog_record_type type, TRN *trn,
MARIA_HA *tbl_info,
translog_size_t rec_len, uint part_no,
LEX_STRING *parts_data, uchar *store_share_id,
......@@ -279,9 +271,9 @@ extern translog_size_t translog_read_record(LSN lsn,
struct st_translog_reader_data
*data);
extern my_bool translog_flush(LSN lsn);
extern my_bool translog_flush(TRANSLOG_ADDRESS lsn);
extern my_bool translog_init_scanner(LSN lsn,
extern my_bool translog_scanner_init(LSN lsn,
my_bool fixed_horizon,
struct st_translog_scanner_data *scanner,
my_bool use_direct_link);
......@@ -298,7 +290,7 @@ extern void translog_lock_assert_owner();
extern TRANSLOG_ADDRESS translog_get_horizon();
extern TRANSLOG_ADDRESS translog_get_horizon_no_lock();
extern int translog_assign_id_to_share(struct st_maria_handler *tbl_info,
struct st_transaction *trn);
TRN *trn);
extern void translog_deassign_id_from_share(struct st_maria_share *share);
extern void
translog_assign_id_to_share_from_recovery(struct st_maria_share *share,
......@@ -355,21 +347,17 @@ enum record_class
LOGRECTYPE_FIXEDLENGTH
};
/* C++ can't bear that a variable's name is "class" */
#ifndef __cplusplus
enum enum_record_in_group {
LOGREC_NOT_LAST_IN_GROUP= 0, LOGREC_LAST_IN_GROUP, LOGREC_IS_GROUP_ITSELF
};
/*
Descriptor of log record type
Note: Don't reorder because of constructs later...
*/
typedef struct st_log_record_type_descriptor
{
/* internal class of the record */
enum record_class class;
enum record_class rclass;
/*
length for fixed-size record, pseudo-fixed record
length with uncompressed LSNs
......@@ -399,7 +387,6 @@ typedef struct st_log_record_type_descriptor
} LOG_DESC;
extern LOG_DESC log_record_type_descriptor[LOGREC_NUMBER_OF_TYPES];
#endif
typedef enum
{
......
......@@ -20,7 +20,7 @@
Transaction log record address:
file_no << 32 | offset
file_no is only 3 bytes so we can use signed integer to make
comparison more simple.
comparison simpler.
*/
typedef int64 TRANSLOG_ADDRESS;
......@@ -67,11 +67,11 @@ typedef TRANSLOG_ADDRESS LSN;
#define lsn_store(dst, lsn) \
do { \
int3store((dst), LSN_FILE_NO(lsn)); \
int4store((dst) + 3, LSN_OFFSET(lsn)); \
int4store((char*)(dst) + 3, LSN_OFFSET(lsn)); \
} while (0)
/* Unpacks LSN from the buffer (P) */
#define lsn_korr(P) MAKE_LSN(uint3korr(P), uint4korr((P) + 3))
#define lsn_korr(P) MAKE_LSN(uint3korr(P), uint4korr((char*)(P) + 3))
/* what we need to add to LSN to increase it on one file */
#define LSN_ONE_FILE ((int64)0x100000000LL)
......@@ -98,7 +98,7 @@ typedef LSN LSN_WITH_FLAGS;
/**
@brief the maximum valid LSN.
Unlike ULONGLONG_MAX, it can be safely used in comparison with valid LSNs
(ULONGLONG_MAX is too big for correctness of cmp_translog_address()).
(ULONGLONG_MAX is too big for correctness of cmp_translog_addr()).
*/
#define LSN_MAX (LSN)ULL(0x00FFFFFFFFFFFFFF)
......
......@@ -2141,7 +2141,7 @@ static int run_redo_phase(LSN lsn, enum maria_apply_log_way apply)
eprint(tracef, "Failed to read header of the first record.\n");
return 1;
}
if (translog_init_scanner(lsn, 1, &scanner, 1))
if (translog_scanner_init(lsn, 1, &scanner, 1))
{
tprint(tracef, "Scanner init failed\n");
return 1;
......@@ -2189,7 +2189,7 @@ static int run_redo_phase(LSN lsn, enum maria_apply_log_way apply)
tprint(tracef, "Cannot find record where it should be\n");
goto err;
}
if (translog_init_scanner(rec2.lsn, 1, &scanner2, 1))
if (translog_scanner_init(rec2.lsn, 1, &scanner2, 1))
{
tprint(tracef, "Scanner2 init failed\n");
goto err;
......
......@@ -45,7 +45,7 @@ void example_loghandler_init()
for (i= LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE + 1;
i < LOGREC_NUMBER_OF_TYPES;
i++)
log_record_type_descriptor[i].class= LOGRECTYPE_NOT_ALLOWED;
log_record_type_descriptor[i].rclass= LOGRECTYPE_NOT_ALLOWED;
}
......
......@@ -374,7 +374,7 @@ int main(int argc __attribute__((unused)), char *argv[])
read_ok(&rec);
translog_free_record_header(&rec);
lsn= first_lsn;
if (translog_init_scanner(first_lsn, 1, &scanner, 0))
if (translog_scanner_init(first_lsn, 1, &scanner, 0))
{
fprintf(stderr, "scanner init failed\n");
goto err;
......
......@@ -377,7 +377,7 @@ int main(int argc __attribute__((unused)), char *argv[])
ok(1, "read record");
translog_free_record_header(&rec);
lsn= first_lsn;
if (translog_init_scanner(first_lsn, 1, &scanner, 0))
if (translog_scanner_init(first_lsn, 1, &scanner, 0))
{
fprintf(stderr, "scanner init failed\n");
goto err;
......
......@@ -374,7 +374,7 @@ int main(int argc __attribute__((unused)),
bzero(indeces, sizeof(indeces));
if (translog_init_scanner(first_lsn, 1, &scanner, 0))
if (translog_scanner_init(first_lsn, 1, &scanner, 0))
{
fprintf(stderr, "scanner init failed\n");
goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment