Merge branch '10.2' into 10.3
This commit is contained in:
commit
6bb11efa4a
@ -334,6 +334,7 @@ MYSQL_CHECK_SSL()
|
||||
MYSQL_CHECK_READLINE()
|
||||
|
||||
SET(MALLOC_LIBRARY "system")
|
||||
SET(PYTHON_SHEBANG "/usr/bin/env python")
|
||||
|
||||
CHECK_PCRE()
|
||||
|
||||
|
@ -60,7 +60,7 @@ CONTENTS:
|
||||
Wsrep API developed by Codership Oy is a modern generic (database-agnostic)
|
||||
replication API for transactional databases with a goal to make database
|
||||
replication/logging subsystem completely modular and pluggable. It is developed
|
||||
with flexibility and completeness in mind to satisfy broad range of modern
|
||||
with flexibility and completeness in mind to satisfy a broad range of modern
|
||||
replication scenarios. It is equally suitable for synchronous and asynchronous,
|
||||
master-slave and multi-master replication.
|
||||
|
||||
@ -87,7 +87,7 @@ Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please
|
||||
upgrade to mysql-server-5.1 first.
|
||||
|
||||
If you're installing over an existing mysql installation, mysql-server-wsrep
|
||||
will conflict with mysql-server-5.1 package, so remove it first:
|
||||
will conflict with the mysql-server-5.1 package, so remove it first:
|
||||
|
||||
$ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1
|
||||
|
||||
@ -105,7 +105,7 @@ For example, installation of required packages on Debian Lenny:
|
||||
$ sudo apt-get install psmisc
|
||||
$ sudo apt-get -t lenny-backports install mysql-client-5.1
|
||||
|
||||
Now you should be able to install mysql-wsrep package:
|
||||
Now you should be able to install the mysql-wsrep package:
|
||||
|
||||
$ sudo dpkg -i <mysql-server-wsrep DEB>
|
||||
|
||||
@ -150,7 +150,7 @@ and can be ignored unless specific functionality is needed.
|
||||
3. FIRST TIME SETUP
|
||||
|
||||
Unless you're upgrading an already installed mysql-wsrep package, you will need
|
||||
to set up a few things to prepare server for operation.
|
||||
to set up a few things to prepare the server for operation.
|
||||
|
||||
3.1 CONFIGURATION FILES
|
||||
|
||||
@ -162,7 +162,7 @@ to set up a few things to prepare server for operation.
|
||||
* Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line.
|
||||
|
||||
* Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying
|
||||
a path to provider library. If you don't have a provider, leave it as it is.
|
||||
a path to the provider library. If you don't have a provider, leave it as it is.
|
||||
|
||||
* When a new node joins the cluster it'll have to receive a state snapshot from
|
||||
one of the peers. This requires a privileged MySQL account with access from
|
||||
@ -267,7 +267,7 @@ innodb_autoinc_lock_mode=2
|
||||
This is a required parameter. Without it INSERTs into tables with
|
||||
AUTO_INCREMENT column may fail.
|
||||
autoinc lock modes 0 and 1 can cause unresolved deadlock, and make
|
||||
system unresponsive.
|
||||
the system unresponsive.
|
||||
|
||||
innodb_locks_unsafe_for_binlog=1
|
||||
This option is required for parallel applying.
|
||||
@ -299,14 +299,14 @@ wsrep_node_address=
|
||||
results (multiple network interfaces, NAT, etc.)
|
||||
If not explicitly overridden by wsrep_sst_receive_address, the <address> part
|
||||
will be used to listen for SST (see below). And the whole <address>[:port]
|
||||
will be passed to wsrep provider to be used as a base address in its
|
||||
will be passed to the wsrep provider to be used as a base address in its
|
||||
communications.
|
||||
|
||||
wsrep_node_name=
|
||||
Human readable node name (for easier log reading only). Defaults to hostname.
|
||||
|
||||
wsrep_slave_threads=1
|
||||
Number of threads dedicated to processing of writesets from other nodes.
|
||||
The number of threads dedicated to the processing of writesets from other nodes.
|
||||
For best performance should be few per CPU core.
|
||||
|
||||
wsrep_dbug_option
|
||||
@ -326,7 +326,7 @@ wsrep_convert_LOCK_to_trx=0
|
||||
wsrep_retry_autocommit=1
|
||||
Retry autocommit queries and single statement transactions should they fail
|
||||
certification test. This is analogous to rescheduling an autocommit query
|
||||
should it go into deadlock with other transactions in the database lock
|
||||
should it go into a deadlock with other transactions in the database lock
|
||||
manager.
|
||||
|
||||
wsrep_auto_increment_control=1
|
||||
@ -357,7 +357,7 @@ wsrep_OSU_method=TOI
|
||||
is not replicating and may be unable to process replication events (due to
|
||||
table lock). Once DDL operation is complete, the node will catch up and sync
|
||||
with the cluster to become fully operational again. The DDL statement or
|
||||
its effects are not replicated, so it is user's responsibility to manually
|
||||
its effects are not replicated, so it is the user's responsibility to manually
|
||||
perform this operation on each of the nodes.
|
||||
|
||||
wsrep_forced_binlog_format=none
|
||||
@ -412,8 +412,8 @@ wsrep_sst_auth=
|
||||
|
||||
wsrep_sst_donor=
|
||||
A name of the node which should serve as state snapshot donor. This allows
|
||||
to control which node will serve state snapshot request. By default the
|
||||
most suitable node is chosen by wsrep provider. This is the same as given in
|
||||
controlling which node will serve the state snapshot request. By default the
|
||||
most suitable node is chosen by the wsrep provider. This is the same as given in
|
||||
wsrep_node_name.
|
||||
|
||||
|
||||
@ -423,7 +423,7 @@ wsrep_sst_donor=
|
||||
for the database. They change the database structure and are non-
|
||||
transactional.
|
||||
|
||||
Release 22.3 brings a new method for performing schema upgrades. User can
|
||||
Release 22.3 brings a new method for performing schema upgrades. A user can
|
||||
now choose whether to use the traditional total order isolation or new
|
||||
rolling schema upgrade method. The OSU method choice is done by global
|
||||
parameter: 'wsrep_OSU_method'.
|
||||
@ -439,7 +439,7 @@ wsrep_sst_donor=
|
||||
|
||||
6.2 Rolling Schema Upgrade (RSU)
|
||||
|
||||
Rolling schema upgrade is new DDL processing method, where DDL will be
|
||||
Rolling schema upgrade is a new DDL processing method, where DDL will be
|
||||
processed locally for the node. The node is disconnected of the replication
|
||||
for the duration of the DDL processing, so that there is only DDL statement
|
||||
processing in the node and it does not block the rest of the cluster. When
|
||||
@ -468,7 +468,7 @@ wsrep_sst_donor=
|
||||
* LOCK/UNLOCK TABLES cannot be supported in multi-master setups.
|
||||
* lock functions (GET_LOCK(), RELEASE_LOCK()... )
|
||||
|
||||
4) Query log cannot be directed to table. If you enable query logging,
|
||||
4) Query log cannot be directed to a table. If you enable query logging,
|
||||
you must forward the log to a file:
|
||||
log_output = FILE
|
||||
Use general_log and general_log_file to choose query logging and the
|
||||
@ -480,7 +480,7 @@ wsrep_sst_donor=
|
||||
6) Due to cluster level optimistic concurrency control, transaction issuing
|
||||
COMMIT may still be aborted at that stage. There can be two transactions.
|
||||
writing to same rows and committing in separate cluster nodes, and only one
|
||||
of the them can successfully commit. The failing one will be aborted.
|
||||
of them can successfully commit. The failing one will be aborted.
|
||||
For cluster level aborts, MySQL/galera cluster gives back deadlock error.
|
||||
code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)).
|
||||
|
||||
|
@ -214,6 +214,8 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
|
||||
ALTERNATIVE_NAME("server" "mariadb-server")
|
||||
ALTERNATIVE_NAME("server" "mysql-compat-server")
|
||||
ALTERNATIVE_NAME("test" "mariadb-test")
|
||||
ELSEIF(RPM MATCHES "(rhel|centos)8")
|
||||
SET(PYTHON_SHEBANG "/usr/bin/python3")
|
||||
ENDIF()
|
||||
|
||||
# workaround for lots of perl dependencies added by rpmbuild
|
||||
|
@ -6,10 +6,7 @@ ENDIF()
|
||||
|
||||
SET(CONC_WITH_SIGNCODE ${SIGNCODE})
|
||||
SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS})
|
||||
|
||||
IF(NOT TARGET zlib)
|
||||
SET(CONC_WITH_EXTERNAL_ZLIB ON)
|
||||
ENDIF()
|
||||
SET(CONC_WITH_EXTERNAL_ZLIB ON)
|
||||
|
||||
IF(SSL_DEFINES MATCHES "YASSL")
|
||||
IF(WIN32)
|
||||
|
@ -34,11 +34,6 @@ ENDMACRO()
|
||||
|
||||
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
|
||||
|
||||
# For NDBCLUSTER: Use bundled zlib by default
|
||||
IF (NOT WITH_ZLIB)
|
||||
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_ZLIB STREQUAL "bundled")
|
||||
MYSQL_USE_BUNDLED_ZLIB()
|
||||
ELSE()
|
||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -571,7 +571,7 @@ Description: OQGraph storage engine for MariaDB
|
||||
Package: mariadb-plugin-tokudb
|
||||
Architecture: amd64
|
||||
Depends: mariadb-server-10.3 (= ${binary:Version}),
|
||||
libjemalloc1 (>= 3.0.0~),
|
||||
libjemalloc1 (>= 3.0.0~) | libjemalloc2,
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Breaks: mariadb-server-10.0,
|
||||
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
#include "fil_cur.h"
|
||||
#include "fil0crypt.h"
|
||||
#include "fil0pagecompress.h"
|
||||
#include "common.h"
|
||||
#include "read_filt.h"
|
||||
#include "xtrabackup.h"
|
||||
@ -270,6 +271,102 @@ xb_fil_cur_open(
|
||||
return(XB_FIL_CUR_SUCCESS);
|
||||
}
|
||||
|
||||
static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor,
|
||||
fil_space_t *space)
|
||||
{
|
||||
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
|
||||
byte tmp_page[UNIV_PAGE_SIZE_MAX];
|
||||
const ulint page_size = cursor->page_size.physical();
|
||||
ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
|
||||
|
||||
/* We ignore the doublewrite buffer pages.*/
|
||||
if (cursor->space_id == TRX_SYS_SPACE
|
||||
&& page_no >= FSP_EXTENT_SIZE
|
||||
&& page_no < FSP_EXTENT_SIZE * 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Validate page number. */
|
||||
if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no
|
||||
&& cursor->space_id != TRX_SYS_SPACE) {
|
||||
/* On pages that are not all zero, the
|
||||
page number must match.
|
||||
|
||||
There may be a mismatch on tablespace ID,
|
||||
because files may be renamed during backup.
|
||||
We disable the page number check
|
||||
on the system tablespace, because it may consist
|
||||
of multiple files, and here we count the pages
|
||||
from the start of each file.)
|
||||
|
||||
The first 38 and last 8 bytes are never encrypted. */
|
||||
const ulint* p = reinterpret_cast<ulint*>(page);
|
||||
const ulint* const end = reinterpret_cast<ulint*>(
|
||||
page + page_size);
|
||||
do {
|
||||
if (*p++) {
|
||||
return true;
|
||||
}
|
||||
} while (p != end);
|
||||
|
||||
/* Whole zero page is valid. */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Validate encrypted pages. The first page is never encrypted.
|
||||
In the system tablespace, the first page would be written with
|
||||
FIL_PAGE_FILE_FLUSH_LSN at shutdown, and if the LSN exceeds
|
||||
4,294,967,295, the mach_read_from_4() below would wrongly
|
||||
interpret the page as encrypted. We prevent that by checking
|
||||
page_no first. */
|
||||
if (page_no
|
||||
&& mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
|
||||
&& space->crypt_data
|
||||
&& space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) {
|
||||
|
||||
if (!fil_space_verify_crypt_checksum(page, cursor->page_size))
|
||||
return true;
|
||||
|
||||
/* Compressed encrypted need to be decrypted
|
||||
and decompressed for verification. */
|
||||
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
|
||||
&& !opt_extended_validation)
|
||||
return false;
|
||||
|
||||
memcpy(tmp_page, page, page_size);
|
||||
|
||||
bool decrypted = false;
|
||||
if (!fil_space_decrypt(space, tmp_frame, tmp_page, &decrypted)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
|
||||
return buf_page_is_corrupted(true, tmp_page,
|
||||
cursor->page_size, space);
|
||||
}
|
||||
}
|
||||
|
||||
if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
|
||||
memcpy(tmp_page, page, page_size);
|
||||
}
|
||||
|
||||
if (page_type == FIL_PAGE_PAGE_COMPRESSED
|
||||
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
|
||||
ulint decomp = fil_page_decompress(tmp_frame, tmp_page);
|
||||
page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE);
|
||||
|
||||
return (!decomp
|
||||
|| (decomp != srv_page_size
|
||||
&& cursor->page_size.is_compressed())
|
||||
|| page_type == FIL_PAGE_PAGE_COMPRESSED
|
||||
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
|
||||
|| buf_page_is_corrupted(true, tmp_page,
|
||||
cursor->page_size, space));
|
||||
}
|
||||
|
||||
return buf_page_is_corrupted(true, page, cursor->page_size, space);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Reads and verifies the next block of pages from the source
|
||||
file. Positions the cursor after the last read non-corrupted page.
|
||||
@ -288,8 +385,6 @@ xb_fil_cur_read(
|
||||
xb_fil_cur_result_t ret;
|
||||
ib_int64_t offset;
|
||||
ib_int64_t to_read;
|
||||
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
|
||||
byte tmp_page[UNIV_PAGE_SIZE_MAX];
|
||||
const ulint page_size = cursor->page_size.physical();
|
||||
xb_ad(!cursor->is_system() || page_size == srv_page_size);
|
||||
|
||||
@ -327,7 +422,7 @@ xb_fil_cur_read(
|
||||
|
||||
xb_a((to_read & (page_size - 1)) == 0);
|
||||
|
||||
npages = (ulint) (to_read / cursor->page_size.physical());
|
||||
npages = (ulint) (to_read / page_size);
|
||||
|
||||
retry_count = 10;
|
||||
ret = XB_FIL_CUR_SUCCESS;
|
||||
@ -344,7 +439,7 @@ read_retry:
|
||||
cursor->buf_read = 0;
|
||||
cursor->buf_npages = 0;
|
||||
cursor->buf_offset = offset;
|
||||
cursor->buf_page_no = (ulint)(offset / cursor->page_size.physical());
|
||||
cursor->buf_page_no = (ulint)(offset / page_size);
|
||||
|
||||
if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
|
||||
(ulint) to_read)) {
|
||||
@ -357,58 +452,28 @@ read_retry:
|
||||
page += page_size, i++) {
|
||||
ulint page_no = cursor->buf_page_no + i;
|
||||
|
||||
if (cursor->space_id == TRX_SYS_SPACE &&
|
||||
page_no >= FSP_EXTENT_SIZE &&
|
||||
page_no < FSP_EXTENT_SIZE * 3) {
|
||||
/* We ignore the doublewrite buffer pages */
|
||||
} else if (mach_read_from_4(
|
||||
page
|
||||
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
|
||||
&& space->crypt_data
|
||||
&& space->crypt_data->type
|
||||
!= CRYPT_SCHEME_UNENCRYPTED
|
||||
&& fil_space_verify_crypt_checksum(
|
||||
page, cursor->page_size)) {
|
||||
ut_ad(mach_read_from_4(page + FIL_PAGE_SPACE_ID)
|
||||
== space->id);
|
||||
if (page_is_corrupted(page, page_no, cursor, space)){
|
||||
retry_count--;
|
||||
|
||||
bool decrypted = false;
|
||||
|
||||
memcpy(tmp_page, page, page_size);
|
||||
|
||||
if (!fil_space_decrypt(space, tmp_frame,
|
||||
tmp_page, &decrypted)
|
||||
|| buf_page_is_corrupted(true, tmp_page,
|
||||
cursor->page_size,
|
||||
space)) {
|
||||
goto corrupted;
|
||||
if (retry_count == 0) {
|
||||
msg("[%02u] mariabackup: "
|
||||
"Error: failed to read page after "
|
||||
"10 retries. File %s seems to be "
|
||||
"corrupted.\n", cursor->thread_n,
|
||||
cursor->abs_path);
|
||||
ret = XB_FIL_CUR_ERROR;
|
||||
break;
|
||||
}
|
||||
} else if (buf_page_is_corrupted(true, page, cursor->page_size,
|
||||
space)) {
|
||||
corrupted:
|
||||
retry_count--;
|
||||
if (retry_count == 0) {
|
||||
msg("[%02u] mariabackup: "
|
||||
"Error: failed to read page after "
|
||||
"10 retries. File %s seems to be "
|
||||
"corrupted.\n", cursor->thread_n,
|
||||
cursor->abs_path);
|
||||
ret = XB_FIL_CUR_ERROR;
|
||||
break;
|
||||
}
|
||||
msg("[%02u] mariabackup: "
|
||||
"Database page corruption detected at page "
|
||||
ULINTPF ", retrying...\n", cursor->thread_n,
|
||||
page_no);
|
||||
|
||||
if (retry_count == 9) {
|
||||
msg("[%02u] mariabackup: "
|
||||
"Database page corruption detected at page "
|
||||
ULINTPF ", retrying...\n",
|
||||
cursor->thread_n, page_no);
|
||||
}
|
||||
|
||||
os_thread_sleep(100000);
|
||||
goto read_retry;
|
||||
}
|
||||
cursor->buf_read += page_size;
|
||||
cursor->buf_npages++;
|
||||
os_thread_sleep(100000);
|
||||
goto read_retry;
|
||||
}
|
||||
cursor->buf_read += page_size;
|
||||
cursor->buf_npages++;
|
||||
}
|
||||
|
||||
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
|
||||
|
@ -200,6 +200,7 @@ static char* log_ignored_opt;
|
||||
|
||||
extern my_bool opt_use_ssl;
|
||||
my_bool opt_ssl_verify_server_cert;
|
||||
my_bool opt_extended_validation;
|
||||
|
||||
/* === metadata of backup === */
|
||||
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
|
||||
@ -760,6 +761,7 @@ enum options_xtrabackup
|
||||
OPT_XTRA_DATABASES,
|
||||
OPT_XTRA_DATABASES_FILE,
|
||||
OPT_XTRA_PARALLEL,
|
||||
OPT_XTRA_EXTENDED_VALIDATION,
|
||||
OPT_XTRA_STREAM,
|
||||
OPT_XTRA_COMPRESS,
|
||||
OPT_XTRA_COMPRESS_THREADS,
|
||||
@ -1217,6 +1219,14 @@ struct my_option xb_server_options[] =
|
||||
(G_PTR*) &xtrabackup_parallel, (G_PTR*) &xtrabackup_parallel, 0, GET_INT,
|
||||
REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0},
|
||||
|
||||
{"extended_validation", OPT_XTRA_EXTENDED_VALIDATION,
|
||||
"Enable extended validation for Innodb data pages during backup phase."
|
||||
"Will slow down backup considerably, in case encryption is used.",
|
||||
(G_PTR*)&opt_extended_validation,
|
||||
(G_PTR*)&opt_extended_validation,
|
||||
0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0},
|
||||
|
||||
|
||||
{"log", OPT_LOG, "Ignored option for MySQL option compatibility",
|
||||
(G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0,
|
||||
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
@ -1453,7 +1463,7 @@ debug_sync_point(const char *name)
|
||||
}
|
||||
|
||||
|
||||
static std::vector<std::string> tables_for_export;
|
||||
static std::set<std::string> tables_for_export;
|
||||
|
||||
static void append_export_table(const char *dbname, const char *tablename, bool is_remote)
|
||||
{
|
||||
@ -1465,7 +1475,15 @@ static void append_export_table(const char *dbname, const char *tablename, bool
|
||||
char *p=strrchr(buf, '.');
|
||||
if (p) *p=0;
|
||||
|
||||
tables_for_export.push_back(ut_get_name(0,buf));
|
||||
std::string name=ut_get_name(0, buf);
|
||||
/* Strip partition name comment from table name, if any */
|
||||
if (ends_with(name.c_str(), "*/"))
|
||||
{
|
||||
size_t pos= name.rfind("/*");
|
||||
if (pos != std::string::npos)
|
||||
name.resize(pos);
|
||||
}
|
||||
tables_for_export.insert(name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1480,9 +1498,10 @@ static int create_bootstrap_file()
|
||||
|
||||
fputs("SET NAMES UTF8;\n",f);
|
||||
enumerate_ibd_files(append_export_table);
|
||||
for (size_t i= 0; i < tables_for_export.size(); i++)
|
||||
for (std::set<std::string>::iterator it = tables_for_export.begin();
|
||||
it != tables_for_export.end(); it++)
|
||||
{
|
||||
const char *tab = tables_for_export[i].c_str();
|
||||
const char *tab = it->c_str();
|
||||
fprintf(f,
|
||||
"BEGIN NOT ATOMIC "
|
||||
"DECLARE CONTINUE HANDLER FOR NOT FOUND,SQLEXCEPTION BEGIN END;"
|
||||
@ -1512,7 +1531,7 @@ static int prepare_export()
|
||||
snprintf(cmdline, sizeof cmdline,
|
||||
IF_WIN("\"","") "\"%s\" --mysqld \"%s\" "
|
||||
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
|
||||
" --innodb --innodb-fast-shutdown=0"
|
||||
" --innodb --innodb-fast-shutdown=0 --loose-partition"
|
||||
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
|
||||
" --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
|
||||
mariabackup_exe,
|
||||
@ -1524,7 +1543,7 @@ static int prepare_export()
|
||||
sprintf(cmdline,
|
||||
IF_WIN("\"","") "\"%s\" --mysqld"
|
||||
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
|
||||
" --innodb --innodb-fast-shutdown=0"
|
||||
" --innodb --innodb-fast-shutdown=0 --loose-partition"
|
||||
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
|
||||
" --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
|
||||
mariabackup_exe,
|
||||
@ -3356,8 +3375,15 @@ xb_load_tablespaces()
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes,
|
||||
&flush_lsn);
|
||||
for (int i= 0; i < 10; i++) {
|
||||
err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes,
|
||||
&flush_lsn);
|
||||
if (err == DB_PAGE_CORRUPTED || err == DB_CORRUPTION) {
|
||||
my_sleep(1000);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
msg("mariabackup: Could not open data files.\n");
|
||||
@ -5769,7 +5795,6 @@ check_all_privileges()
|
||||
mysql_free_result(result);
|
||||
|
||||
int check_result = PRIVILEGE_OK;
|
||||
bool reload_checked = false;
|
||||
|
||||
/* FLUSH TABLES WITH READ LOCK */
|
||||
if (!opt_no_lock)
|
||||
@ -5777,7 +5802,6 @@ check_all_privileges()
|
||||
check_result |= check_privilege(
|
||||
granted_privileges,
|
||||
"RELOAD", "*", "*");
|
||||
reload_checked = true;
|
||||
}
|
||||
|
||||
if (!opt_no_lock)
|
||||
@ -6426,3 +6450,12 @@ static int get_exepath(char *buf, size_t size, const char *argv0)
|
||||
|
||||
return my_realpath(buf, argv0, 0);
|
||||
}
|
||||
|
||||
|
||||
#if defined (__SANITIZE_ADDRESS__) && defined (__linux__)
|
||||
/* Avoid LeakSanitizer's false positives. */
|
||||
const char* __asan_default_options()
|
||||
{
|
||||
return "detect_leaks=0";
|
||||
}
|
||||
#endif
|
||||
|
@ -111,6 +111,7 @@ extern my_bool opt_noversioncheck;
|
||||
extern my_bool opt_no_backup_locks;
|
||||
extern my_bool opt_decompress;
|
||||
extern my_bool opt_remove_original;
|
||||
extern my_bool opt_extended_validation;
|
||||
extern my_bool opt_lock_ddl_per_table;
|
||||
|
||||
extern char *opt_incremental_history_name;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 334964f0711c3fd027f634a239eee57bc912f7ff
|
||||
Subproject commit 34f8887af03d022416dd6593de91d0706e57f46b
|
@ -8,3 +8,22 @@ t CREATE TABLE `t` (
|
||||
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t;
|
||||
create temporary table t1 (a int, v int as (a));
|
||||
alter table t1 change column a b int, algorithm=inplace;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
create temporary table t2 (a int, v int as (a));
|
||||
lock table t2 write;
|
||||
alter table t2 change column a b int, algorithm=inplace;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TEMPORARY TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
@ -8,3 +8,14 @@ create table t (a int, v int as (a)) engine=innodb;
|
||||
alter table t change column a b tinyint, algorithm=inplace;
|
||||
show create table t;
|
||||
drop table t;
|
||||
|
||||
create temporary table t1 (a int, v int as (a));
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
||||
alter table t1 change column a b int, algorithm=inplace;
|
||||
show create table t1;
|
||||
|
||||
create temporary table t2 (a int, v int as (a));
|
||||
lock table t2 write;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
||||
alter table t2 change column a b int, algorithm=inplace;
|
||||
show create table t2;
|
||||
|
@ -85,3 +85,13 @@ t1 CREATE TABLE `t1` (
|
||||
`c` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
create temporary table t1 (
|
||||
id int not null auto_increment primary key,
|
||||
f int not null default 0
|
||||
);
|
||||
insert into t1 () values ();
|
||||
alter ignore table t1 add constraint check (f > 0);
|
||||
Warnings:
|
||||
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
|
||||
alter table t1;
|
||||
drop table t1;
|
||||
|
@ -103,3 +103,15 @@ CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
|
||||
ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table
|
||||
#
|
||||
create temporary table t1 (
|
||||
id int not null auto_increment primary key,
|
||||
f int not null default 0
|
||||
);
|
||||
insert into t1 () values ();
|
||||
alter ignore table t1 add constraint check (f > 0);
|
||||
alter table t1;
|
||||
drop table t1;
|
||||
|
@ -246,4 +246,28 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL b 263 NULL 3 Using index for group-by
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
|
||||
#
|
||||
CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
|
||||
KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
|
||||
explain
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
MIN(t1.v1)
|
||||
king
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king'), ('bad');
|
||||
explain
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
MIN(x.v1)
|
||||
NULL
|
||||
drop table t1;
|
||||
End of 5.5 tests
|
||||
|
@ -192,4 +192,23 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2),
|
||||
KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go');
|
||||
explain
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu';
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES ('king'), ('bad');
|
||||
explain
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
@ -18,3 +18,10 @@ ERROR 42000: Access denied for user 'test'@'%' to database 'mysql'
|
||||
connection default;
|
||||
drop user test, foo;
|
||||
drop role foo;
|
||||
CREATE TABLE t1 (a INT);
|
||||
LOCK TABLE t1 WRITE;
|
||||
REVOKE EXECUTE ON PROCEDURE sp FROM u;
|
||||
ERROR HY000: Table 'user' was not locked with LOCK TABLES
|
||||
REVOKE PROCESS ON *.* FROM u;
|
||||
ERROR HY000: Table 'user' was not locked with LOCK TABLES
|
||||
DROP TABLE t1;
|
||||
|
@ -23,3 +23,13 @@ show grants for foo@'%'; # user
|
||||
drop user test, foo;
|
||||
drop role foo;
|
||||
|
||||
#
|
||||
# MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
LOCK TABLE t1 WRITE;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
REVOKE EXECUTE ON PROCEDURE sp FROM u;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
REVOKE PROCESS ON *.* FROM u;
|
||||
DROP TABLE t1;
|
||||
|
@ -1089,6 +1089,7 @@ from
|
||||
t0 A, t0 B, t0 C;
|
||||
drop table t0,t1;
|
||||
#
|
||||
#
|
||||
# MDEV-10360: Extended keys: index properties depend on index order
|
||||
#
|
||||
create table t0 (a int);
|
||||
|
@ -725,6 +725,7 @@ if ($rows < 2)
|
||||
|
||||
drop table t0,t1;
|
||||
|
||||
--echo #
|
||||
--echo #
|
||||
--echo # MDEV-10360: Extended keys: index properties depend on index order
|
||||
--echo #
|
||||
|
@ -4333,12 +4333,12 @@ second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL E
|
||||
show create event ee1;
|
||||
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
|
||||
ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
|
||||
create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
|
||||
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
|
||||
show events;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
drop database second;
|
||||
create database third;
|
||||
@ -4346,7 +4346,7 @@ use third;
|
||||
show events;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
drop database third;
|
||||
set time_zone = 'SYSTEM';
|
||||
|
@ -1810,7 +1810,7 @@ show create event ee1;
|
||||
|
||||
## prove three works (with spaces and tabs on the end)
|
||||
# start with one from the previous restore
|
||||
create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
|
||||
create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;
|
||||
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
|
||||
show events;
|
||||
--exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
|
||||
|
@ -79,7 +79,6 @@ partition p1 values less than ('2016-10-18'),
|
||||
partition p2 values less than ('2020-10-19'));
|
||||
insert t1 values (0, '2000-01-02', 0);
|
||||
insert t1 values (1, '2020-01-02', 10);
|
||||
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
||||
--error ER_CONSTRAINT_FAILED
|
||||
alter table t1 add check (b in (0, 1));
|
||||
alter table t1 add check (b in (0, 10));
|
||||
@ -96,7 +95,6 @@ partition p1 values less than ('2016-10-18'),
|
||||
partition p2 values less than ('2020-10-19'));
|
||||
insert t1 values (0, '2000-01-02', 0);
|
||||
insert t1 values (1, '2020-01-02', 10);
|
||||
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
||||
--error ER_CONSTRAINT_FAILED
|
||||
alter table t1 add check (b in (0, 1));
|
||||
alter table t1 add check (b in (0, 10));
|
||||
|
@ -954,6 +954,26 @@ test_jfg test_jfg11
|
||||
test_jfg test_jfg12#P#p1000
|
||||
test_jfg test_jfg12#P#pmax
|
||||
DROP DATABASE test_jfg;
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (
|
||||
b int,
|
||||
c int,
|
||||
d bit not null default 0,
|
||||
v bit as (d) virtual,
|
||||
key (b,v)
|
||||
) engine=innodb partition by hash (b);
|
||||
insert into t1 values (1),(2);
|
||||
insert into t2 (b,c,d) values (1,1,0),(2,2,0);
|
||||
explain select t1.* from t1 join t2 on (v = a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
|
||||
select t1.* from t1 join t2 on (v = a);
|
||||
a
|
||||
drop table t1, t2;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
|
||||
#
|
||||
@ -965,3 +985,6 @@ SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
|
||||
COUNT(*)
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -1048,6 +1048,27 @@ database_name = 'test_jfg';
|
||||
|
||||
DROP DATABASE test_jfg;
|
||||
|
||||
#
|
||||
# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column
|
||||
#
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (
|
||||
b int,
|
||||
c int,
|
||||
d bit not null default 0,
|
||||
v bit as (d) virtual,
|
||||
key (b,v)
|
||||
) engine=innodb partition by hash (b);
|
||||
insert into t1 values (1),(2);
|
||||
insert into t2 (b,c,d) values (1,1,0),(2,2,0);
|
||||
explain select t1.* from t1 join t2 on (v = a);
|
||||
select t1.* from t1 join t2 on (v = a);
|
||||
drop table t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
|
||||
--echo #
|
||||
@ -1057,3 +1078,7 @@ PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
|
||||
INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL);
|
||||
SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -37,3 +37,21 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL NULL NULL NULL NULL 10
|
||||
1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
|
||||
drop table t0,t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
|
||||
KEY(f1), KEY(f2)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES
|
||||
(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
|
||||
(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
|
||||
(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
|
||||
(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
|
||||
CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
|
||||
SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
|
||||
WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
|
||||
pk f1 f2 f3 pk f1 f2 f3 f4 f5
|
||||
1 4 v NULL 14 1 q NULL 4 q
|
||||
2 6 v NULL 14 1 q NULL 4 q
|
||||
3 7 c NULL 14 1 q NULL 4 q
|
||||
drop table t1,t2;
|
||||
|
@ -45,3 +45,20 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
|
||||
|
||||
drop table t0,t1,t2;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
|
||||
KEY(f1), KEY(f2)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL),
|
||||
(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL),
|
||||
(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL),
|
||||
(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL);
|
||||
|
||||
CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
|
||||
|
||||
SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
|
||||
WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
|
||||
drop table t1,t2;
|
||||
|
@ -170,11 +170,24 @@ flush privileges;
|
||||
drop database mysqltest_db1;
|
||||
set global read_only= @start_read_only;
|
||||
#
|
||||
# MDEV-16987 - ALTER DATABASE possible in read-only mode
|
||||
#
|
||||
CREATE USER user1@localhost;
|
||||
GRANT ALTER ON test1.* TO user1@localhost;
|
||||
CREATE DATABASE test1;
|
||||
SET GLOBAL read_only=1;
|
||||
ALTER DATABASE test1 CHARACTER SET utf8;
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
SET GLOBAL read_only=0;
|
||||
DROP DATABASE test1;
|
||||
DROP USER user1@localhost;
|
||||
USE test;
|
||||
# End of 5.5 tests
|
||||
#
|
||||
# WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
|
||||
#
|
||||
#
|
||||
# Test interaction with read_only system variable.
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
CREATE USER user1;
|
||||
@ -211,3 +224,4 @@ connection default;
|
||||
DROP USER user1;
|
||||
SET GLOBAL read_only= 0;
|
||||
DROP TABLE t1;
|
||||
# End of 10.0 tests
|
||||
|
@ -283,6 +283,23 @@ flush privileges;
|
||||
drop database mysqltest_db1;
|
||||
set global read_only= @start_read_only;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode
|
||||
--echo #
|
||||
CREATE USER user1@localhost;
|
||||
GRANT ALTER ON test1.* TO user1@localhost;
|
||||
CREATE DATABASE test1;
|
||||
SET GLOBAL read_only=1;
|
||||
change_user user1;
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
ALTER DATABASE test1 CHARACTER SET utf8;
|
||||
change_user root;
|
||||
SET GLOBAL read_only=0;
|
||||
DROP DATABASE test1;
|
||||
DROP USER user1@localhost;
|
||||
USE test;
|
||||
|
||||
--echo # End of 5.5 tests
|
||||
|
||||
--echo #
|
||||
--echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
|
||||
@ -291,10 +308,6 @@ set global read_only= @start_read_only;
|
||||
--echo #
|
||||
--echo # Test interaction with read_only system variable.
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
@ -344,3 +357,5 @@ DROP TABLE t1;
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
--echo # End of 10.0 tests
|
||||
|
@ -465,3 +465,17 @@ a b
|
||||
Hello HL
|
||||
DROP FUNCTION METAPHON;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-15424: Unreasonal SQL Error (1356) on select from view
|
||||
#
|
||||
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
||||
create table t1(a int , b int);
|
||||
insert into t1 values(100, 54), (200, 199);
|
||||
create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1;
|
||||
select * from v1;
|
||||
myfunc_int(max(a) over (order by b) , b)
|
||||
154
|
||||
399
|
||||
drop view v1;
|
||||
drop function myfunc_int;
|
||||
drop table t1;
|
||||
|
@ -528,3 +528,16 @@ DROP FUNCTION METAPHON;
|
||||
#INSERT INTO t1 (a) VALUES ('Hello');
|
||||
#SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view
|
||||
--echo #
|
||||
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
|
||||
eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
|
||||
create table t1(a int , b int);
|
||||
insert into t1 values(100, 54), (200, 199);
|
||||
create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop function myfunc_int;
|
||||
drop table t1;
|
||||
|
@ -3471,7 +3471,25 @@ MIN(b1) OVER ()
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
# MDEV-15424: Unreasonal SQL Error (1356) on select from view
|
||||
#
|
||||
create table t1 (id int, n1 int);
|
||||
insert into t1 values (1,1), (2,1), (3,2), (4,4);
|
||||
create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1;
|
||||
explain select * from v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary
|
||||
select * from v1;
|
||||
ifnull(max(n1) over (partition by n1),'aaa')
|
||||
1
|
||||
1
|
||||
2
|
||||
4
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]'
|
||||
@ -3490,3 +3508,6 @@ d x
|
||||
00:00:01 00:00:02
|
||||
00:00:02 NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -2229,7 +2229,20 @@ SELECT DISTINCT MIN(b1) OVER () FROM t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view
|
||||
--echo #
|
||||
|
||||
create table t1 (id int, n1 int);
|
||||
insert into t1 values (1,1), (2,1), (3,2), (4,4);
|
||||
|
||||
create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1;
|
||||
explain select * from v1;
|
||||
select * from v1;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
@ -2245,3 +2258,7 @@ CREATE TABLE t1 (d time);
|
||||
INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
|
||||
SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
73
mysql-test/r/ps_error.result
Normal file
73
mysql-test/r/ps_error.result
Normal file
@ -0,0 +1,73 @@
|
||||
#
|
||||
# MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS
|
||||
#
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'foo'
|
||||
EXECUTE stmt;
|
||||
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
|
||||
SELECT a FROM t1 GROUP BY NULL WITH ROLLUP;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=DEFAULT;
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'foo'
|
||||
EXECUTE stmt;
|
||||
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
|
||||
SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ;
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=DEFAULT;
|
||||
#
|
||||
# MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS
|
||||
#
|
||||
SET SQL_MODE='STRICT_ALL_TABLES';
|
||||
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'foo'
|
||||
EXECUTE stmt;
|
||||
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
|
||||
SELECT 'All done';
|
||||
All done
|
||||
All done
|
||||
SET SQL_MODE=DEFAULT;
|
||||
SET SQL_MODE='STRICT_ALL_TABLES';
|
||||
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'foo'
|
||||
EXECUTE stmt;
|
||||
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SELECT 'All done';
|
||||
All done
|
||||
All done
|
||||
SET SQL_MODE=DEFAULT;
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'foo'
|
||||
EXECUTE stmt;
|
||||
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
|
||||
SELECT a FROM t1 GROUP BY a;
|
||||
a
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE=DEFAULT;
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'foo'
|
||||
EXECUTE stmt;
|
||||
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
|
||||
SELECT a FROM t1 GROUP BY a;
|
||||
a
|
||||
INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq;
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE=DEFAULT;
|
0
mysql-test/std_data/mdev17909#P#p20181029.MYD
Normal file
0
mysql-test/std_data/mdev17909#P#p20181029.MYD
Normal file
BIN
mysql-test/std_data/mdev17909#P#p20181029.MYI
Normal file
BIN
mysql-test/std_data/mdev17909#P#p20181029.MYI
Normal file
Binary file not shown.
0
mysql-test/std_data/mdev17909#P#p20181128.MYD
Normal file
0
mysql-test/std_data/mdev17909#P#p20181128.MYD
Normal file
BIN
mysql-test/std_data/mdev17909#P#p20181128.MYI
Normal file
BIN
mysql-test/std_data/mdev17909#P#p20181128.MYI
Normal file
Binary file not shown.
BIN
mysql-test/std_data/mdev17909.frm
Normal file
BIN
mysql-test/std_data/mdev17909.frm
Normal file
Binary file not shown.
BIN
mysql-test/std_data/mdev17909.par
Normal file
BIN
mysql-test/std_data/mdev17909.par
Normal file
Binary file not shown.
@ -3,6 +3,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
|
||||
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
|
||||
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
|
||||
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
|
||||
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
|
||||
# Start server with keys2.txt
|
||||
SET GLOBAL innodb_file_per_table = ON;
|
||||
|
@ -1,6 +1,7 @@
|
||||
call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)");
|
||||
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
|
||||
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
|
||||
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1");
|
||||
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
|
||||
create table t5 (
|
||||
`intcol1` int(32) DEFAULT NULL,
|
||||
|
@ -1,6 +1,7 @@
|
||||
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
|
||||
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
|
||||
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
|
||||
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
|
||||
# Start server with keys2.txt
|
||||
CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19;
|
||||
CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
|
||||
|
@ -13,6 +13,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
|
||||
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)");
|
||||
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
|
||||
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
|
||||
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
|
||||
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
|
||||
|
||||
--echo # Start server with keys2.txt
|
||||
|
@ -10,6 +10,7 @@
|
||||
call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)");
|
||||
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
|
||||
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
|
||||
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1");
|
||||
|
||||
# Suppression for builds where file_key_management plugin is linked statically
|
||||
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
|
||||
|
@ -10,6 +10,7 @@
|
||||
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)");
|
||||
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
|
||||
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
|
||||
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
|
||||
|
||||
--echo # Start server with keys2.txt
|
||||
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
|
||||
|
33
mysql-test/suite/innodb/include/crc32.pl
Normal file
33
mysql-test/suite/innodb/include/crc32.pl
Normal file
@ -0,0 +1,33 @@
|
||||
# The following is Public Domain / Creative Commons CC0 from
|
||||
# http://billauer.co.il/blog/2011/05/perl-crc32-crc-xs-module/
|
||||
|
||||
sub mycrc32 {
|
||||
my ($input, $init_value, $polynomial) = @_;
|
||||
|
||||
$init_value = 0 unless (defined $init_value);
|
||||
$polynomial = 0xedb88320 unless (defined $polynomial);
|
||||
|
||||
my @lookup_table;
|
||||
|
||||
for (my $i=0; $i<256; $i++) {
|
||||
my $x = $i;
|
||||
for (my $j=0; $j<8; $j++) {
|
||||
if ($x & 1) {
|
||||
$x = ($x >> 1) ^ $polynomial;
|
||||
} else {
|
||||
$x = $x >> 1;
|
||||
}
|
||||
}
|
||||
push @lookup_table, $x;
|
||||
}
|
||||
|
||||
my $crc = $init_value ^ 0xffffffff;
|
||||
|
||||
foreach my $x (unpack ('C*', $input)) {
|
||||
$crc = (($crc >> 8) & 0xffffff) ^ $lookup_table[ ($crc ^ $x) & 0xff ];
|
||||
}
|
||||
|
||||
$crc = $crc ^ 0xffffffff;
|
||||
|
||||
return $crc;
|
||||
}
|
@ -77,7 +77,9 @@ t1_VARCHAR_500_BINARY VARCHAR(500) BINARY,
|
||||
t1_YEAR_2 YEAR(2),
|
||||
t1_YEAR_4 YEAR(4),
|
||||
t1_CHAR_0 CHAR(0),
|
||||
t1_MYSQL_0 CHAR(0) CHARACTER SET utf8
|
||||
t1_MYSQL_0 CHAR(0) CHARACTER SET utf8,
|
||||
t1_VARCHAR_0 VARCHAR(0),
|
||||
t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8
|
||||
) ENGINE=InnoDB;
|
||||
Warnings:
|
||||
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||
@ -151,10 +153,12 @@ t1_TINYINT DATA_INT
|
||||
t1_TINYINT_UNSIGNED DATA_INT UNSIGNED
|
||||
t1_TINYTEXT DATA_BLOB
|
||||
t1_VARBINARY_100 DATA_BINARY
|
||||
t1_VARCHAR_0 DATA_VARCHAR
|
||||
t1_VARCHAR_10 DATA_VARCHAR
|
||||
t1_VARCHAR_10_BINARY DATA_VARMYSQL
|
||||
t1_VARCHAR_500 DATA_VARCHAR
|
||||
t1_VARCHAR_500_BINARY DATA_VARMYSQL
|
||||
t1_VARMYSQL_0 DATA_VARMYSQL
|
||||
t1_YEAR_2 DATA_INT UNSIGNED
|
||||
t1_YEAR_4 DATA_INT UNSIGNED
|
||||
DROP TABLE t1;
|
||||
@ -164,3 +168,9 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0)
|
||||
#
|
||||
CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DROP TABLE t1;
|
||||
|
@ -75,3 +75,26 @@ connection default;
|
||||
ERROR 23000: Duplicate entry '1' for key 'a'
|
||||
SET DEBUG_SYNC='RESET';
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-17470 Orphan temporary files after interrupted ALTER
|
||||
# cause InnoDB: Operating system error number 17 and eventual
|
||||
# fatal error 71
|
||||
#
|
||||
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8);
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
LOCK TABLE t1 READ;
|
||||
connect con1,localhost,root,,test;
|
||||
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
|
||||
connection default;
|
||||
kill query @id;
|
||||
connection con1;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
disconnect con1;
|
||||
connection default;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
|
@ -879,6 +879,27 @@ NAME
|
||||
a
|
||||
b
|
||||
DROP TABLE t1;
|
||||
# and an MDEV-18041 regression related to indexes prefixes
|
||||
create table `test` (
|
||||
`test_old` varchar(255) NOT NULL,
|
||||
`other` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`test_old`,`other`),
|
||||
UNIQUE KEY uk (`test_old`(100), `other`)
|
||||
) ENGINE=InnoDB;
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
name pos
|
||||
test_old 0
|
||||
other 1
|
||||
test_old 0
|
||||
other 1
|
||||
alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
name pos
|
||||
test_new 0
|
||||
other 1
|
||||
test_new 0
|
||||
other 1
|
||||
drop table `test`;
|
||||
#
|
||||
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
|
||||
# DICT_MEM_TABLE_COL_RENAME_LOW
|
||||
|
@ -90,7 +90,9 @@ CREATE TABLE t1
|
||||
t1_YEAR_2 YEAR(2),
|
||||
t1_YEAR_4 YEAR(4),
|
||||
t1_CHAR_0 CHAR(0),
|
||||
t1_MYSQL_0 CHAR(0) CHARACTER SET utf8
|
||||
t1_MYSQL_0 CHAR(0) CHARACTER SET utf8,
|
||||
t1_VARCHAR_0 VARCHAR(0),
|
||||
t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 () VALUES ();
|
||||
@ -127,3 +129,10 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0)
|
||||
--echo #
|
||||
CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DROP TABLE t1;
|
||||
|
@ -98,5 +98,37 @@ SET DEBUG_SYNC='RESET';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17470 Orphan temporary files after interrupted ALTER
|
||||
--echo # cause InnoDB: Operating system error number 17 and eventual
|
||||
--echo # fatal error 71
|
||||
--echo #
|
||||
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8);
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
INSERT INTO t1 SELECT NULL, i FROM t1;
|
||||
|
||||
LOCK TABLE t1 READ;
|
||||
|
||||
--connect (con1,localhost,root,,test)
|
||||
let $ID= `SELECT @id := CONNECTION_ID()`;
|
||||
send ALTER TABLE t1 FORCE, ALGORITHM=COPY;
|
||||
|
||||
--connection default
|
||||
let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
|
||||
source include/wait_condition.inc;
|
||||
let $ignore= `SELECT @id := $ID`;
|
||||
kill query @id;
|
||||
--connection con1
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
--disconnect con1
|
||||
--connection default
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
@ -545,6 +545,19 @@ SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
|
||||
WHERE T.NAME='test/t1';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # and an MDEV-18041 regression related to indexes prefixes
|
||||
create table `test` (
|
||||
`test_old` varchar(255) NOT NULL,
|
||||
`other` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`test_old`,`other`),
|
||||
UNIQUE KEY uk (`test_old`(100), `other`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
|
||||
select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new');
|
||||
drop table `test`;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
|
||||
|
@ -0,0 +1,6 @@
|
||||
--innodb-encryption-rotate-key-age=2
|
||||
--innodb-encryption-threads=4
|
||||
--innodb-tablespaces-encryption
|
||||
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
|
||||
--loose-file-key-management
|
||||
--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt
|
@ -0,0 +1,7 @@
|
||||
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
|
||||
insert into t1(b, c) values("mariadb", "mariabackup");
|
||||
# Corrupt the table
|
||||
# xtrabackup backup
|
||||
FOUND 1 /Database page corruption detected.*/ in backup.log
|
||||
drop table t1;
|
48
mysql-test/suite/mariabackup/encrypted_page_compressed.test
Normal file
48
mysql-test/suite/mariabackup/encrypted_page_compressed.test
Normal file
@ -0,0 +1,48 @@
|
||||
source include/have_file_key_management.inc;
|
||||
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
|
||||
insert into t1(b, c) values("mariadb", "mariabackup");
|
||||
|
||||
let $MYSQLD_DATADIR=`select @@datadir`;
|
||||
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
|
||||
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
|
||||
|
||||
--source include/shutdown_mysqld.inc
|
||||
|
||||
--echo # Corrupt the table
|
||||
|
||||
perl;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Fcntl qw(:DEFAULT :seek);
|
||||
|
||||
my $ibd_file = $ENV{'t1_IBD'};
|
||||
|
||||
my $chunk;
|
||||
my $page_size = $ENV{'INNODB_PAGE_SIZE'};
|
||||
|
||||
sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
|
||||
sysseek IBD_FILE, $page_size * 3 + 75, SEEK_CUR;
|
||||
$chunk = '\xAA\xAA\xAA\xAA';
|
||||
syswrite IBD_FILE, $chunk, 4;
|
||||
|
||||
close IBD_FILE;
|
||||
EOF
|
||||
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
echo # xtrabackup backup;
|
||||
--disable_result_log
|
||||
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
|
||||
--error 1
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
|
||||
--enable_result_log
|
||||
|
||||
--let SEARCH_PATTERN=Database page corruption detected.*
|
||||
--let SEARCH_FILE=$backuplog
|
||||
--source include/search_pattern_in_file.inc
|
||||
remove_file $backuplog;
|
||||
|
||||
drop table t1;
|
||||
rmdir $targetdir;
|
@ -1,8 +1,8 @@
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
|
||||
CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
|
||||
insert into t1 select repeat('a',100);
|
||||
# Corrupt the table
|
||||
# xtrabackup backup
|
||||
FOUND 1 /Database page corruption detected/ in backup.log
|
||||
FOUND 1 /Database page corruption detected.*/ in backup.log
|
||||
drop table t1;
|
||||
|
@ -1,12 +1,13 @@
|
||||
--source include/have_file_key_management.inc
|
||||
--source include/innodb_page_size.inc
|
||||
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
|
||||
CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
|
||||
insert into t1 select repeat('a',100);
|
||||
|
||||
let $MYSQLD_DATADIR=`select @@datadir`;
|
||||
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
|
||||
let MYSQLD_DATADIR=`select @@datadir`;
|
||||
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
|
||||
|
||||
--source include/shutdown_mysqld.inc
|
||||
|
||||
@ -16,17 +17,29 @@ perl;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Fcntl qw(:DEFAULT :seek);
|
||||
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
|
||||
|
||||
my $ibd_file = $ENV{'t1_IBD'};
|
||||
my $page_size = $ENV{INNODB_PAGE_SIZE};
|
||||
|
||||
my $chunk;
|
||||
my $len;
|
||||
sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR
|
||||
|| die "Cannot open t1.ibd\n";
|
||||
sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n";
|
||||
my $space = unpack("x[34]N", $_);
|
||||
sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n";
|
||||
|
||||
sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
|
||||
sysseek IBD_FILE, 16384 * 3, SEEK_CUR;
|
||||
$chunk = '\xAA\xAA\xAA\xAA';
|
||||
syswrite IBD_FILE, $chunk, 4;
|
||||
my $head = pack("Nx[18]", 3); # better to have a valid page number
|
||||
my $body = chr(0) x ($page_size - 38 - 8);
|
||||
|
||||
# Calculate innodb_checksum_algorithm=crc32 for the unencrypted page.
|
||||
# The following bytes are excluded:
|
||||
# bytes 0..3 (the checksum is stored there)
|
||||
# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id)
|
||||
# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN)
|
||||
my $polynomial = 0x82f63b78; # CRC-32C
|
||||
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
||||
|
||||
my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck);
|
||||
die unless syswrite(IBD_FILE, $page, $page_size) == $page_size;
|
||||
close IBD_FILE;
|
||||
EOF
|
||||
|
||||
@ -38,14 +51,20 @@ let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
|
||||
|
||||
--disable_result_log
|
||||
--error 1
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir > $backuplog;
|
||||
--enable_result_log
|
||||
|
||||
|
||||
--let SEARCH_PATTERN=Database page corruption detected
|
||||
--let SEARCH_PATTERN=Database page corruption detected.*
|
||||
--let SEARCH_FILE=$backuplog
|
||||
--source include/search_pattern_in_file.inc
|
||||
remove_file $backuplog;
|
||||
rmdir $targetdir;
|
||||
|
||||
# Due to very constructed nature of the "corruption" (faking checksums), the "corruption" won't be found without --extended-validation
|
||||
--disable_result_log
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
|
||||
--enable_result_log
|
||||
|
||||
drop table t1;
|
||||
rmdir $targetdir;
|
||||
|
@ -1,4 +1,8 @@
|
||||
--innodb-encrypt-log=ON
|
||||
--innodb-tablespaces-encryption
|
||||
--innodb-encrypt-tables=ON
|
||||
--innodb-encryption-rotate-key-age=1
|
||||
--innodb-encryption-threads=4
|
||||
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
|
||||
--loose-file-key-management
|
||||
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key
|
||||
|
1
mysql-test/suite/mariabackup/partition_partial.opt
Normal file
1
mysql-test/suite/mariabackup/partition_partial.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb --loose-partition
|
31
mysql-test/suite/mariabackup/partition_partial.result
Normal file
31
mysql-test/suite/mariabackup/partition_partial.result
Normal file
@ -0,0 +1,31 @@
|
||||
CREATE TABLE t1(i INT) ENGINE INNODB
|
||||
PARTITION BY RANGE (i)
|
||||
(PARTITION p1 VALUES LESS THAN (100),
|
||||
PARTITION p2 VALUES LESS THAN (200),
|
||||
PARTITION p3 VALUES LESS THAN (300),
|
||||
PARTITION p4 VALUES LESS THAN (400));
|
||||
INSERT INTO t1 VALUES (1), (101), (201), (301);
|
||||
# xtrabackup backup
|
||||
INSERT INTO t1 VALUES (1), (101), (201), (301);
|
||||
# xtrabackup prepare
|
||||
CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
|
||||
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
||||
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
||||
ALTER TABLE t1 EXCHANGE PARTITION p4 WITH TABLE t1_placeholder;
|
||||
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
||||
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
||||
ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t1_placeholder;
|
||||
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
||||
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
||||
ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t1_placeholder;
|
||||
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
||||
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
||||
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t1_placeholder;
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
101
|
||||
201
|
||||
301
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1_placeholder;
|
44
mysql-test/suite/mariabackup/partition_partial.test
Normal file
44
mysql-test/suite/mariabackup/partition_partial.test
Normal file
@ -0,0 +1,44 @@
|
||||
#--source include/innodb_page_size.inc
|
||||
|
||||
# import partitioned table from table from partial backup
|
||||
|
||||
CREATE TABLE t1(i INT) ENGINE INNODB
|
||||
PARTITION BY RANGE (i)
|
||||
(PARTITION p1 VALUES LESS THAN (100),
|
||||
PARTITION p2 VALUES LESS THAN (200),
|
||||
PARTITION p3 VALUES LESS THAN (300),
|
||||
PARTITION p4 VALUES LESS THAN (400));
|
||||
|
||||
INSERT INTO t1 VALUES (1), (101), (201), (301);
|
||||
|
||||
echo # xtrabackup backup;
|
||||
|
||||
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||
--disable_result_log
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.t1" --target-dir=$targetdir;
|
||||
--enable_result_log
|
||||
INSERT INTO t1 VALUES (1), (101), (201), (301);
|
||||
|
||||
|
||||
echo # xtrabackup prepare;
|
||||
--disable_result_log
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
|
||||
--enable_result_log
|
||||
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
|
||||
let $i=4;
|
||||
while($i)
|
||||
{
|
||||
eval ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
||||
copy_file $targetdir/test/t1#P#p$i.cfg $MYSQLD_DATADIR/test/t1_placeholder.cfg;
|
||||
copy_file $targetdir/test/t1#P#p$i.ibd $MYSQLD_DATADIR/test/t1_placeholder.ibd;
|
||||
eval ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
||||
eval ALTER TABLE t1 EXCHANGE PARTITION p$i WITH TABLE t1_placeholder;
|
||||
dec $i;
|
||||
}
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1_placeholder;
|
||||
rmdir $targetdir;
|
@ -0,0 +1,11 @@
|
||||
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
|
||||
insert into t1(b, c) values("mariadb", "mariabackup");
|
||||
InnoDB 0 transactions not purged
|
||||
# Corrupt the table
|
||||
# xtrabackup backup
|
||||
FOUND 1 /Database page corruption detected.*/ in backup.log
|
||||
drop table t1;
|
||||
Warnings:
|
||||
Warning 192 Table test/t1 in file ./test/t1.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
|
@ -0,0 +1,50 @@
|
||||
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
|
||||
insert into t1(b, c) values("mariadb", "mariabackup");
|
||||
--source ../innodb/include/wait_all_purged.inc
|
||||
|
||||
let $MYSQLD_DATADIR=`select @@datadir`;
|
||||
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
|
||||
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
|
||||
|
||||
--source include/shutdown_mysqld.inc
|
||||
|
||||
--echo # Corrupt the table
|
||||
|
||||
perl;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Fcntl qw(:DEFAULT :seek);
|
||||
|
||||
my $ibd_file = $ENV{'t1_IBD'};
|
||||
|
||||
my $chunk;
|
||||
my $page_size = $ENV{'INNODB_PAGE_SIZE'};
|
||||
|
||||
sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
|
||||
sysseek IBD_FILE, 16384 * 3 + 75, SEEK_CUR;
|
||||
$chunk = '\xAA\xAA\xAA\xAA';
|
||||
syswrite IBD_FILE, $chunk, 4;
|
||||
|
||||
close IBD_FILE;
|
||||
EOF
|
||||
|
||||
--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
echo # xtrabackup backup;
|
||||
--disable_result_log
|
||||
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
|
||||
--error 1
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
|
||||
--enable_result_log
|
||||
|
||||
--let SEARCH_PATTERN=Database page corruption detected.*
|
||||
--let SEARCH_FILE=$backuplog
|
||||
--source include/search_pattern_in_file.inc
|
||||
remove_file $backuplog;
|
||||
|
||||
drop table t1;
|
||||
rmdir $targetdir;
|
@ -79,8 +79,25 @@ a
|
||||
-3
|
||||
1
|
||||
include/check_slave_no_error.inc
|
||||
connection slave;
|
||||
drop table t1, t2;
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
connection slave;
|
||||
include/check_slave_no_error.inc
|
||||
create database d;
|
||||
create database e;
|
||||
connection master;
|
||||
create database d;
|
||||
create database if not exists e;
|
||||
connection slave;
|
||||
include/check_slave_no_error.inc
|
||||
drop database d;
|
||||
drop database e;
|
||||
connection master;
|
||||
drop database d;
|
||||
drop database if exists e;
|
||||
connection slave;
|
||||
include/check_slave_no_error.inc
|
||||
SET @@global.slave_exec_mode= @old_slave_exec_mode;
|
||||
include/rpl_end.inc
|
||||
|
@ -77,9 +77,30 @@ SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
connection slave;
|
||||
drop table t1, t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_no_error.inc
|
||||
create database d;
|
||||
create database e;
|
||||
|
||||
connection master;
|
||||
create database d;
|
||||
create database if not exists e;
|
||||
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_no_error.inc
|
||||
drop database d;
|
||||
drop database e;
|
||||
|
||||
connection master;
|
||||
drop database d;
|
||||
drop database if exists e;
|
||||
sync_slave_with_master;
|
||||
--source include/check_slave_no_error.inc
|
||||
|
||||
SET @@global.slave_exec_mode= @old_slave_exec_mode;
|
||||
|
||||
|
@ -42,8 +42,8 @@ b1 b2
|
||||
0 0
|
||||
INSERT INTO t1 (b1,b2) VALUES ('a','b');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
|
||||
Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
|
||||
Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1
|
||||
Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1
|
||||
SELECT b1,b2 FROM t1;
|
||||
b1 b2
|
||||
-1 -2
|
||||
|
@ -16,3 +16,19 @@ select * from vcol_autoinc;
|
||||
pk v3
|
||||
1 1
|
||||
drop table vcol_autoinc;
|
||||
check table t1 for upgrade;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
flush tables;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`Date` datetime(6) NOT NULL,
|
||||
`Data` varbinary(2000) NOT NULL,
|
||||
`a` varchar(100) GENERATED ALWAYS AS (column_get(`Data`,1 as char(100) charset latin1)) VIRTUAL,
|
||||
PRIMARY KEY (`Date`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
PARTITION BY RANGE (to_days(`Date`))
|
||||
(PARTITION `p20181029` VALUES LESS THAN (737361) ENGINE = MyISAM,
|
||||
PARTITION `p20181128` VALUES LESS THAN (737391) ENGINE = MyISAM)
|
||||
drop table t1;
|
||||
|
@ -11,3 +11,18 @@ select * from vcol_autoinc;
|
||||
insert vcol_autoinc (pk) values (1);
|
||||
select * from vcol_autoinc;
|
||||
drop table vcol_autoinc;
|
||||
|
||||
#
|
||||
# MDEV-17909 Problem by MariaDB Update 10.1.32 -> 10.2.19 (Incorrect information in file: .frm)
|
||||
#
|
||||
source include/have_partition.inc;
|
||||
copy_file std_data/mdev17909#P#p20181029.MYD $datadir/test/t1#P#p20181029.MYD;
|
||||
copy_file std_data/mdev17909#P#p20181029.MYI $datadir/test/t1#P#p20181029.MYI;
|
||||
copy_file std_data/mdev17909#P#p20181128.MYD $datadir/test/t1#P#p20181128.MYD;
|
||||
copy_file std_data/mdev17909#P#p20181128.MYI $datadir/test/t1#P#p20181128.MYI;
|
||||
copy_file std_data/mdev17909.frm $datadir/test/t1.frm;
|
||||
copy_file std_data/mdev17909.par $datadir/test/t1.par;
|
||||
check table t1 for upgrade;
|
||||
flush tables;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
66
mysql-test/t/ps_error.test
Normal file
66
mysql-test/t/ps_error.test
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# Tests related to PS returning errors rather than doing successfull execution
|
||||
#
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS
|
||||
--echo #
|
||||
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
EXECUTE stmt;
|
||||
SELECT a FROM t1 GROUP BY NULL WITH ROLLUP;
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=DEFAULT;
|
||||
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
EXECUTE stmt;
|
||||
SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ;
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=DEFAULT;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS
|
||||
--echo #
|
||||
|
||||
SET SQL_MODE='STRICT_ALL_TABLES';
|
||||
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
EXECUTE stmt;
|
||||
--source include/restart_mysqld.inc
|
||||
SELECT 'All done';
|
||||
SET SQL_MODE=DEFAULT;
|
||||
|
||||
SET SQL_MODE='STRICT_ALL_TABLES';
|
||||
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
SELECT 'All done';
|
||||
SET SQL_MODE=DEFAULT;
|
||||
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
EXECUTE stmt;
|
||||
SELECT a FROM t1 GROUP BY a;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE=DEFAULT;
|
||||
|
||||
SET SQL_MODE= 'STRICT_ALL_TABLES';
|
||||
CREATE TABLE t1 (a INT);
|
||||
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
EXECUTE stmt;
|
||||
SELECT a FROM t1 GROUP BY a;
|
||||
INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq;
|
||||
DROP TABLE t1;
|
||||
SET SQL_MODE=DEFAULT;
|
@ -415,6 +415,12 @@ enum enum_alter_inplace_result {
|
||||
#define HA_KEY_NULL_LENGTH 1
|
||||
#define HA_KEY_BLOB_LENGTH 2
|
||||
|
||||
/* Maximum length of any index lookup key, in bytes */
|
||||
|
||||
#define MAX_KEY_LENGTH (MAX_DATA_LENGTH_FOR_KEY \
|
||||
+(MAX_REF_PARTS \
|
||||
*(HA_KEY_NULL_LENGTH + HA_KEY_BLOB_LENGTH)))
|
||||
|
||||
#define HA_LEX_CREATE_TMP_TABLE 1U
|
||||
#define HA_CREATE_TMP_ALTER 8U
|
||||
#define HA_LEX_CREATE_SEQUENCE 16U
|
||||
@ -3782,14 +3788,14 @@ public:
|
||||
uint max_key_parts() const
|
||||
{ return MY_MIN(MAX_REF_PARTS, max_supported_key_parts()); }
|
||||
uint max_key_length() const
|
||||
{ return MY_MIN(MAX_KEY_LENGTH, max_supported_key_length()); }
|
||||
{ return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_length()); }
|
||||
uint max_key_part_length() const
|
||||
{ return MY_MIN(MAX_KEY_LENGTH, max_supported_key_part_length()); }
|
||||
{ return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_part_length()); }
|
||||
|
||||
virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; }
|
||||
virtual uint max_supported_keys() const { return 0; }
|
||||
virtual uint max_supported_key_parts() const { return MAX_REF_PARTS; }
|
||||
virtual uint max_supported_key_length() const { return MAX_KEY_LENGTH; }
|
||||
virtual uint max_supported_key_length() const { return MAX_DATA_LENGTH_FOR_KEY; }
|
||||
virtual uint max_supported_key_part_length() const { return 255; }
|
||||
virtual uint min_record_length(uint options) const { return 1; }
|
||||
|
||||
|
@ -8220,7 +8220,9 @@ void Item_ref::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
if (ref)
|
||||
{
|
||||
if ((*ref)->type() != Item::CACHE_ITEM && ref_type() != VIEW_REF &&
|
||||
if ((*ref)->type() != Item::CACHE_ITEM &&
|
||||
(*ref)->type() != Item::WINDOW_FUNC_ITEM &&
|
||||
ref_type() != VIEW_REF &&
|
||||
!table_name && name.str && alias_name_used)
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
|
@ -3301,6 +3301,8 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
|
||||
if (item->maybe_null)
|
||||
func->maybe_null=1;
|
||||
func->with_sum_func= func->with_sum_func || item->with_sum_func;
|
||||
func->with_window_func= func->with_window_func ||
|
||||
item->with_window_func;
|
||||
func->with_field= func->with_field || item->with_field;
|
||||
func->with_param= func->with_param || item->with_param;
|
||||
func->With_subquery_cache::join(item);
|
||||
|
@ -2730,10 +2730,6 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
|
||||
{
|
||||
Field **field_ptr;
|
||||
TABLE *table= param->table;
|
||||
partition_info *part_info= NULL;
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
part_info= table->part_info;
|
||||
#endif
|
||||
uint parts= 0;
|
||||
|
||||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||
|
@ -1516,12 +1516,12 @@ bool partition_info::check_partition_field_length()
|
||||
|
||||
for (i= 0; i < num_part_fields; i++)
|
||||
store_length+= get_partition_field_store_length(part_field_array[i]);
|
||||
if (store_length > MAX_KEY_LENGTH)
|
||||
if (store_length > MAX_DATA_LENGTH_FOR_KEY)
|
||||
DBUG_RETURN(TRUE);
|
||||
store_length= 0;
|
||||
for (i= 0; i < num_subpart_fields; i++)
|
||||
store_length+= get_partition_field_store_length(subpart_field_array[i]);
|
||||
if (store_length > MAX_KEY_LENGTH)
|
||||
if (store_length > MAX_DATA_LENGTH_FOR_KEY)
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
@ -6609,7 +6609,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list,
|
||||
{
|
||||
List_iterator <LEX_USER> str_list (user_list);
|
||||
LEX_USER *Str, *tmp_Str;
|
||||
bool create_new_users= 0, result;
|
||||
bool create_new_users= 0;
|
||||
int result;
|
||||
const char *db_name, *table_name;
|
||||
DBUG_ENTER("mysql_routine_grant");
|
||||
|
||||
@ -7046,7 +7047,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
List_iterator <LEX_USER> str_list (list);
|
||||
LEX_USER *Str, *tmp_Str, *proxied_user= NULL;
|
||||
char tmp_db[SAFE_NAME_LEN+1];
|
||||
bool create_new_users=0, result;
|
||||
bool create_new_users=0;
|
||||
int result;
|
||||
DBUG_ENTER("mysql_grant");
|
||||
|
||||
if (lower_case_table_names && db)
|
||||
|
@ -33,7 +33,17 @@
|
||||
#define MAX_SYS_VAR_LENGTH 32
|
||||
#define MAX_KEY MAX_INDEXES /* Max used keys */
|
||||
#define MAX_REF_PARTS 32 /* Max parts used as ref */
|
||||
#define MAX_KEY_LENGTH 3072 /* max possible key */
|
||||
|
||||
/*
|
||||
Maximum length of the data part of an index lookup key.
|
||||
|
||||
The "data part" is defined as the value itself, not including the
|
||||
NULL-indicator bytes or varchar length bytes ("the Extras"). We need this
|
||||
value because there was a bug where length of the Extras were not counted.
|
||||
|
||||
You probably need MAX_KEY_LENGTH, not this constant.
|
||||
*/
|
||||
#define MAX_DATA_LENGTH_FOR_KEY 3072
|
||||
#if SIZEOF_OFF_T > 4
|
||||
#define MAX_REFLENGTH 8 /* Max length for record ref */
|
||||
#else
|
||||
|
@ -764,8 +764,7 @@ exit:
|
||||
}
|
||||
|
||||
|
||||
int mysql_create_db(THD *thd, const LEX_CSTRING *db,
|
||||
const DDL_options_st &options,
|
||||
int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options,
|
||||
const Schema_specification_st *create_info)
|
||||
{
|
||||
/*
|
||||
@ -773,6 +772,9 @@ int mysql_create_db(THD *thd, const LEX_CSTRING *db,
|
||||
to it, we need to use a copy to make execution prepared statement- safe.
|
||||
*/
|
||||
Schema_specification_st tmp(*create_info);
|
||||
if (thd->slave_thread &&
|
||||
slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
|
||||
options.add(DDL_options::OPT_IF_NOT_EXISTS);
|
||||
return mysql_create_db_internal(thd, db, options, &tmp, false);
|
||||
}
|
||||
|
||||
@ -1047,6 +1049,9 @@ exit:
|
||||
|
||||
bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists)
|
||||
{
|
||||
if (thd->slave_thread &&
|
||||
slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
|
||||
if_exists= true;
|
||||
return mysql_rm_db_internal(thd, db, if_exists, false);
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,7 @@
|
||||
|
||||
class THD;
|
||||
|
||||
int mysql_create_db(THD *thd, const LEX_CSTRING *db,
|
||||
const DDL_options_st &options,
|
||||
int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options,
|
||||
const Schema_specification_st *create);
|
||||
bool mysql_alter_db(THD *thd, const LEX_CSTRING *db,
|
||||
const Schema_specification_st *create);
|
||||
|
@ -565,7 +565,7 @@ void init_update_queries(void)
|
||||
sql_command_flags[SQLCOM_CREATE_PACKAGE_BODY]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
|
||||
sql_command_flags[SQLCOM_DROP_PACKAGE_BODY]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
|
||||
sql_command_flags[SQLCOM_ALTER_DB_UPGRADE]= CF_AUTO_COMMIT_TRANS;
|
||||
sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
|
||||
sql_command_flags[SQLCOM_ALTER_DB]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_DB_CHANGE;
|
||||
sql_command_flags[SQLCOM_RENAME_TABLE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
|
||||
sql_command_flags[SQLCOM_DROP_INDEX]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS | CF_REPORT_PROGRESS;
|
||||
sql_command_flags[SQLCOM_CREATE_VIEW]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
|
||||
@ -1486,7 +1486,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
|
||||
if (lex->sql_command == SQLCOM_DROP_TABLE && lex->tmp_table())
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
/* Check if we created or dropped databases */
|
||||
/* Check if we created, dropped, or renamed a database */
|
||||
if ((sql_command_flags[lex->sql_command] & CF_DB_CHANGE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
|
@ -20281,6 +20281,10 @@ test_if_quick_select(JOIN_TAB *tab)
|
||||
|
||||
delete tab->select->quick;
|
||||
tab->select->quick=0;
|
||||
|
||||
if (tab->table->file->inited != handler::NONE)
|
||||
tab->table->file->ha_index_or_rnd_end();
|
||||
|
||||
int res= tab->select->test_quick_select(tab->join->thd, tab->keys,
|
||||
(table_map) 0, HA_POS_ERROR, 0,
|
||||
FALSE, /*remove where parts*/FALSE);
|
||||
|
@ -10401,14 +10401,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
||||
error= 1;
|
||||
break;
|
||||
}
|
||||
if (to->next_number_field)
|
||||
{
|
||||
if (auto_increment_field_copied)
|
||||
to->auto_increment_field_not_null= TRUE;
|
||||
else
|
||||
to->next_number_field->reset();
|
||||
}
|
||||
|
||||
|
||||
for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++)
|
||||
{
|
||||
copy_ptr->do_copy(copy_ptr);
|
||||
@ -10446,6 +10439,13 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
||||
if (keep_versioned && to->versioned(VERS_TRX_ID))
|
||||
to->vers_write= false;
|
||||
|
||||
if (to->next_number_field)
|
||||
{
|
||||
if (auto_increment_field_copied)
|
||||
to->auto_increment_field_not_null= TRUE;
|
||||
else
|
||||
to->next_number_field->reset();
|
||||
}
|
||||
error= to->file->ha_write_row(to->record[0]);
|
||||
to->auto_increment_field_not_null= FALSE;
|
||||
if (unlikely(error))
|
||||
|
10
sql/table.cc
10
sql/table.cc
@ -1029,7 +1029,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
|
||||
while (pos < end)
|
||||
{
|
||||
uint type, expr_length;
|
||||
if (table->s->mysql_version >= 100202)
|
||||
if (table->s->frm_version >= FRM_VER_EXPRESSSIONS)
|
||||
{
|
||||
uint field_nr, name_length;
|
||||
/* see pack_expression() for how data is stored */
|
||||
@ -2270,7 +2270,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
uint pk_part_length= key_first_info->key_part[i].store_length;
|
||||
if (keyinfo->ext_key_part_map & 1<<i)
|
||||
{
|
||||
if (ext_key_length + pk_part_length > MAX_KEY_LENGTH)
|
||||
if (ext_key_length + pk_part_length > MAX_DATA_LENGTH_FOR_KEY)
|
||||
{
|
||||
add_keyparts_for_this_key= i;
|
||||
break;
|
||||
@ -2280,9 +2280,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
}
|
||||
}
|
||||
|
||||
if (add_keyparts_for_this_key < (keyinfo->ext_key_parts -
|
||||
keyinfo->user_defined_key_parts))
|
||||
{
|
||||
if (add_keyparts_for_this_key < keyinfo->ext_key_parts -
|
||||
keyinfo->user_defined_key_parts)
|
||||
{
|
||||
share->ext_key_parts-= keyinfo->ext_key_parts;
|
||||
key_part_map ext_key_part_map= keyinfo->ext_key_part_map;
|
||||
keyinfo->ext_key_parts= keyinfo->user_defined_key_parts;
|
||||
|
@ -1041,39 +1041,28 @@ TABLE *THD::find_temporary_table(const char *key, uint key_length,
|
||||
/* A matching TMP_TABLE_SHARE is found. */
|
||||
All_share_tables_list::Iterator tables_it(share->all_tmp_tables);
|
||||
|
||||
while ((table= tables_it++))
|
||||
bool found= false;
|
||||
while (!found && (table= tables_it++))
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case TMP_TABLE_IN_USE:
|
||||
if (table->query_id > 0)
|
||||
{
|
||||
result= table;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case TMP_TABLE_NOT_IN_USE:
|
||||
if (table->query_id == 0)
|
||||
{
|
||||
result= table;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case TMP_TABLE_ANY:
|
||||
{
|
||||
result= table;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
default: /* Invalid */
|
||||
DBUG_ASSERT(0);
|
||||
goto done;
|
||||
case TMP_TABLE_IN_USE: found= table->query_id > 0; break;
|
||||
case TMP_TABLE_NOT_IN_USE: found= table->query_id == 0; break;
|
||||
case TMP_TABLE_ANY: found= true; break;
|
||||
}
|
||||
}
|
||||
if (table && unlikely(table->m_needs_reopen))
|
||||
{
|
||||
share->all_tmp_tables.remove(table);
|
||||
free_temporary_table(table);
|
||||
it.rewind();
|
||||
continue;
|
||||
}
|
||||
result= table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (locked)
|
||||
{
|
||||
DBUG_ASSERT(m_tmp_tables_locked);
|
||||
@ -1154,8 +1143,7 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
|
||||
@return Success false
|
||||
Failure true
|
||||
*/
|
||||
bool THD::find_and_use_tmp_table(const TABLE_LIST *tl,
|
||||
TABLE **out_table)
|
||||
bool THD::find_and_use_tmp_table(const TABLE_LIST *tl, TABLE **out_table)
|
||||
{
|
||||
DBUG_ENTER("THD::find_and_use_tmp_table");
|
||||
|
||||
@ -1165,11 +1153,9 @@ bool THD::find_and_use_tmp_table(const TABLE_LIST *tl,
|
||||
|
||||
key_length= create_tmp_table_def_key(key, tl->get_db_name(),
|
||||
tl->get_table_name());
|
||||
result=
|
||||
use_temporary_table(find_temporary_table(key, key_length,
|
||||
TMP_TABLE_NOT_IN_USE),
|
||||
out_table);
|
||||
|
||||
result= use_temporary_table(find_temporary_table(key, key_length,
|
||||
TMP_TABLE_NOT_IN_USE),
|
||||
out_table);
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
@ -219,11 +219,11 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR prefix, LPCSTR name, LPCSTR dir);
|
||||
DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
|
||||
DllExport bool AllocSarea(PGLOBAL, uint);
|
||||
DllExport void FreeSarea(PGLOBAL);
|
||||
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
|
||||
DllExport BOOL PlugSubSet(void *, uint);
|
||||
DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
|
||||
DllExport char *PlugDup(PGLOBAL g, const char *str);
|
||||
DllExport void *MakePtr(void *, OFFSET);
|
||||
DllExport void htrc(char const *fmt, ...);
|
||||
//DllExport int GetTraceValue(void);
|
||||
DllExport uint GetTraceValue(void);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
@ -233,6 +233,6 @@ DllExport uint GetTraceValue(void);
|
||||
/***********************************************************************/
|
||||
/* Non exported routine declarations. */
|
||||
/***********************************************************************/
|
||||
void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
|
||||
//void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
|
||||
|
||||
/*-------------------------- End of Global.H --------------------------*/
|
||||
|
@ -4189,7 +4189,7 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
|
||||
rc= rnd_next(buf);
|
||||
} else {
|
||||
PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp);
|
||||
strcpy(g->Message, "Not supported by this table type");
|
||||
// strcpy(g->Message, "Not supported by this table type");
|
||||
my_message(ER_ILLEGAL_HA, g->Message, MYF(0));
|
||||
rc= HA_ERR_INTERNAL_ERROR;
|
||||
} // endif SetRecpos
|
||||
@ -7307,7 +7307,7 @@ maria_declare_plugin(connect)
|
||||
PLUGIN_LICENSE_GPL,
|
||||
connect_init_func, /* Plugin Init */
|
||||
connect_done_func, /* Plugin Deinit */
|
||||
0x0107, /* version number (1.05) */
|
||||
0x0106, /* version number (1.06) */
|
||||
NULL, /* status variables */
|
||||
connect_system_variables, /* system variables */
|
||||
"1.06.0008", /* string version */
|
||||
|
@ -3056,7 +3056,7 @@ my_bool json_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
||||
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR);
|
||||
g->N = (int)n;
|
||||
return false;
|
||||
@ -3099,7 +3099,7 @@ void json_array_grp_clear(UDF_INIT *initid, char*, char*)
|
||||
{
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR);
|
||||
g->N = GetJsonGroupSize();
|
||||
} // end of json_array_grp_clear
|
||||
@ -3133,7 +3133,7 @@ my_bool json_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
|
||||
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB);
|
||||
g->N = (int)n;
|
||||
return false;
|
||||
@ -3170,7 +3170,7 @@ void json_object_grp_clear(UDF_INIT *initid, char*, char*)
|
||||
{
|
||||
PGLOBAL g = (PGLOBAL)initid->ptr;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB);
|
||||
g->N = GetJsonGroupSize();
|
||||
} // end of json_object_grp_clear
|
||||
@ -4419,7 +4419,7 @@ char *json_file(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
||||
} else if (initid->const_item)
|
||||
g->N = 1;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
fn = MakePSZ(g, args, 0);
|
||||
|
||||
if (args->arg_count > 1) {
|
||||
@ -5663,7 +5663,7 @@ char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result,
|
||||
if (bsp && !bsp->Changed)
|
||||
goto fin;
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Xchk = NULL;
|
||||
fn = MakePSZ(g, args, 0);
|
||||
pretty = (args->arg_count > 2 && args->args[2]) ? (int)*(longlong*)args->args[2] : 3;
|
||||
|
@ -8,12 +8,19 @@ SELECT * FROM t2 WHERE command = 'drop table employee';
|
||||
command number message
|
||||
drop table employee 0 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
|
||||
|
||||
Warnings:
|
||||
Warning 1105 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
|
||||
|
||||
SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary number(8,2))';
|
||||
command number message
|
||||
create table employee (id int not null, name varchar(32), title char(16), salary number(8,2)) 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)";
|
||||
command number message
|
||||
insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables
|
||||
CONNECTION='jdbc:oracle:thin:@localhost:1521:xe'
|
||||
OPTION_LIST='User=system,Password=manager';
|
||||
@ -27,8 +34,8 @@ OPTION_LIST='User=system,Password=manager';
|
||||
SELECT * FROM t1;
|
||||
Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks
|
||||
NULL SYSTEM EMPLOYEE ID 3 NUMBER 38 0 0 10 0 NULL
|
||||
NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 0 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 0 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 NULL 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 NULL 10 1 NULL
|
||||
NULL SYSTEM EMPLOYEE SALARY 3 NUMBER 8 0 2 10 1 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE SERVER 'oracle' FOREIGN DATA WRAPPER 'oracle.jdbc.driver.OracleDriver' OPTIONS (
|
||||
@ -52,7 +59,7 @@ Note 1105 EMPLOYEE: 1 affected rows
|
||||
SELECT * FROM t1;
|
||||
ID NAME TITLE SALARY
|
||||
4567 Trump Engineer 12560.50
|
||||
6214 Clinton Retired 0.00
|
||||
6214 Clinton Retired NULL
|
||||
DELETE FROM t1 WHERE id = 6214;
|
||||
Warnings:
|
||||
Note 1105 EMPLOYEE: 1 affected rows
|
||||
@ -63,8 +70,7 @@ DROP TABLE t1;
|
||||
SELECT * FROM t2 WHERE command = 'drop table employee';
|
||||
command number message
|
||||
drop table employee 0 Affected rows
|
||||
Warnings:
|
||||
Warning 1105 Affected rows
|
||||
DROP TABLE t2;
|
||||
DROP SERVER 'oracle';
|
||||
SET GLOBAL connect_jvm_path=NULL;
|
||||
SET GLOBAL connect_class_path=NULL;
|
||||
SET GLOBAL time_zone = SYSTEM;
|
||||
|
@ -514,27 +514,31 @@ void FreeSarea(PGLOBAL g)
|
||||
/* Here there should be some verification done such as validity of */
|
||||
/* the address and size not larger than memory size. */
|
||||
/***********************************************************************/
|
||||
BOOL PlugSubSet(PGLOBAL g __attribute__((unused)), void *memp, uint size)
|
||||
BOOL PlugSubSet(void *memp, uint size)
|
||||
{
|
||||
PPOOLHEADER pph = (PPOOLHEADER)memp;
|
||||
|
||||
pph->To_Free = (OFFSET)sizeof(POOLHEADER);
|
||||
pph->FreeBlk = size - pph->To_Free;
|
||||
|
||||
return FALSE;
|
||||
} /* end of PlugSubSet */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Use it to export a function that do throwing. */
|
||||
/***********************************************************************/
|
||||
void *DoThrow(int n)
|
||||
{
|
||||
throw n;
|
||||
} /* end of DoThrow */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Program for sub-allocating one item in a storage area. */
|
||||
/* Note: SubAlloc routines of OS/2 are no more used to increase the */
|
||||
/* code portability and avoid problems when a grammar compiled under */
|
||||
/* one version of OS/2 is used under another version. */
|
||||
/* The simple way things are done here is also based on the fact */
|
||||
/* that no freeing of suballocated blocks is permitted in Plug. */
|
||||
/* The simple way things are done here is based on the fact */
|
||||
/* that no freeing of suballocated blocks is permitted in CONNECT. */
|
||||
/***********************************************************************/
|
||||
void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
|
||||
{
|
||||
PPOOLHEADER pph; /* Points on area header. */
|
||||
{
|
||||
PPOOLHEADER pph; /* Points on area header. */
|
||||
|
||||
if (!memp)
|
||||
/*******************************************************************/
|
||||
@ -559,8 +563,8 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
|
||||
if (trace(1))
|
||||
htrc("PlugSubAlloc: %s\n", g->Message);
|
||||
|
||||
throw 1234;
|
||||
} /* endif size OS32 code */
|
||||
DoThrow(1234);
|
||||
} /* endif size OS32 code */
|
||||
|
||||
/*********************************************************************/
|
||||
/* Do the suballocation the simplest way. */
|
||||
@ -574,7 +578,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
|
||||
memp, pph->To_Free, pph->FreeBlk);
|
||||
|
||||
return (memp);
|
||||
} /* end of PlugSubAlloc */
|
||||
} /* end of PlugSubAlloc */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Program for sub-allocating and copying a string in a storage area. */
|
||||
|
@ -522,8 +522,15 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
|
||||
|
||||
// Get the function returning an instance of the external DEF class
|
||||
if (!(getdef = (XGETDEF)GetProcAddress((HINSTANCE)Hdll, getname))) {
|
||||
sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname);
|
||||
FreeLibrary((HMODULE)Hdll);
|
||||
char buf[256];
|
||||
DWORD rc = GetLastError();
|
||||
|
||||
sprintf(g->Message, MSG(PROCADD_ERROR), rc, getname);
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
|
||||
(LPTSTR)buf, sizeof(buf), NULL);
|
||||
strcat(strcat(g->Message, ": "), buf);
|
||||
FreeLibrary((HMODULE)Hdll);
|
||||
return NULL;
|
||||
} // endif getdef
|
||||
#else // !__WIN__
|
||||
|
@ -13,7 +13,7 @@ typedef class TDBFMT *PTDBFMT;
|
||||
/***********************************************************************/
|
||||
/* Functions used externally. */
|
||||
/***********************************************************************/
|
||||
PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info);
|
||||
DllExport PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info);
|
||||
|
||||
/***********************************************************************/
|
||||
/* CSV table. */
|
||||
|
@ -299,7 +299,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
|
||||
memset(G, 0, sizeof(GLOBAL));
|
||||
G->Sarea_Size = tdp->Lrecl * 10;
|
||||
G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size);
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
G->jump_level = 0;
|
||||
tjnp->SetG(G);
|
||||
|
||||
@ -670,7 +670,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
|
||||
memset(G, 0, sizeof(GLOBAL));
|
||||
G->Sarea_Size = Lrecl * 10;
|
||||
G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size);
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
G->jump_level = 0;
|
||||
((TDBJSN*)tdbp)->G = G;
|
||||
} else {
|
||||
@ -963,7 +963,7 @@ int TDBJSN::ReadDB(PGLOBAL g)
|
||||
return rc;
|
||||
|
||||
// Recover the memory used for parsing
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
|
||||
if ((Row = ParseJson(G, To_Line, strlen(To_Line), &Pretty, &Comma))) {
|
||||
Row = FindRow(g);
|
||||
@ -1079,13 +1079,13 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
|
||||
} // end of PrepareWriting
|
||||
|
||||
/***********************************************************************/
|
||||
/* WriteDB: Data Base write routine for DOS access method. */
|
||||
/* WriteDB: Data Base write routine for JSON access method. */
|
||||
/***********************************************************************/
|
||||
int TDBJSN::WriteDB(PGLOBAL g)
|
||||
{
|
||||
int rc = TDBDOS::WriteDB(g);
|
||||
|
||||
PlugSubSet(G, G->Sarea, G->Sarea_Size);
|
||||
PlugSubSet(G->Sarea, G->Sarea_Size);
|
||||
Row->Clear();
|
||||
return rc;
|
||||
} // end of WriteDB
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*************** tabjson H Declares Source Code File (.H) **************/
|
||||
/* Name: tabjson.h Version 1.3 */
|
||||
/* */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2018 */
|
||||
/* */
|
||||
/* This file contains the JSON classes declares. */
|
||||
/***********************************************************************/
|
||||
#include "osutil.h"
|
||||
//#include "osutil.h" // Unuseful and bad for OEM
|
||||
#include "block.h"
|
||||
#include "colblk.h"
|
||||
#include "json.h"
|
||||
@ -16,7 +16,7 @@ typedef class JSONDEF *PJDEF;
|
||||
typedef class TDBJSON *PJTDB;
|
||||
typedef class JSONCOL *PJCOL;
|
||||
class TDBJSN;
|
||||
PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info);
|
||||
DllExport PQRYRES JSONColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
|
||||
|
||||
/***********************************************************************/
|
||||
/* The JSON tree node. Can be an Object or an Array. */
|
||||
|
@ -5,7 +5,7 @@
|
||||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2000-2017 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2000-2018 */
|
||||
/* */
|
||||
/* WHAT THIS PROGRAM DOES: */
|
||||
/* ----------------------- */
|
||||
@ -95,23 +95,23 @@ bool ExactInfo(void);
|
||||
/* Constructor. */
|
||||
/***********************************************************************/
|
||||
ODBCDEF::ODBCDEF(void)
|
||||
{
|
||||
{
|
||||
Connect = NULL;
|
||||
Catver = 0;
|
||||
UseCnc = false;
|
||||
} // end of ODBCDEF constructor
|
||||
} // end of ODBCDEF constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* DefineAM: define specific AM block values from XDB file. */
|
||||
/***********************************************************************/
|
||||
bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
{
|
||||
Desc = Connect = GetStringCatInfo(g, "Connect", NULL);
|
||||
|
||||
if (!Connect && !Catfunc) {
|
||||
sprintf(g->Message, "Missing connection for ODBC table %s", Name);
|
||||
return true;
|
||||
} // endif Connect
|
||||
} // endif Connect
|
||||
|
||||
if (EXTDEF::DefineAM(g, am, poff))
|
||||
return true;
|
||||
@ -123,13 +123,13 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT);
|
||||
UseCnc = GetBoolCatInfo("UseDSN", false);
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
} // end of DefineAM
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetTable: makes a new Table Description Block. */
|
||||
/***********************************************************************/
|
||||
PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
|
||||
{
|
||||
{
|
||||
PTDB tdbp = NULL;
|
||||
|
||||
/*********************************************************************/
|
||||
@ -158,10 +158,10 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
|
||||
tdbp = new(g) TDBMUL(tdbp);
|
||||
else if (Multiple == 2)
|
||||
strcpy(g->Message, MSG(NO_ODBC_MUL));
|
||||
} // endswitch Catfunc
|
||||
} // endswitch Catfunc
|
||||
|
||||
return tdbp;
|
||||
} // end of GetTable
|
||||
} // end of GetTable
|
||||
|
||||
/* -------------------------- Class TDBODBC -------------------------- */
|
||||
|
||||
@ -169,7 +169,7 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
|
||||
/* Implementation of the TDBODBC class. */
|
||||
/***********************************************************************/
|
||||
TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp)
|
||||
{
|
||||
{
|
||||
Ocp = NULL;
|
||||
Cnp = NULL;
|
||||
|
||||
@ -191,19 +191,19 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp)
|
||||
Ops.UseCnc = false;
|
||||
} // endif tdp
|
||||
|
||||
} // end of TDBODBC standard constructor
|
||||
} // end of TDBODBC standard constructor
|
||||
|
||||
TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBEXT(tdbp)
|
||||
{
|
||||
{
|
||||
Ocp = tdbp->Ocp; // is that right ?
|
||||
Cnp = tdbp->Cnp;
|
||||
Connect = tdbp->Connect;
|
||||
Ops = tdbp->Ops;
|
||||
} // end of TDBODBC copy constructor
|
||||
} // end of TDBODBC copy constructor
|
||||
|
||||
// Method
|
||||
PTDB TDBODBC::Clone(PTABS t)
|
||||
{
|
||||
{
|
||||
PTDB tp;
|
||||
PODBCCOL cp1, cp2;
|
||||
PGLOBAL g = t->G; // Is this really useful ???
|
||||
@ -213,18 +213,18 @@ PTDB TDBODBC::Clone(PTABS t)
|
||||
for (cp1 = (PODBCCOL)Columns; cp1; cp1 = (PODBCCOL)cp1->GetNext()) {
|
||||
cp2 = new(g) ODBCCOL(cp1, tp); // Make a copy
|
||||
NewPointer(t, cp1, cp2);
|
||||
} // endfor cp1
|
||||
} // endfor cp1
|
||||
|
||||
return tp;
|
||||
} // end of CopyOne
|
||||
} // end of CopyOne
|
||||
|
||||
/***********************************************************************/
|
||||
/* Allocate ODBC column description block. */
|
||||
/***********************************************************************/
|
||||
PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
||||
{
|
||||
{
|
||||
return new(g) ODBCCOL(cdp, this, cprec, n);
|
||||
} // end of MakeCol
|
||||
} // end of MakeCol
|
||||
|
||||
/***********************************************************************/
|
||||
/* Extract the filename from connect string and return it. */
|
||||
@ -232,7 +232,7 @@ PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
||||
/* with a place holder to be used by SetFile. */
|
||||
/***********************************************************************/
|
||||
PCSZ TDBODBC::GetFile(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (Connect) {
|
||||
char *p1, *p2;
|
||||
int i;
|
||||
@ -263,18 +263,18 @@ PCSZ TDBODBC::GetFile(PGLOBAL g)
|
||||
memcpy(MulConn, Connect, p1 - Connect);
|
||||
MulConn[p1 - Connect] = '\0';
|
||||
strcat(strcat(MulConn, "%s"), (p2) ? p2 : ";");
|
||||
} // endif p1
|
||||
} // endif p1
|
||||
|
||||
} // endif Connect
|
||||
} // endif Connect
|
||||
|
||||
return (DBQ) ? DBQ : (PSZ)"???";
|
||||
} // end of GetFile
|
||||
} // end of GetFile
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set DBQ and get the new file name into the connect string. */
|
||||
/***********************************************************************/
|
||||
void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
|
||||
{
|
||||
{
|
||||
if (MulConn) {
|
||||
int n = strlen(MulConn) + strlen(fn) - 1;
|
||||
|
||||
@ -283,20 +283,20 @@ void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
|
||||
// of having to reallocate it is reduced.
|
||||
BufSize = n + 6;
|
||||
Connect = (char*)PlugSubAlloc(g, NULL, BufSize);
|
||||
} // endif n
|
||||
} // endif n
|
||||
|
||||
// Make the complete connect string
|
||||
sprintf(Connect, MulConn, fn);
|
||||
} // endif MultConn
|
||||
} // endif MultConn
|
||||
|
||||
DBQ = PlugDup(g, fn);
|
||||
} // end of SetFile
|
||||
} // end of SetFile
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeInsert: make the Insert statement used with ODBC connection. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::MakeInsert(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PCSZ schmp = NULL;
|
||||
char *catp = NULL, buf[NAM_LEN * 3];
|
||||
int len = 0;
|
||||
@ -377,7 +377,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
|
||||
} else
|
||||
Query->Append(buf);
|
||||
|
||||
} // endfor colp
|
||||
} // endfor colp
|
||||
|
||||
Query->Append(") VALUES (");
|
||||
|
||||
@ -390,32 +390,32 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
|
||||
Query->RepLast(')');
|
||||
|
||||
return oom;
|
||||
} // end of MakeInsert
|
||||
} // end of MakeInsert
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Bind Parameter function. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::BindParameters(PGLOBAL g)
|
||||
{
|
||||
PODBCCOL colp;
|
||||
{
|
||||
PODBCCOL colp;
|
||||
|
||||
for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
|
||||
colp->AllocateBuffers(g, 0);
|
||||
for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
|
||||
colp->AllocateBuffers(g, 0);
|
||||
|
||||
if (Ocp->BindParam(colp))
|
||||
return true;
|
||||
if (Ocp->BindParam(colp))
|
||||
return true;
|
||||
|
||||
} // endfor colp
|
||||
} // endfor colp
|
||||
|
||||
return false;
|
||||
} // end of BindParameters
|
||||
return false;
|
||||
} // end of BindParameters
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* MakeUpdate: make the SQL statement to send to ODBC connection. */
|
||||
/***********************************************************************/
|
||||
char *TDBODBC::MakeUpdate(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
char *qc, *stmt = NULL, cmd[8], tab[96], end[1024];
|
||||
|
||||
stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
|
||||
@ -440,60 +440,60 @@ char *TDBODBC::MakeUpdate(PGLOBAL g)
|
||||
|
||||
strcat(stmt, end);
|
||||
return stmt;
|
||||
} // end of MakeUpdate
|
||||
} // end of MakeUpdate
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeDelete: make the SQL statement to send to ODBC connection. */
|
||||
/***********************************************************************/
|
||||
char *TDBODBC::MakeDelete(PGLOBAL g)
|
||||
{
|
||||
char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512];
|
||||
{
|
||||
char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512];
|
||||
|
||||
stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
|
||||
memset(end, 0, sizeof(end));
|
||||
stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64);
|
||||
memset(end, 0, sizeof(end));
|
||||
|
||||
if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 ||
|
||||
sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2)
|
||||
qc = Ocp->GetQuoteChar();
|
||||
else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
|
||||
qc = (Quoted) ? Quote : "";
|
||||
else {
|
||||
strcpy(g->Message, "Cannot use this DELETE command");
|
||||
return NULL;
|
||||
} // endif sscanf
|
||||
if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 ||
|
||||
sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2)
|
||||
qc = Ocp->GetQuoteChar();
|
||||
else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2)
|
||||
qc = (Quoted) ? Quote : "";
|
||||
else {
|
||||
strcpy(g->Message, "Cannot use this DELETE command");
|
||||
return NULL;
|
||||
} // endif sscanf
|
||||
|
||||
assert(!stricmp(cmd, "delete") && !stricmp(from, "from"));
|
||||
strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc);
|
||||
assert(!stricmp(cmd, "delete") && !stricmp(from, "from"));
|
||||
strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc);
|
||||
|
||||
if (*end) {
|
||||
for (int i = 0; end[i]; i++)
|
||||
if (end[i] == '`')
|
||||
end[i] = *qc;
|
||||
if (*end) {
|
||||
for (int i = 0; end[i]; i++)
|
||||
if (end[i] == '`')
|
||||
end[i] = *qc;
|
||||
|
||||
strcat(stmt, end);
|
||||
} // endif end
|
||||
strcat(stmt, end);
|
||||
} // endif end
|
||||
|
||||
return stmt;
|
||||
} // end of MakeDelete
|
||||
return stmt;
|
||||
} // end of MakeDelete
|
||||
#endif // 0
|
||||
|
||||
/***********************************************************************/
|
||||
/* ResetSize: call by TDBMUL when calculating size estimate. */
|
||||
/***********************************************************************/
|
||||
void TDBODBC::ResetSize(void)
|
||||
{
|
||||
{
|
||||
MaxSize = -1;
|
||||
|
||||
if (Ocp && Ocp->IsOpen())
|
||||
Ocp->Close();
|
||||
|
||||
} // end of ResetSize
|
||||
} // end of ResetSize
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Cardinality: returns table size in number of rows. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::Cardinality(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (!g)
|
||||
return (Mode == MODE_ANY && !Srcdef) ? 1 : 0;
|
||||
|
||||
@ -526,7 +526,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
|
||||
Cardinal = 10; // To make MySQL happy
|
||||
|
||||
return Cardinal;
|
||||
} // end of Cardinality
|
||||
} // end of Cardinality
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Access Method opening routine. */
|
||||
@ -535,7 +535,7 @@ int TDBODBC::Cardinality(PGLOBAL g)
|
||||
/* join block of next table if it exists or else are discarted. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
bool rc = true;
|
||||
|
||||
if (trace(1))
|
||||
@ -571,7 +571,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
Fpos = 0;
|
||||
Curpos = 1;
|
||||
return false;
|
||||
} // endif use
|
||||
} // endif use
|
||||
|
||||
/*********************************************************************/
|
||||
/* Open an ODBC connection for this table. */
|
||||
@ -593,7 +593,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
Use = USE_OPEN; // Do it now in case we are recursively called
|
||||
|
||||
/*********************************************************************/
|
||||
/* Make the command and allocate whatever is used for getting results. */
|
||||
/* Make the command and allocate whatever is used for getting results*/
|
||||
/*********************************************************************/
|
||||
if (Mode == MODE_READ || Mode == MODE_READX) {
|
||||
if (Memory > 1 && !Srcdef) {
|
||||
@ -624,7 +624,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
} else
|
||||
return true;
|
||||
|
||||
} // endif Memory
|
||||
} // endif Memory
|
||||
|
||||
if (!(rc = MakeSQL(g, false))) {
|
||||
for (PODBCCOL colp = (PODBCCOL)Columns; colp;
|
||||
@ -635,7 +635,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
rc = (Mode == MODE_READ)
|
||||
? ((Rows = Ocp->ExecDirectSQL(Query->GetStr(), (PODBCCOL)Columns)) < 0)
|
||||
: false;
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
} else if (Mode == MODE_INSERT) {
|
||||
if (!(rc = MakeInsert(g))) {
|
||||
@ -645,7 +645,7 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
} else
|
||||
rc = BindParameters(g);
|
||||
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
} else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
|
||||
rc = false; // wait for CheckCond before calling MakeCommand(g);
|
||||
@ -655,30 +655,30 @@ bool TDBODBC::OpenDB(PGLOBAL g)
|
||||
if (rc) {
|
||||
Ocp->Close();
|
||||
return true;
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
/*********************************************************************/
|
||||
/* Reset statistics values. */
|
||||
/*********************************************************************/
|
||||
num_read = num_there = num_eq[0] = num_eq[1] = 0;
|
||||
return false;
|
||||
} // end of OpenDB
|
||||
} // end of OpenDB
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* GetRecpos: return the position of last read record. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::GetRecpos(void)
|
||||
{
|
||||
{
|
||||
return Fpos;
|
||||
} // end of GetRecpos
|
||||
} // end of GetRecpos
|
||||
#endif // 0
|
||||
|
||||
/***********************************************************************/
|
||||
/* SetRecpos: set the position of next read record. */
|
||||
/***********************************************************************/
|
||||
bool TDBODBC::SetRecpos(PGLOBAL g, int recpos)
|
||||
{
|
||||
{
|
||||
if (Ocp->m_Full) {
|
||||
Fpos = 0;
|
||||
CurNum = recpos - 1;
|
||||
@ -696,14 +696,15 @@ bool TDBODBC::SetRecpos(PGLOBAL g, int recpos)
|
||||
} // endif recpos
|
||||
|
||||
} else {
|
||||
strcpy(g->Message, "This action requires a scrollable cursor");
|
||||
strcpy(g->Message,
|
||||
"This action requires Memory setting or a scrollable cursor");
|
||||
return true;
|
||||
} // endif's
|
||||
|
||||
// Indicate the table position was externally set
|
||||
Placed = true;
|
||||
return false;
|
||||
} // end of SetRecpos
|
||||
} // end of SetRecpos
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base indexed read routine for ODBC access method. */
|
||||
@ -721,7 +722,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
||||
Rows = Ocp->ExecDirectSQL((char*)Query->GetStr(), (PODBCCOL)Columns);
|
||||
Mode = MODE_READ;
|
||||
return (Rows < 0);
|
||||
} // endif key
|
||||
} // endif key
|
||||
|
||||
return false;
|
||||
} else {
|
||||
@ -737,7 +738,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
||||
if ((To_CondFil = hc->CheckCond(g, To_CondFil, Cond)))
|
||||
PlugSubAlloc(g, NULL, strlen(To_CondFil->Body) + 1);
|
||||
|
||||
} // endif active_index
|
||||
} // endif active_index
|
||||
|
||||
if (To_CondFil)
|
||||
if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) {
|
||||
@ -762,7 +763,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr)
|
||||
/* VRDNDOS: Data Base read routine for odbc access method. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::ReadDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (trace(2))
|
||||
@ -784,7 +785,7 @@ int TDBODBC::ReadDB(PGLOBAL g)
|
||||
} else
|
||||
return RC_FX; // Error
|
||||
|
||||
} // endif Mode
|
||||
} // endif Mode
|
||||
|
||||
/*********************************************************************/
|
||||
/* Now start the reading process. */
|
||||
@ -813,7 +814,7 @@ int TDBODBC::ReadDB(PGLOBAL g)
|
||||
Qrp->Nblin++;
|
||||
|
||||
Fpos++; // Used for memory and pos
|
||||
} // endif rc
|
||||
} // endif rc
|
||||
|
||||
} // endif Placed
|
||||
|
||||
@ -821,13 +822,13 @@ int TDBODBC::ReadDB(PGLOBAL g)
|
||||
htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc);
|
||||
|
||||
return rc;
|
||||
} // end of ReadDB
|
||||
} // end of ReadDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base Insert write routine for ODBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::WriteDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
int n = Ocp->ExecuteSQL();
|
||||
|
||||
if (n < 0) {
|
||||
@ -837,13 +838,13 @@ int TDBODBC::WriteDB(PGLOBAL g)
|
||||
AftRows += n;
|
||||
|
||||
return RC_OK;
|
||||
} // end of WriteDB
|
||||
} // end of WriteDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base delete line routine for ODBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBODBC::DeleteDB(PGLOBAL g, int irc)
|
||||
{
|
||||
{
|
||||
if (irc == RC_FX) {
|
||||
if (!Query && MakeCommand(g))
|
||||
return RC_FX;
|
||||
@ -863,13 +864,13 @@ int TDBODBC::DeleteDB(PGLOBAL g, int irc)
|
||||
} else
|
||||
return RC_OK; // Ignore
|
||||
|
||||
} // end of DeleteDB
|
||||
} // end of DeleteDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base close routine for ODBC access method. */
|
||||
/***********************************************************************/
|
||||
void TDBODBC::CloseDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (Ocp)
|
||||
|
||||
Ocp->Close();
|
||||
@ -877,7 +878,7 @@ void TDBODBC::CloseDB(PGLOBAL g)
|
||||
if (trace(1))
|
||||
htrc("ODBC CloseDB: closing %s\n", Name);
|
||||
|
||||
} // end of CloseDB
|
||||
} // end of CloseDB
|
||||
|
||||
/* --------------------------- ODBCCOL ------------------------------- */
|
||||
|
||||
@ -886,33 +887,33 @@ void TDBODBC::CloseDB(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
|
||||
: EXTCOL(cdp, tdbp, cprec, i, am)
|
||||
{
|
||||
{
|
||||
// Set additional ODBC access method information for column.
|
||||
Slen = 0;
|
||||
StrLen = &Slen;
|
||||
Sqlbuf = NULL;
|
||||
} // end of ODBCCOL constructor
|
||||
} // end of ODBCCOL constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBCCOL private constructor. */
|
||||
/***********************************************************************/
|
||||
ODBCCOL::ODBCCOL(void) : EXTCOL()
|
||||
{
|
||||
{
|
||||
Slen = 0;
|
||||
StrLen = &Slen;
|
||||
Sqlbuf = NULL;
|
||||
} // end of ODBCCOL constructor
|
||||
} // end of ODBCCOL constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBCCOL constructor used for copying columns. */
|
||||
/* tdbp is the pointer to the new table descriptor. */
|
||||
/***********************************************************************/
|
||||
ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
|
||||
{
|
||||
{
|
||||
Slen = col1->Slen;
|
||||
StrLen = col1->StrLen;
|
||||
Sqlbuf = col1->Sqlbuf;
|
||||
} // end of ODBCCOL copy constructor
|
||||
} // end of ODBCCOL copy constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ReadColumn: when SQLFetch is used there is nothing to do as the */
|
||||
@ -920,7 +921,7 @@ ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp)
|
||||
/* when calculating MaxSize (Bufp is NULL even when Rows is not). */
|
||||
/***********************************************************************/
|
||||
void ODBCCOL::ReadColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PTDBODBC tdbp = (PTDBODBC)To_Tdb;
|
||||
int i = tdbp->Fpos - 1, n = tdbp->CurNum;
|
||||
|
||||
@ -953,7 +954,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
||||
else
|
||||
Value->SetValue_pvblk(Blkp, n);
|
||||
|
||||
} // endif Bufp
|
||||
} // endif Bufp
|
||||
|
||||
if (Buf_Type == TYPE_DATE) {
|
||||
struct tm dbtime;
|
||||
@ -980,7 +981,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
||||
|
||||
htrc("ODBC Column %s: rows=%d buf=%p type=%d value=%s\n",
|
||||
Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf));
|
||||
} // endif trace
|
||||
} // endif trace
|
||||
|
||||
put:
|
||||
if (tdbp->Memory != 2)
|
||||
@ -997,7 +998,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
||||
} else
|
||||
Crp->Kdata->SetValue(Value, i);
|
||||
|
||||
} // end of ReadColumn
|
||||
} // end of ReadColumn
|
||||
|
||||
/***********************************************************************/
|
||||
/* AllocateBuffers: allocate the extended buffer for SQLExtendedFetch */
|
||||
@ -1005,7 +1006,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g)
|
||||
/* for the ending null character. */
|
||||
/***********************************************************************/
|
||||
void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows)
|
||||
{
|
||||
{
|
||||
if (Buf_Type == TYPE_DATE)
|
||||
Sqlbuf = (TIMESTAMP_STRUCT*)PlugSubAlloc(g, NULL,
|
||||
sizeof(TIMESTAMP_STRUCT));
|
||||
@ -1019,31 +1020,31 @@ void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows)
|
||||
Blkp = AllocValBlock(g, NULL, Buf_Type, rows, GetBuflen(),
|
||||
GetScale(), true, false, false);
|
||||
Bufp = Blkp->GetValPointer();
|
||||
} // endelse
|
||||
} // endelse
|
||||
|
||||
if (rows > 1)
|
||||
StrLen = (SQLLEN *)PlugSubAlloc(g, NULL, rows * sizeof(SQLLEN));
|
||||
|
||||
} // end of AllocateBuffers
|
||||
} // end of AllocateBuffers
|
||||
|
||||
/***********************************************************************/
|
||||
/* Returns the buffer to use for Fetch or Extended Fetch. */
|
||||
/***********************************************************************/
|
||||
void *ODBCCOL::GetBuffer(DWORD rows)
|
||||
{
|
||||
{
|
||||
if (rows && To_Tdb) {
|
||||
assert(rows == (DWORD)((TDBODBC*)To_Tdb)->Rows);
|
||||
return Bufp;
|
||||
} else
|
||||
return (Buf_Type == TYPE_DATE) ? Sqlbuf : Value->GetTo_Val();
|
||||
|
||||
} // end of GetBuffer
|
||||
} // end of GetBuffer
|
||||
|
||||
/***********************************************************************/
|
||||
/* Returns the buffer length to use for Fetch or Extended Fetch. */
|
||||
/***********************************************************************/
|
||||
SWORD ODBCCOL::GetBuflen(void)
|
||||
{
|
||||
{
|
||||
SWORD flen;
|
||||
|
||||
switch (Buf_Type) {
|
||||
@ -1059,13 +1060,13 @@ SWORD ODBCCOL::GetBuflen(void)
|
||||
} // endswitch Buf_Type
|
||||
|
||||
return flen;
|
||||
} // end of GetBuflen
|
||||
} // end of GetBuflen
|
||||
|
||||
/***********************************************************************/
|
||||
/* WriteColumn: make sure the bind buffer is updated. */
|
||||
/***********************************************************************/
|
||||
void ODBCCOL::WriteColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
/*********************************************************************/
|
||||
/* Do convert the column value if necessary. */
|
||||
/*********************************************************************/
|
||||
@ -1095,7 +1096,7 @@ void ODBCCOL::WriteColumn(PGLOBAL g)
|
||||
*StrLen = (Value->IsNull()) ? SQL_NULL_DATA :
|
||||
(IsTypeChar(Buf_Type)) ? SQL_NTS : 0;
|
||||
|
||||
} // end of WriteColumn
|
||||
} // end of WriteColumn
|
||||
|
||||
/* -------------------------- Class TDBXDBC -------------------------- */
|
||||
|
||||
@ -1119,7 +1120,7 @@ TDBXDBC::TDBXDBC(PTDBXDBC tdbp) : TDBODBC(tdbp)
|
||||
} // end of TDBXDBC copy constructor
|
||||
|
||||
PTDB TDBXDBC::Clone(PTABS t)
|
||||
{
|
||||
{
|
||||
PTDB tp;
|
||||
PXSRCCOL cp1, cp2;
|
||||
PGLOBAL g = t->G; // Is this really useful ???
|
||||
@ -1129,29 +1130,29 @@ PTDB TDBXDBC::Clone(PTABS t)
|
||||
for (cp1 = (PXSRCCOL)Columns; cp1; cp1 = (PXSRCCOL)cp1->GetNext()) {
|
||||
cp2 = new(g) XSRCCOL(cp1, tp); // Make a copy
|
||||
NewPointer(t, cp1, cp2);
|
||||
} // endfor cp1
|
||||
} // endfor cp1
|
||||
|
||||
return tp;
|
||||
} // end of CopyOne
|
||||
} // end of CopyOne
|
||||
|
||||
/***********************************************************************/
|
||||
/* Allocate XSRC column description block. */
|
||||
/***********************************************************************/
|
||||
PCOL TDBXDBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
||||
{
|
||||
{
|
||||
PXSRCCOL colp = new(g) XSRCCOL(cdp, this, cprec, n);
|
||||
|
||||
if (!colp->Flag)
|
||||
Cmdcol = colp->GetName();
|
||||
|
||||
return colp;
|
||||
} // end of MakeCol
|
||||
} // end of MakeCol
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeCMD: make the SQL statement to send to ODBC connection. */
|
||||
/***********************************************************************/
|
||||
PCMD TDBXDBC::MakeCMD(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PCMD xcmd = NULL;
|
||||
|
||||
if (To_CondFil) {
|
||||
@ -1171,14 +1172,14 @@ PCMD TDBXDBC::MakeCMD(PGLOBAL g)
|
||||
xcmd = new(g) CMD(g, Srcdef);
|
||||
|
||||
return xcmd;
|
||||
} // end of MakeCMD
|
||||
} // end of MakeCMD
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* ODBC Bind Parameter function. */
|
||||
/***********************************************************************/
|
||||
bool TDBXDBC::BindParameters(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PODBCCOL colp;
|
||||
|
||||
for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) {
|
||||
@ -1190,19 +1191,19 @@ bool TDBXDBC::BindParameters(PGLOBAL g)
|
||||
} // endfor colp
|
||||
|
||||
return false;
|
||||
} // end of BindParameters
|
||||
} // end of BindParameters
|
||||
#endif // 0
|
||||
|
||||
/***********************************************************************/
|
||||
/* XDBC GetMaxSize: returns table size (not always one row). */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::GetMaxSize(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (MaxSize < 0)
|
||||
MaxSize = 10; // Just a guess
|
||||
|
||||
return MaxSize;
|
||||
} // end of GetMaxSize
|
||||
} // end of GetMaxSize
|
||||
|
||||
/***********************************************************************/
|
||||
/* ODBC Access Method opening routine. */
|
||||
@ -1211,7 +1212,7 @@ int TDBXDBC::GetMaxSize(PGLOBAL g)
|
||||
/* join block of next table if it exists or else are discarted. */
|
||||
/***********************************************************************/
|
||||
bool TDBXDBC::OpenDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
bool rc = false;
|
||||
|
||||
if (trace(1))
|
||||
@ -1221,7 +1222,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
|
||||
if (Use == USE_OPEN) {
|
||||
strcpy(g->Message, "Multiple execution is not allowed");
|
||||
return true;
|
||||
} // endif use
|
||||
} // endif use
|
||||
|
||||
/*********************************************************************/
|
||||
/* Open an ODBC connection for this table. */
|
||||
@ -1243,7 +1244,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
|
||||
if (Mode != MODE_READ && Mode != MODE_READX) {
|
||||
strcpy(g->Message, "No INSERT/DELETE/UPDATE of XDBC tables");
|
||||
return true;
|
||||
} // endif Mode
|
||||
} // endif Mode
|
||||
|
||||
/*********************************************************************/
|
||||
/* Get the command to execute. */
|
||||
@ -1256,13 +1257,13 @@ bool TDBXDBC::OpenDB(PGLOBAL g)
|
||||
|
||||
Rows = 1;
|
||||
return false;
|
||||
} // end of OpenDB
|
||||
} // end of OpenDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* ReadDB: Data Base read routine for xdbc access method. */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::ReadDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
if (Cmdlist) {
|
||||
if (!Query)
|
||||
Query = new(g)STRING(g, 0, Cmdlist->Cmd);
|
||||
@ -1280,25 +1281,25 @@ int TDBXDBC::ReadDB(PGLOBAL g)
|
||||
return RC_EF;
|
||||
} // endif Cmdlist
|
||||
|
||||
} // end of ReadDB
|
||||
} // end of ReadDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base delete line routine for ODBC access method. */
|
||||
/* Data Base write line routine for XDBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::WriteDB(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
strcpy(g->Message, "Execsrc tables are read only");
|
||||
return RC_FX;
|
||||
} // end of DeleteDB
|
||||
} // end of DeleteDB
|
||||
|
||||
/***********************************************************************/
|
||||
/* Data Base delete line routine for ODBC access method. */
|
||||
/* Data Base delete line routine for XDBC access method. */
|
||||
/***********************************************************************/
|
||||
int TDBXDBC::DeleteDB(PGLOBAL g, int irc)
|
||||
{
|
||||
{
|
||||
strcpy(g->Message, MSG(NO_ODBC_DELETE));
|
||||
return RC_FX;
|
||||
} // end of DeleteDB
|
||||
} // end of DeleteDB
|
||||
|
||||
/* --------------------------- XSRCCOL ------------------------------- */
|
||||
|
||||
@ -1307,25 +1308,25 @@ int TDBXDBC::DeleteDB(PGLOBAL g, int irc)
|
||||
/***********************************************************************/
|
||||
XSRCCOL::XSRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
|
||||
: ODBCCOL(cdp, tdbp, cprec, i, am)
|
||||
{
|
||||
{
|
||||
// Set additional ODBC access method information for column.
|
||||
Flag = cdp->GetOffset();
|
||||
} // end of XSRCCOL constructor
|
||||
} // end of XSRCCOL constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* XSRCCOL constructor used for copying columns. */
|
||||
/* tdbp is the pointer to the new table descriptor. */
|
||||
/***********************************************************************/
|
||||
XSRCCOL::XSRCCOL(XSRCCOL *col1, PTDB tdbp) : ODBCCOL(col1, tdbp)
|
||||
{
|
||||
{
|
||||
Flag = col1->Flag;
|
||||
} // end of XSRCCOL copy constructor
|
||||
} // end of XSRCCOL copy constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* ReadColumn: set column value according to Flag. */
|
||||
/***********************************************************************/
|
||||
void XSRCCOL::ReadColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
PTDBXDBC tdbp = (PTDBXDBC)To_Tdb;
|
||||
|
||||
switch (Flag) {
|
||||
@ -1335,15 +1336,15 @@ void XSRCCOL::ReadColumn(PGLOBAL g)
|
||||
default: Value->SetValue_psz("Invalid Flag"); break;
|
||||
} // endswitch Flag
|
||||
|
||||
} // end of ReadColumn
|
||||
} // end of ReadColumn
|
||||
|
||||
/***********************************************************************/
|
||||
/* WriteColumn: Should never be called. */
|
||||
/***********************************************************************/
|
||||
void XSRCCOL::WriteColumn(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
// Should never be called
|
||||
} // end of WriteColumn
|
||||
} // end of WriteColumn
|
||||
|
||||
/* ---------------------------TDBDRV class --------------------------- */
|
||||
|
||||
@ -1351,9 +1352,9 @@ void XSRCCOL::WriteColumn(PGLOBAL g)
|
||||
/* GetResult: Get the list of ODBC drivers. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBDRV::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCDrivers(g, Maxres, false);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ---------------------------TDBSRC class --------------------------- */
|
||||
|
||||
@ -1361,9 +1362,9 @@ PQRYRES TDBDRV::GetResult(PGLOBAL g)
|
||||
/* GetResult: Get the list of ODBC data sources. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBSRC::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCDataSources(g, Maxres, false);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ---------------------------TDBOTB class --------------------------- */
|
||||
|
||||
@ -1371,7 +1372,7 @@ PQRYRES TDBSRC::GetResult(PGLOBAL g)
|
||||
/* TDBOTB class constructor. */
|
||||
/***********************************************************************/
|
||||
TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
|
||||
{
|
||||
{
|
||||
Dsn = tdp->GetConnect();
|
||||
Schema = tdp->GetTabschema();
|
||||
Tab = tdp->GetTabname();
|
||||
@ -1381,15 +1382,15 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
|
||||
Ops.Cto = tdp->Cto;
|
||||
Ops.Qto = tdp->Qto;
|
||||
Ops.UseCnc = tdp->UseCnc;
|
||||
} // end of TDBOTB constructor
|
||||
} // end of TDBOTB constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetResult: Get the list of ODBC tables. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBOTB::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCTables(g, Dsn, Schema, Tab, Tabtyp, Maxres, false, &Ops);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ---------------------------TDBOCL class --------------------------- */
|
||||
|
||||
@ -1405,8 +1406,8 @@ TDBOCL::TDBOCL(PODEF tdp) : TDBOTB(tdp)
|
||||
/* GetResult: Get the list of ODBC table columns. */
|
||||
/***********************************************************************/
|
||||
PQRYRES TDBOCL::GetResult(PGLOBAL g)
|
||||
{
|
||||
{
|
||||
return ODBCColumns(g, Dsn, Schema, Tab, Colpat, Maxres, false, &Ops);
|
||||
} // end of GetResult
|
||||
} // end of GetResult
|
||||
|
||||
/* ------------------------ End of Tabodbc --------------------------- */
|
||||
|
@ -681,6 +681,14 @@ PTDB TDBXML::Clone(PTABS t)
|
||||
return tp;
|
||||
} // end of Clone
|
||||
|
||||
/***********************************************************************/
|
||||
/* Must not be in tabxml.h because of OEM tables */
|
||||
/***********************************************************************/
|
||||
const CHARSET_INFO *TDBXML::data_charset()
|
||||
{
|
||||
return &my_charset_utf8_general_ci;
|
||||
} // end of data_charset
|
||||
|
||||
/***********************************************************************/
|
||||
/* Allocate XML column description block. */
|
||||
/***********************************************************************/
|
||||
@ -2209,8 +2217,9 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
|
||||
TDBXCT::TDBXCT(PXMLDEF tdp) : TDBCAT(tdp)
|
||||
{
|
||||
Topt = tdp->GetTopt();
|
||||
Db = (char*)tdp->GetDB();
|
||||
Tabn = tdp->Tabname;
|
||||
//Db = (char*)tdp->GetDB();
|
||||
Db = (char*)tdp->Schema;
|
||||
Tabn = tdp->Tabname;
|
||||
} // end of TDBXCT constructor
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -9,6 +9,8 @@ typedef class XMLDEF *PXMLDEF;
|
||||
typedef class TDBXML *PTDBXML;
|
||||
typedef class XMLCOL *PXMLCOL;
|
||||
|
||||
DllExport PQRYRES XMLColumns(PGLOBAL, char *, char *, PTOS, bool);
|
||||
|
||||
/* --------------------------- XML classes --------------------------- */
|
||||
|
||||
/***********************************************************************/
|
||||
@ -100,8 +102,7 @@ class DllExport TDBXML : public TDBASE {
|
||||
virtual int DeleteDB(PGLOBAL g, int irc);
|
||||
virtual void CloseDB(PGLOBAL g);
|
||||
virtual int CheckWrite(PGLOBAL g) {Checked = true; return 0;}
|
||||
virtual const CHARSET_INFO *data_charset()
|
||||
{return &my_charset_utf8_general_ci;}
|
||||
virtual const CHARSET_INFO *data_charset();
|
||||
|
||||
protected:
|
||||
// Members
|
||||
|
@ -107,7 +107,7 @@ bool user_connect::user_init()
|
||||
g= PlugInit(NULL, worksize);
|
||||
|
||||
// Check whether the initialization is complete
|
||||
if (!g || !g->Sarea || PlugSubSet(g, g->Sarea, g->Sarea_Size)
|
||||
if (!g || !g->Sarea || PlugSubSet(g->Sarea, g->Sarea_Size)
|
||||
|| !(dup= PlgMakeUser(g))) {
|
||||
if (g)
|
||||
printf("%s\n", g->Message);
|
||||
@ -172,7 +172,7 @@ bool user_connect::CheckCleanup(bool force)
|
||||
|
||||
} // endif worksize
|
||||
|
||||
PlugSubSet(g, g->Sarea, g->Sarea_Size);
|
||||
PlugSubSet(g->Sarea, g->Sarea_Size);
|
||||
g->Xchk = NULL;
|
||||
g->Createas = 0;
|
||||
g->Alchecked = 0;
|
||||
|
@ -968,9 +968,20 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
|
||||
field_max_size = dict_col_get_max_size(col);
|
||||
if (UNIV_UNLIKELY(!field_max_size)) {
|
||||
switch (col->mtype) {
|
||||
case DATA_VARCHAR:
|
||||
if (!comp
|
||||
&& (!strcmp(index->table->name.m_name,
|
||||
"SYS_FOREIGN")
|
||||
|| !strcmp(index->table->name.m_name,
|
||||
"SYS_FOREIGN_COLS"))) {
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case DATA_VARMYSQL:
|
||||
case DATA_CHAR:
|
||||
case DATA_MYSQL:
|
||||
/* CHAR(0) is a possible data type.
|
||||
/* CHAR(0) and VARCHAR(0) are possible
|
||||
data type definitions in MariaDB.
|
||||
The InnoDB internal SQL parser maps
|
||||
CHAR to DATA_VARCHAR, so DATA_CHAR (or
|
||||
DATA_MYSQL) is only coming from the
|
||||
@ -986,6 +997,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* SYS_FOREIGN.ID is defined as CHAR in the
|
||||
InnoDB internal SQL parser, which translates
|
||||
into the incorrect VARCHAR(0). InnoDB does
|
||||
@ -1002,6 +1014,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
|
||||
|| !strcmp(index->table->name.m_name,
|
||||
"SYS_FOREIGN_COLS"));
|
||||
ut_ad(!comp);
|
||||
ut_ad(col->mtype == DATA_VARCHAR);
|
||||
|
||||
rec_max_size += (srv_page_size == UNIV_PAGE_SIZE_MAX)
|
||||
? REDUNDANT_REC_MAX_DATA_SIZE
|
||||
|
@ -526,13 +526,13 @@ decompress_with_slot:
|
||||
/* Verify encryption checksum before we even try to
|
||||
decrypt. */
|
||||
if (!fil_space_verify_crypt_checksum(dst_frame, bpage->size)) {
|
||||
decrypt_failed:
|
||||
ib::error() << "Encrypted page " << bpage->id
|
||||
<< " in file " << space->chain.start->name
|
||||
<< " looks corrupted; key_version="
|
||||
<< mach_read_from_4(
|
||||
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
|
||||
+ dst_frame);
|
||||
decrypt_failed:
|
||||
/* Mark page encrypted in case it should be. */
|
||||
if (space->crypt_data->type
|
||||
!= CRYPT_SCHEME_UNENCRYPTED) {
|
||||
@ -4448,7 +4448,7 @@ loop:
|
||||
<< ". The most probable cause"
|
||||
" of this error may be that the"
|
||||
" table has been corrupted."
|
||||
" See https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/";
|
||||
" See https://mariadb.com/kb/en/library/innodb-recovery-modes/";
|
||||
}
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
|
||||
|
@ -328,14 +328,14 @@ ulint fil_page_decompress(byte* tmp_buf, byte* buf)
|
||||
case PAGE_ZLIB_ALGORITHM:
|
||||
{
|
||||
uLong len = srv_page_size;
|
||||
if (Z_OK != uncompress(tmp_buf, &len,
|
||||
if (Z_OK == uncompress(tmp_buf, &len,
|
||||
buf + header_len,
|
||||
uLong(actual_size))
|
||||
&& len != srv_page_size) {
|
||||
return 0;
|
||||
&& len == srv_page_size) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return 0;
|
||||
#ifdef HAVE_LZ4
|
||||
case PAGE_LZ4_ALGORITHM:
|
||||
if (LZ4_decompress_safe(reinterpret_cast<const char*>(buf)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user