MySQL 8.0.39
Source Code Documentation
myisammrg.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24/**
25 @file include/myisammrg.h
26 This file should be included when using merge isam functions.
27*/
28
29#ifndef _myisammrg_h
30#define _myisammrg_h
31
32#include <sys/types.h>
33
34#include "my_base.h"
35#include "my_inttypes.h"
36#include "my_list.h"
37#include "my_macros.h"
38#include "myisam.h"
41#include "typelib.h"
42
43#define MYRG_NAME_EXT ".MRG"
44
45/* In which table to INSERT rows */
46#define MERGE_INSERT_DISABLED 0
47#define MERGE_INSERT_TO_FIRST 1
48#define MERGE_INSERT_TO_LAST 2
49
51
52/* Param to/from myrg_info */
53
54struct MYMERGE_INFO /* Struct from h_info */
55{
56 ulonglong records; /* Records in database */
57 ulonglong deleted; /* Deleted records in database */
58 ulonglong recpos; /* Pos for last used record */
60 ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
61 uint reclength; /* Recordlength */
62 int errkey; /* With key was duplicated on err */
63 uint options; /* HA_OPTION_... used */
64 ulong *rec_per_key; /* for sql optimizing */
65};
66
67struct MYRG_TABLE {
70};
71
72struct MYRG_INFO {
74 ulonglong records; /* records in tables */
75 ulonglong del; /* Removed records */
80 /* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */
84 ulong *rec_per_key_part; /* for sql optimizing */
86};
87
88/* Prototypes for merge-functions */
89
90extern int myrg_close(MYRG_INFO *file);
91extern int myrg_delete(MYRG_INFO *file, const uchar *buff);
92extern MYRG_INFO *myrg_open(const char *name, int mode, int wait_if_locked);
93extern MYRG_INFO *myrg_parent_open(const char *parent_name,
94 int (*callback)(void *, const char *),
95 void *callback_param);
96extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
97 MI_INFO *(*callback)(void *),
98 void *callback_param, bool *need_compat_check);
99extern int myrg_detach_children(MYRG_INFO *m_info);
100extern int myrg_panic(enum ha_panic_function function);
101extern int myrg_rfirst(MYRG_INFO *file, uchar *buf, int inx);
102extern int myrg_rlast(MYRG_INFO *file, uchar *buf, int inx);
103extern int myrg_rnext(MYRG_INFO *file, uchar *buf, int inx);
104extern int myrg_rprev(MYRG_INFO *file, uchar *buf, int inx);
105extern int myrg_rnext_same(MYRG_INFO *file, uchar *buf);
106extern int myrg_rkey(MYRG_INFO *info, uchar *buf, int inx, const uchar *key,
107 key_part_map keypart_map,
108 enum ha_rkey_function search_flag);
109extern int myrg_rrnd(MYRG_INFO *file, uchar *buf, ulonglong pos);
110extern int myrg_update(MYRG_INFO *file, const uchar *old, uchar *new_rec);
111extern int myrg_write(MYRG_INFO *info, uchar *rec);
112extern int myrg_status(MYRG_INFO *file, MYMERGE_INFO *x, int flag);
113extern int myrg_lock_database(MYRG_INFO *file, int lock_type);
114extern int myrg_create(const char *name, const char **table_names,
115 uint insert_method, bool fix_names);
116extern int myrg_extra(MYRG_INFO *file, enum ha_extra_function function,
117 void *extra_arg);
118extern int myrg_reset(MYRG_INFO *info);
120 key_range *min_key, key_range *max_key);
122
124
125#endif /* _myisammrg_h */
static int flag
Definition: hp_test1.cc:40
This file includes constants used by all storage engines.
ha_panic_function
Definition: my_base.h:431
ha_rkey_function
Definition: my_base.h:78
ulong key_part_map
Definition: my_base.h:1007
my_off_t ha_rows
Definition: my_base.h:1140
ha_extra_function
Definition: my_base.h:184
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
Some common macros.
This file should be included when using myisam functions.
int myrg_rprev(MYRG_INFO *file, uchar *buf, int inx)
Definition: myrg_rprev.cc:34
int myrg_close(MYRG_INFO *file)
Definition: myrg_close.cc:32
int myrg_detach_children(MYRG_INFO *m_info)
Detach children from a MyISAM MERGE parent table.
Definition: myrg_open.cc:495
int myrg_rnext(MYRG_INFO *file, uchar *buf, int inx)
Definition: myrg_rnext.cc:34
MYRG_INFO * myrg_parent_open(const char *parent_name, int(*callback)(void *, const char *), void *callback_param)
Open parent table of a MyISAM MERGE table.
Definition: myrg_open.cc:219
int myrg_create(const char *name, const char **table_names, uint insert_method, bool fix_names)
Definition: myrg_create.cc:42
ulonglong myrg_position(MYRG_INFO *info)
Definition: myrg_info.cc:31
int myrg_rnext_same(MYRG_INFO *file, uchar *buf)
Definition: myrg_rnext_same.cc:30
int myrg_lock_database(MYRG_INFO *file, int lock_type)
Definition: myrg_locking.cc:36
ha_rows myrg_records_in_range(MYRG_INFO *info, int inx, key_range *min_key, key_range *max_key)
Definition: myrg_range.cc:26
int myrg_rfirst(MYRG_INFO *file, uchar *buf, int inx)
Definition: myrg_rfirst.cc:32
int myrg_panic(enum ha_panic_function function)
Definition: myrg_panic.cc:35
int myrg_rrnd(MYRG_INFO *file, uchar *buf, ulonglong pos)
Definition: myrg_rrnd.cc:47
int myrg_rlast(MYRG_INFO *file, uchar *buf, int inx)
Definition: myrg_rlast.cc:32
int myrg_write(MYRG_INFO *info, uchar *rec)
Definition: myrg_write.cc:30
int myrg_status(MYRG_INFO *file, MYMERGE_INFO *x, int flag)
Definition: myrg_info.cc:42
int myrg_delete(MYRG_INFO *file, const uchar *buff)
Definition: myrg_delete.cc:30
int myrg_rkey(MYRG_INFO *info, uchar *buf, int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag)
Definition: myrg_rkey.cc:52
int myrg_reset(MYRG_INFO *info)
Definition: myrg_extra.cc:54
int myrg_extra(MYRG_INFO *file, enum ha_extra_function function, void *extra_arg)
Definition: myrg_extra.cc:35
int myrg_attach_children(MYRG_INFO *m_info, int handle_locking, MI_INFO *(*callback)(void *), void *callback_param, bool *need_compat_check)
Attach children to a MyISAM MERGE parent table.
Definition: myrg_open.cc:365
TYPELIB merge_insert_method
Definition: myrg_static.cc:40
ha_rows myrg_records(MYRG_INFO *info)
Definition: myrg_records.cc:28
int myrg_update(MYRG_INFO *file, const uchar *old, uchar *new_rec)
Definition: myrg_update.cc:30
MYRG_INFO * myrg_open(const char *name, int mode, int wait_if_locked)
Definition: myrg_open.cc:51
Log info(cout, "NOTE")
Definition: buf0block_hint.cc:30
Definition: os0file.h:86
mode
Definition: file_handle.h:60
Instrumentation helpers for mutexes.
Code for handling of priority queues.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
case opt name
Definition: sslopt-case.h:33
Definition: my_list.h:36
Definition: myisamdef.h:252
Definition: myisammrg.h:55
ulonglong dupp_key_pos
Definition: myisammrg.h:60
ulonglong records
Definition: myisammrg.h:56
uint options
Definition: myisammrg.h:63
int errkey
Definition: myisammrg.h:62
ulong * rec_per_key
Definition: myisammrg.h:64
ulonglong recpos
Definition: myisammrg.h:58
uint reclength
Definition: myisammrg.h:61
ulonglong deleted
Definition: myisammrg.h:57
ulonglong data_file_length
Definition: myisammrg.h:59
Definition: myisammrg.h:72
uint options
Definition: myisammrg.h:79
MYRG_TABLE * open_tables
Definition: myisammrg.h:73
mysql_mutex_t mutex
Definition: myisammrg.h:85
uint reclength
Definition: myisammrg.h:79
LIST open_list
Definition: myisammrg.h:82
ulonglong records
Definition: myisammrg.h:74
MYRG_TABLE * end_table
Definition: myisammrg.h:73
MYRG_TABLE * last_used_table
Definition: myisammrg.h:73
MYRG_TABLE * current_table
Definition: myisammrg.h:73
bool children_attached
Definition: myisammrg.h:81
uint merge_insert_method
Definition: myisammrg.h:78
ulong * rec_per_key_part
Definition: myisammrg.h:84
uint tables
Definition: myisammrg.h:79
QUEUE by_key
Definition: myisammrg.h:83
ulonglong data_file_length
Definition: myisammrg.h:76
uint keys
Definition: myisammrg.h:79
ulong cache_size
Definition: myisammrg.h:77
ulonglong del
Definition: myisammrg.h:75
Definition: myisammrg.h:67
MI_INFO * table
Definition: myisammrg.h:68
ulonglong file_offset
Definition: myisammrg.h:69
Definition: queues.h:43
Definition: typelib.h:35
Definition: my_base.h:1124
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
unsigned int uint
Definition: uca9-dump.cc:75