69 std::ostream &
print(std::ostream &out)
const;
73 std::ostream &out)
const {
74 out <<
"[Bulk_load_error_location_details: filename=" <<
filename
86 return obj.
print(out);
155 std::ostream &
print(std::ostream &out)
const;
182 sout << std::setfill(
'0') << std::setw(2) <<
std::hex
191 out <<
"[Column_text: this=" <<
static_cast<const void *
>(
this)
192 <<
", m_data_ptr=" <<
static_cast<const void *
>(
m_data_ptr)
203 return obj.
print(out);
225 void row(
char *row_begin) {
238 size_t col_index [[maybe_unused]])
const;
289 sout << std::setfill(
'0') << std::setw(2) <<
std::hex
304template <
typename Column_type>
321 template <
typename F>
329 template <
typename F>
368 Column_type &
get_column(
size_t row_offset,
size_t col_index) {
370 assert(row_offset + col_index <
m_columns.size());
371 return m_columns[row_offset + col_index];
378 Column_type &
get_col(
size_t row_index,
size_t col_index) {
391 const Column_type &
read_column(
size_t row_offset,
size_t col_index)
const {
393 assert(row_offset + col_index <
m_columns.size());
394 return m_columns[row_offset + col_index];
461 return "INTEGER_SIGNED";
463 return "INTEGER_UNSIGNED";
554 std::ostream &
print(std::ostream &out)
const;
604 return "typed_array";
622 return "medium_blob";
680 return obj.
print(out);
790 os <<
"INT_SIGNED_ASC";
806 out << col_meta.to_string() <<
", ";
814 [[maybe_unused]])
const {
850 m_error =
"JSON document has more nesting levels than supported";
853 m_error =
"Invalid JSON value is encountered";
856 const char *message [[maybe_unused]])
const {
858 m_error +=
" (Internal Error)";
874 std::pair<std::optional<Rows_mysql>, std::optional<Rows_mysql>>;
890 size_t min_total_rows = 1000;
892 if (estimated_total_rows < min_total_rows) {
893 estimated_total_rows = min_total_rows;
947 size_t &next_index,
char *
buffer,
size_t &buffer_length,
962 size_t start_index,
size_t &consumed_length,
998 std::vector<Row_meta> &metadata));
1022 (
THD * thd, const
TABLE *
table,
size_t keynr,
size_t data_size,
1062 Blob_context blob_ctx,
unsigned char *blobref,
size_t thread,
1063 const
unsigned char *data,
size_t data_len));
1112 (
void *ctx, const
TABLE *
table,
size_t thread,
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
constexpr size_t BLOB_REF_SIZE
The blob reference size.
Definition: bulk_data_service.h:56
void * Blob_context
Definition: bulk_data_service.h:53
std::ostream & operator<<(std::ostream &out, const Bulk_load_error_location_details &obj)
Overloading the global output operator to print objects of type Bulk_load_error_location_details.
Definition: bulk_data_service.h:84
Definition: bulk_data_service.h:824
const char * c_str() const
Definition: bulk_data_service.h:833
void KeyTooBig() const override
Called when a JSON object contains a member with a name that is longer than supported by the JSON bin...
Definition: bulk_data_service.h:841
std::string get_error() const
Definition: bulk_data_service.h:835
std::string m_error
Definition: bulk_data_service.h:838
void InternalError(const char *message) const override
Called when an internal error occurs.
Definition: bulk_data_service.h:855
void ValueTooBig() const override
Called when a JSON document is too big to be stored in the JSON binary format.
Definition: bulk_data_service.h:845
void TooDeep() const override
Called when a JSON document has more nesting levels than supported.
Definition: bulk_data_service.h:849
void InvalidJson() const override
Called when an invalid JSON value is encountered.
Definition: bulk_data_service.h:852
bool CheckStack() const override
Check if the stack is about to be exhausted, and report the error.
Definition: bulk_data_service.h:861
Error handler for the functions that serialize a JSON value in the JSON binary storage format.
Definition: json_error_handler.h:49
Implements the row and column memory management for parse and load operations.
Definition: bulk_data_service.h:305
bool set_num_rows(size_t n_rows)
Set the number of rows.
Definition: bulk_data_service.h:401
std::vector< Column_type > m_columns
All the columns.
Definition: bulk_data_service.h:432
size_t get_next_row_offset(size_t &offset) const
Get next row offset from current row offset.
Definition: bulk_data_service.h:359
Column_type & get_col(size_t col_offset)
Get column using the column offset.
Definition: bulk_data_service.h:385
bool process_columns(size_t row_index, F &&cbk)
Process all columns, invoking callback for each.
Definition: bulk_data_service.h:322
bool process_columns_by_offset(size_t row_offset, F &&cbk)
Definition: bulk_data_service.h:330
size_t get_num_cols() const
Definition: bulk_data_service.h:315
void reset()
Definition: bulk_data_service.h:342
size_t m_num_rows
Number of rows.
Definition: bulk_data_service.h:435
size_t get_row_offset(size_t row_index) const
Get current row offset to access columns.
Definition: bulk_data_service.h:351
size_t get_num_rows() const
Definition: bulk_data_service.h:312
const Column_type & read_column(size_t row_offset, size_t col_index) const
Get constant column for reading using row offset and column index.
Definition: bulk_data_service.h:391
Column_type & get_col(size_t row_index, size_t col_index)
Get column using row index and column index.
Definition: bulk_data_service.h:378
Row_bunch(size_t n_cols)
Create a new row bunch.
Definition: bulk_data_service.h:309
static const size_t S_MAX_TOTAL_COLS
Limit allocation up to 600M columns.
Definition: bulk_data_service.h:428
size_t m_num_columns
Number of columns in each row.
Definition: bulk_data_service.h:438
Column_type & get_column(size_t row_offset, size_t col_index)
Get column using row offset and column index.
Definition: bulk_data_service.h:368
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
@ MYSQL_TYPE_BOOL
Currently just a placeholder.
Definition: field_types.h:79
@ MYSQL_TYPE_TIME2
Internal to MySQL.
Definition: field_types.h:75
@ MYSQL_TYPE_VARCHAR
Definition: field_types.h:71
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:64
@ MYSQL_TYPE_LONG_BLOB
Definition: field_types.h:86
@ MYSQL_TYPE_VAR_STRING
Definition: field_types.h:88
@ MYSQL_TYPE_BLOB
Definition: field_types.h:87
@ MYSQL_TYPE_TINY
Definition: field_types.h:57
@ MYSQL_TYPE_TIME
Definition: field_types.h:67
@ MYSQL_TYPE_SET
Definition: field_types.h:83
@ MYSQL_TYPE_NEWDATE
Internal to MySQL.
Definition: field_types.h:70
@ MYSQL_TYPE_VECTOR
Definition: field_types.h:77
@ MYSQL_TYPE_JSON
Definition: field_types.h:80
@ MYSQL_TYPE_STRING
Definition: field_types.h:89
@ MYSQL_TYPE_NULL
Definition: field_types.h:62
@ MYSQL_TYPE_ENUM
Definition: field_types.h:82
@ MYSQL_TYPE_TINY_BLOB
Definition: field_types.h:84
@ MYSQL_TYPE_LONG
Definition: field_types.h:59
@ MYSQL_TYPE_BIT
Definition: field_types.h:72
@ MYSQL_TYPE_INVALID
Definition: field_types.h:78
@ MYSQL_TYPE_GEOMETRY
Definition: field_types.h:90
@ MYSQL_TYPE_NEWDECIMAL
Definition: field_types.h:81
@ MYSQL_TYPE_DECIMAL
Definition: field_types.h:56
@ MYSQL_TYPE_TYPED_ARRAY
Used for replication only.
Definition: field_types.h:76
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:61
@ MYSQL_TYPE_MEDIUM_BLOB
Definition: field_types.h:85
@ MYSQL_TYPE_DATETIME2
Internal to MySQL.
Definition: field_types.h:74
@ MYSQL_TYPE_SHORT
Definition: field_types.h:58
@ MYSQL_TYPE_DATE
Definition: field_types.h:66
@ MYSQL_TYPE_FLOAT
Definition: field_types.h:60
@ MYSQL_TYPE_TIMESTAMP
Definition: field_types.h:63
@ MYSQL_TYPE_INT24
Definition: field_types.h:65
@ MYSQL_TYPE_DATETIME
Definition: field_types.h:68
@ MYSQL_TYPE_TIMESTAMP2
Definition: field_types.h:73
@ MYSQL_TYPE_YEAR
Definition: field_types.h:69
static uint16 key1[1001]
Definition: hp_test2.cc:50
#define F
Definition: jit_executor_value.cc:374
#define UINT16_MAX
Definition: lexyy.cc:83
void error(const char *format,...)
int mysql_format_from_raw(char *buffer, size_t buffer_length, const Row_meta &metadata, size_t start_index, size_t &consumed_length, Rows_mysql &sql_rows) noexcept
Definition: bulk_data_service.cc:1858
bool get_table_metadata(THD *thd, const TABLE *table, Table_meta &table_meta) noexcept
Definition: bulk_data_service.cc:2530
int mysql_format(THD *thd, const TABLE *table, const Rows_text &text_rows, size_t &next_index, char *buffer, size_t &buffer_length, const CHARSET_INFO *charset, const Row_meta &metadata, Rows_mysql &sql_rows, Bulk_load_error_location_details &error_details) noexcept
Definition: bulk_data_service.cc:1889
bool get_row_metadata_all(THD *thd, const TABLE *table, bool have_key, std::vector< Row_meta > &row_meta_all) noexcept
Definition: bulk_data_service.cc:2551
int mysql_format_using_key(const Row_meta &metadata, const Rows_mysql &sql_keys, size_t key_offset, Rows_mysql &sql_rows, size_t sql_index) noexcept
Definition: bulk_data_service.cc:1799
bool is_killed(THD *thd) noexcept
Definition: bulk_data_service.cc:1941
bool copy_existing_data(void *ctx, const TABLE *duplicate_table, size_t thread, Bulk_load::Stat_callbacks &wait_cbks) noexcept
Definition: bulk_data_service.cc:2731
bool open_blob(THD *thd, void *load_ctx, const TABLE *table, Blob_context &blob_ctx, unsigned char *blobref, size_t thread) noexcept
Definition: bulk_data_service.cc:2617
size_t get_se_memory_size(THD *thd, const TABLE *table) noexcept
Definition: bulk_data_service.cc:2725
bool set_source_table_data(void *ctx, const TABLE *duplicate_table, const std::vector< Bulk_load::Source_table_data > &source_table_data) noexcept
Definition: bulk_data_service.cc:2740
bool write_blob(THD *thd, void *load_ctx, const TABLE *table, Blob_context blob_ctx, unsigned char *blobref, size_t thread, const unsigned char *data, size_t data_len) noexcept
Definition: bulk_data_service.cc:2627
bool close_blob(THD *thd, void *load_ctx, const TABLE *table, Blob_context blob_ctx, unsigned char *blobref, size_t thread) noexcept
Definition: bulk_data_service.cc:2635
bool is_table_supported(THD *thd, const TABLE *table) noexcept
Definition: bulk_data_service.cc:2745
Definition: bulk_data_service.h:821
std::pair< std::optional< Rows_mysql >, std::optional< Rows_mysql > > Read_range
Definition: bulk_data_service.h:874
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
const std::string charset("charset")
bool load(THD *, const dd::String_type &fname, dd::String_type *buf)
Read an sdi file from disk and store in a buffer.
Definition: sdi_file.cc:308
std::string hex(const Container &c)
Definition: hex.h:61
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:76
int key_type
Definition: method.h:38
Definition: aligned_atomic.h:44
ValueType max(X &&first)
Definition: gtid.h:103
const char * begin(const char *const c)
Definition: base64.h:44
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
Define std::hash<Gtid>.
Definition: gtid.h:355
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2876
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2880
static std::mutex lock
Definition: net_ns.cc:56
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
Contains the data needed for the ROW_ID generation for tables without explicit primary key.
Definition: bulk_data_service.h:884
std::pair< uint64_t, uint64_t > get_next_rowid_range() const
Get the next available range for generating DB_ROW_ID.
Definition: bulk_data_service.h:902
size_t get_rows_per_thread() const
Get an estimate of the number of rows to be handled by each thread.
Definition: bulk_data_service.h:888
std::atomic< size_t > m_avg_row_len
Definition: bulk_data_service.h:915
std::mutex m_rowid_mutex
Protects the member m_next_rowid_range.
Definition: bulk_data_service.h:921
void set_begin_rowid_value(size_t row_id)
Definition: bulk_data_service.h:911
size_t m_n_loaders
Definition: bulk_data_service.h:917
size_t m_total_size
Definition: bulk_data_service.h:913
size_t m_next_rowid_range
Definition: bulk_data_service.h:924
Definition: bulk_data_service.h:876
Read_range range
Definition: bulk_data_service.h:879
std::string table
Definition: bulk_data_service.h:878
std::string schema
Definition: bulk_data_service.h:877
Callbacks for collecting time statistics.
Definition: bulk_data_service.h:866
std::function< void()> m_fn_begin
Definition: bulk_data_service.h:868
std::function< void()> m_fn_end
Definition: bulk_data_service.h:870
Definition: bulk_data_service.h:58
std::string filename
Definition: bulk_data_service.h:59
std::string m_table_name
Definition: bulk_data_service.h:65
size_t m_bytes
Definition: bulk_data_service.h:66
size_t row_number
Definition: bulk_data_service.h:60
std::string column_input_data
Definition: bulk_data_service.h:63
std::string column_name
Definition: bulk_data_service.h:61
size_t m_column_length
Definition: bulk_data_service.h:67
std::string m_error_mesg
Definition: bulk_data_service.h:64
std::ostream & print(std::ostream &out) const
Definition: bulk_data_service.h:72
std::string column_type
Definition: bulk_data_service.h:62
Definition: m_ctype.h:421
Definition: bulk_data_service.h:208
uint64_t m_int_data
Column data in integer format.
Definition: bulk_data_service.h:241
std::string to_string() const
Definition: bulk_data_service.h:264
bool m_is_null
If column is NULL.
Definition: bulk_data_service.h:216
char * get_row_begin(const Row_meta &row_meta, size_t col_index) const
Get the pointer to the beginning of row.
Definition: bulk_data_service.h:812
char * m_data_ptr
Column data or row begin.
Definition: bulk_data_service.h:261
char * get_data() const
Definition: bulk_data_service.h:218
int16_t m_type
Column Data Type.
Definition: bulk_data_service.h:210
uint16_t m_data_len
Column data length.
Definition: bulk_data_service.h:213
void set_data(char *ptr)
Definition: bulk_data_service.h:220
void init()
Definition: bulk_data_service.h:243
void row(char *row_begin)
Save the beginning of the row pointer in this object.
Definition: bulk_data_service.h:225
Definition: bulk_data_service.h:89
bool is_null() const
Check if the column is null, by checking special value for length.
Definition: bulk_data_service.h:113
bool is_ext_relaxed() const
Check if the column data is stored externally.
Definition: bulk_data_service.h:133
bool m_is_ext
If true, the column data is stored externally.
Definition: bulk_data_service.h:161
void set_null()
Mark the column to be null, by setting length to a special value.
Definition: bulk_data_service.h:106
std::ostream & print(std::ostream &out) const
Print this object into the given output stream.
Definition: bulk_data_service.h:190
const char * m_data_ptr
Column data.
Definition: bulk_data_service.h:91
bool is_row_id() const
Check if it is DB_ROW_ID column based on the value it contains.
Definition: bulk_data_service.h:98
uint64_t m_row_id
The generated DB_ROW_ID value.
Definition: bulk_data_service.h:101
void init()
Initialize the members.
Definition: bulk_data_service.h:145
void set_ext()
Mark that the column data has been stored externally.
Definition: bulk_data_service.h:139
bool is_ext() const
Check if the column data is stored externally.
Definition: bulk_data_service.h:124
size_t m_data_len
Column data length.
Definition: bulk_data_service.h:94
std::string to_string() const
Definition: bulk_data_service.h:164