Skip to content

Commit d497faf

Browse files
gurusamidahlerlend
authored andcommitted
WL#16264: InnoDB: Add support for bulk load of large objects
Support for bulk load of large objects. This means that when column data size exceeds a threshold, then it will be stored externally (external to the leaf pages of the B-tree), only storing a blob reference in the leaf pages. The data types whose data can be stored externally are - TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT, JSON, POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, GEOMETRY, VARCHAR, VARBINARY. Change-Id: I7a56e68e524e4c482ec466d65bb6b305701c2e05
1 parent 3caffba commit d497faf

34 files changed

+2791
-124
lines changed

include/mysql/components/services/bulk_data_service.h

Lines changed: 327 additions & 6 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Run the bulk_load test suite that is not part of the default
2+
perl mysql-test-run.pl --force --timer --comment=bulk --vardir=var-bulk --suite=innodb,bulk_load
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Run the bulk_load test suite that is not part of the default
2+
perl mysql-test-run.pl --force --timer --comment=bulk --vardir=var-bulk --suite=innodb,bulk_load

share/messages_to_clients.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10494,6 +10494,12 @@ ER_NON_DML_DYNAMIC_PARAMETERS
1049410494
ER_DEPRECATE_NON_COMPOSABLE_MULTIPLE_ENGINE
1049510495
eng "Combining the storage engines %.64s and %.64s is deprecated, but the statement or transaction updates both the %.64s table %.64s.%.64s and the %.64s table %.64s.%.64s."
1049610496

10497+
ER_BULK_JSON_INVALID
10498+
eng "Bulk load reports invalid JSON: error='%s', table='%s', field='%s'"
10499+
10500+
ER_BULK_BLOB_TOO_BIG
10501+
eng "Column data bigger than %zu bytes for column='%s' of table='%s'"
10502+
1049710503
#
1049810504
# End of 9.x error messages (server-to-client).
1049910505
#

share/messages_to_error_log.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12585,7 +12585,7 @@ ER_IB_ERR_CORRUPT_TABLESPACE_UNRECOVERABLE
1258512585
eng "Tablespace '%u' mentioned in the redo log is corrupted in a way it is unrecoverable by double-write buffer, so further redo log recovery is not possible!"
1258612586

1258712587
ER_IB_BULK_LOAD_STATS_WARN
12588-
eng "%s: Failed to save statistics for table=%s err=%zu"
12588+
eng "%s: Failed to save statistics for table=%s err=%zu trx_err=%zu"
1258912589

1259012590
ER_COMPONENT_MASKING_INVALID_FLUSH_INTERVAL_VALUE
1259112591
eng "Invalid flush interval specified: %lu. Valid values are 0 (off) or greater than or equal to %d. Adjusting to %d."
@@ -12746,6 +12746,12 @@ ER_DD_UPDATE_DATADIR_FLAG_FAIL
1274612746
ER_IB_MSG_FIL_STATE_MOVED_PREV
1274712747
eng "%s DD ID: %llu - Tablespace %u, name '%s', found at '%s' outside default data directory, but DD misses info about DATA DIRECTORY"
1274812748

12749+
ER_LOAD_BULK_JSON_ERROR
12750+
eng "Bulk CSV parser reports JSON error: %s at %zu"
12751+
12752+
ER_IB_BULK_LOAD_STATS_INFO
12753+
eng "%s: %s: Saving statistics for table=%s err=%zu trx_err=%zu"
12754+
1274912755
# DO NOT add server-to-client messages here;
1275012756
# they go in messages_to_clients.txt
1275112757
# in the same directory as this file.

sql/handler.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4575,6 +4575,7 @@ class handler {
45754575

45764576
public:
45774577
typedef ulonglong Table_flags;
4578+
using Blob_context = void *;
45784579

45794580
protected:
45804581
TABLE_SHARE *table_share; /* The table definition */
@@ -5102,6 +5103,53 @@ class handler {
51025103
return HA_ERR_UNSUPPORTED;
51035104
}
51045105

5106+
/** Open a blob for write operation.
5107+
@param[in,out] thd user session
5108+
@param[in,out] load_ctx load execution context
5109+
@param[in] thread_idx index of the thread executing
5110+
@param[out] blob_ctx a blob context
5111+
@param[out] blobref a blob reference to be placed in the record.
5112+
@return 0 on success, error code on failure */
5113+
virtual int open_blob(THD *thd [[maybe_unused]],
5114+
void *load_ctx [[maybe_unused]],
5115+
size_t thread_idx [[maybe_unused]],
5116+
Blob_context &blob_ctx [[maybe_unused]],
5117+
unsigned char *blobref [[maybe_unused]]) {
5118+
return HA_ERR_UNSUPPORTED;
5119+
}
5120+
5121+
/** Write to a blob
5122+
@param[in,out] thd user session
5123+
@param[in,out] load_ctx load execution context
5124+
@param[in] thread_idx index of the thread executing
5125+
@param[in] blob_ctx a blob context
5126+
@param[in] data data to be written to blob.
5127+
@param[in] data_len length of data to be written in bytes.
5128+
@return 0 on success, error code on failure */
5129+
virtual int write_blob(THD *thd [[maybe_unused]],
5130+
void *load_ctx [[maybe_unused]],
5131+
size_t thread_idx [[maybe_unused]],
5132+
Blob_context blob_ctx [[maybe_unused]],
5133+
unsigned char *blobref [[maybe_unused]],
5134+
const unsigned char *data [[maybe_unused]],
5135+
size_t data_len [[maybe_unused]]) {
5136+
return HA_ERR_UNSUPPORTED;
5137+
}
5138+
5139+
/** Close the blob
5140+
@param[in,out] thd user session
5141+
@param[in,out] load_ctx load execution context
5142+
@param[in] thread_idx index of the thread executing
5143+
@param[in] blob_ctx a blob context
5144+
@return 0 on success, error code on failure */
5145+
virtual int close_blob(THD *thd [[maybe_unused]],
5146+
void *load_ctx [[maybe_unused]],
5147+
size_t thread_idx [[maybe_unused]],
5148+
Blob_context blob_ctx [[maybe_unused]],
5149+
unsigned char *blobref [[maybe_unused]]) {
5150+
return HA_ERR_UNSUPPORTED;
5151+
}
5152+
51055153
/** End bulk load operation. Must be called after all execution threads have
51065154
completed. Must be called even if the bulk load execution failed.
51075155
@param[in,out] thd user session

0 commit comments

Comments
 (0)