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