summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Simple binary cache optimizationsbb-10.3-sequenceMonty2017-04-071-18/+20
| | | | | - Don't call my_chsize() for small (less than 64K) binary log tmp files - Don't flush cache to disk on reset.
* Simple cleanupsMonty2017-04-072-3/+3
| | | | | - Added file name to error in mysql-test-run - When creating tags, first do it for sql to make it easier to find things in server
* MDEV-10139 Support for InnoDB SEQUENCE objectsMarko Mäkelä2017-04-078-39/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce a NO_ROLLBACK flag for InnoDB tables. This flag only works for tables that have a single index. Apart from undo logging, this flag will also prevent locking and the assignment of DB_ROW_ID or DB_TRX_ID, and imply READ UNCOMMITTED isolation. It is assumed that the SQL layer is guaranteeing mutual exclusion. After the initial insert of the single record during CREATE SEQUENCE, InnoDB will be updating the single record in-place. This is crash-safe thanks to the redo log. (That is, after a crash after CREATE SEQUENCE was committed, the effect of sequence operations will be observable fully or not at all.) When it comes to the durability of the updates of SEQUENCE in InnoDB, there is a clear analogy to MDEV-6076 Persistent AUTO_INCREMENT. The updates would be made persistent by the InnoDB redo log flush at transaction commit or rollback (or XA PREPARE), provided that innodb_log_flush_at_trx_commit=1. Similar to AUTO_INCREMENT, it is possible that the update of a SEQUENCE in a middle of transaction becomes durable before the COMMIT/ROLLBACK of the transaction, in case the InnoDB redo log is being flushed as a result of the a commit or rollback of some other transaction, or as a result of a redo log checkpoint that can be initiated at any time by operations that are writing redo log. dict_table_t::no_rollback(): Check if the table does not support rollback. BTR_NO_ROLLBACK: Logging and locking flags for no_rollback() tables. DICT_TF_BITS: Add the NO_ROLLBACK flag. row_ins_step(): Assign 0 to DB_ROW_ID and DB_TRX_ID, and skip any locking for no-rollback tables. There will be only a single row in no-rollback tables (or there must be a proper PRIMARY KEY). row_search_mvcc(): Execute the READ UNCOMMITTED code path for no-rollback tables. ha_innobase::external_lock(), ha_innobase::store_lock(): Block CREATE/DROP SEQUENCE in innodb_read_only mode. This probably has no effect for CREATE SEQUENCE, because already ha_innobase::create() should have been called (and refused) before external_lock() or store_lock() is called. ha_innobase::store_lock(): For CREATE SEQUENCE, do not acquire any InnoDB locks, even though TL_WRITE is being requested. (This is just a performance optimization.) innobase_copy_frm_flags_from_create_info(), row_drop_table_for_mysql(): Disable persistent statistics for no_rollback tables.
* Change error message when using DROP VIEW on a non existing view fromMonty2017-04-0717-48/+48
| | | | "Unknown table" to "Unknown view"
* MDEV-10139 Support for SEQUENCE objectsMonty2017-04-0793-501/+8003
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Working features: CREATE OR REPLACE [TEMPORARY] SEQUENCE [IF NOT EXISTS] name [ INCREMENT [ BY | = ] increment ] [ MINVALUE [=] minvalue | NO MINVALUE ] [ MAXVALUE [=] maxvalue | NO MAXVALUE ] [ START [ WITH | = ] start ] [ CACHE [=] cache ] [ [ NO ] CYCLE ] ENGINE=xxx COMMENT=".." SELECT NEXT VALUE FOR sequence_name; SELECT NEXTVAL(sequence_name); SELECT PREVIOUS VALUE FOR sequence_name; SELECT LASTVAL(sequence_name); SHOW CREATE SEQUENCE sequence_name; SHOW CREATE TABLE sequence_name; CREATE TABLE sequence-structure ... SEQUENCE=1 ALTER TABLE sequence RENAME TO sequence2; RENAME TABLE sequence TO sequence2; DROP [TEMPORARY] SEQUENCE [IF EXISTS] sequence_names Missing features - SETVAL(value,sequence_name), to be used with replication. - Check replication, including checking that sequence tables are marked not transactional. - Check that a commit happens for NEXT VALUE that changes table data (may already work) - ALTER SEQUENCE. ANSI SQL version of setval. - Share identical sequence entries to not add things twice to table list. - testing insert/delete/update/truncate/load data - Run and fix Alibaba sequence tests (part of mysql-test/suite/sql_sequence) - Write documentation for NEXT VALUE / PREVIOUS_VALUE - NEXTVAL in DEFAULT - Ensure that NEXTVAL in DEFAULT uses database from base table - Two NEXTVAL for same row should give same answer. - Oracle syntax sequence_table.nextval, without any FOR or FROM. - Sequence tables are treated as 'not read constant tables' by SELECT; Would be better if we would have a separate list for sequence tables so that select doesn't know about them, except if refereed to with FROM. Other things done: - Improved output for safemalloc backtrack - frm_type_enum changed to Table_type - Removed lex->is_view and replaced with lex->table_type. This allows use to more easy check if item is view, sequence or table. - Added table flag HA_CAN_TABLES_WITHOUT_ROLLBACK, needed for handlers that want's to support sequences - Added handler calls: - engine_name(), to simplify getting engine name for partition and sequences - update_first_row(), to be able to do efficient sequence implementations. - Made binlog_log_row() global to be able to call it from ha_sequence.cc - Added handler variable: row_already_logged, to be able to flag that the changed row is already logging to replication log. - Added CF_DB_CHANGE and CF_SCHEMA_CHANGE flags to simplify deny_updates_if_read_only_option() - Added sp_add_cfetch() to avoid new conflicts in sql_yacc.yy - Moved code for add_table_options() out from sql_show.cc::show_create_table() - Added String::append_longlong() and used it in sql_show.cc to simplify code. - Added extra option to dd_frm_type() and ha_table_exists to indicate if the table is a sequence. Needed by DROP SQUENCE to not drop a table.
* MDEV-8203 Assert in Query_log_event::do_apply_event()Monty2017-04-078-28/+209
| | | | | | | | | This happens because the master writes a table_map event to the binary log, but no row event. The slave has a check that there should always be a row event if there was a table_map event, which causes a crash. Fixed by remembering in the cache what kind of events are logged and ignore cached statements which is just a table map event.
* An additional test for MDEV-12347 Valgrind reports invalid read errors in ↵Alexander Barkov2017-03-242-0/+81
| | | | Item_field_row::element_index_by_name
* MDEV-12347 Valgrind reports invalid read errors in ↵Alexander Barkov2017-03-241-2/+9
| | | | Item_field_row::element_index_by_name
* MDEV-12314 Implicit cursor FOR LOOP for cursors with parametersAlexander Barkov2017-03-247-16/+167
|
* MDEV-12291 Allow ROW variables as SELECT INTO targetsAlexander Barkov2017-03-2414-21/+762
|
* MDEV-10598 Variable declarations can go after cursor declarationsAlexander Barkov2017-03-2411-28/+763
| | | | Based on a contributed patch from Jerome Brauge.
* MDEV-10581 sql_mode=ORACLE: Explicit cursor FOR LOOPAlexander Barkov2017-03-2413-39/+1410
| | | | MDEV-12098 sql_mode=ORACLE: Implicit cursor FOR loop
* MDEV-12011 sql_mode=ORACLE: cursor%ROWTYPE in variable declarationsAlexander Barkov2017-03-2420-77/+2446
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing cursor%ROWTYPE variables, according to the task description. This patch includes a refactoring in how sp_instr_cpush and sp_instr_copen work. This is needed to implement MDEV-10598 later easier, to allow variable declarations go after cursor declarations (which is currently not allowed). Before this patch, sp_instr_cpush worked as a Query_arena associated with the cursor. sp_instr_copen::execute() switched to the sp_instr_cpush's Query_arena when executing the cursor SELECT statement. Now the Query_arena associated with the cursor is stored inside an instance of a new class sp_lex_cursor (a LEX descendand) that contains the cursor SELECT statement. This simplifies the implementation, because: - It's easier to follow the code when everything related to execution of the cursor SELECT statement is stored inside the same sp_lex_cursor object (rather than distributed between LEX and sp_instr_cpush). - It's easier to link an sp_instr_cursor_copy_struct to sp_lex_cursor rather than to sp_instr_cpush. - Also, it allows to perform sp_instr_cursor_copy_struct::exec_core() without having a pointer to sp_instr_cpush, using a pointer to sp_lex_cursor instead. This will be important for MDEV-10598, because sp_instr_cpush will happen *after* sp_instr_cursor_copy_struct. After MDEV-10598 is done, this declaration: DECLARE CURSOR cur IS SELECT * FROM t1; rec cur%ROWTYPE; BEGIN OPEN cur; FETCH cur INTO rec; CLOSE cur; END; will generate about this code: +-----+--------------------------+ | Pos | Instruction | +-----+--------------------------+ | 0 | cursor_copy_struct rec@0 | Points to sp_cursor_lex through m_lex_keeper | 1 | set rec@0 NULL | | 2 | cpush cur@0 | Points to sp_cursor_lex through m_lex_keeper | 3 | copen cur@0 | Points to sp_cursor_lex through m_cursor | 4 | cfetch cur@0 rec@0 | | 5 | cclose cur@0 | | 6 | cpop 1 | +-----+--------------------------+ Notice, "cursor_copy_struct" and "set" will go before "cpush". Instructions at positions 0, 2, 3 point to the same sp_cursor_lex instance.
* MDEV-12133 sql_mode=ORACLE: table%ROWTYPE in variable declarationsAlexander Barkov2017-03-2424-58/+2106
|
* MDEV-12209 sql_mode=ORACLE: Syntax error in a OPEN cursor with parameters ↵Alexander Barkov2017-03-245-14/+70
| | | | | | | | | | | | makes the server crash The bug was introduced in the patch for "MDEV-10597 Cursors with parameters". The LEX created in assignment_source_expr was not put into thd->lex->sphead->m_lex (the stack of LEX'es), so syntax error in "expr" caused a wrong memory cleanup in sp_head::~sp_head(). The fix changes the code to use sp_head::push_lex() followed by sp_head::restore_lex(), like it happens in all other similar cases.
* MDEV-12143 sql_mode=ORACLE: make the CONCAT function ignore NULL argumentsAlexander Barkov2017-03-244-1/+42
|
* Part#2 for MDEV-12107 sql_mode=ORACLE: Inside routines the CALL keywoard is ↵Alexander Barkov2017-03-243-16/+48
| | | | | | | | | | | | | | | | | | | | | | | | | optional Allowing qualified procedure names to be used without the CALL keyword: BEGIN test.p1(10); test.p2; END; Note: - COMMIT and ROLLBACK cannot be used in a direct assignment anymore: COMMIT:= 10; ROLLBACK:= 10; But as they are reserved keywords in Oracle anyway, this is not a problem. - SHUTDOWN now also cannot be used in direct a direct assignment: SHUTDOWN:=10; If this causes migration problems in the future, the grammar should be modified. Note: Variables with names COMMIT, ROLLBACK and SHUTDOWN can still be assigned with the SET statement, e.g. SET COMMIT=10;
* MDEV-12107 sql_mode=ORACLE: Inside routines the CALL keywoard is optionalAlexander Barkov2017-03-246-38/+120
|
* MDEV-12088 sql_mode=ORACLE: Do not require BEGIN..END in multi-statement ↵Alexander Barkov2017-03-243-3/+53
| | | | exception handlers in THEN clause
* MDEV-12086 sql_mode=ORACLE: allow SELECT UNIQUE as a synonym for SELECT DISTINCTAlexander Barkov2017-03-243-0/+23
|
* MDEV-12089 sql_mode=ORACLE: Understand optional routine name after the END ↵Alexander Barkov2017-03-246-11/+446
| | | | keyword
* MDEV-10697 GOTO statementhalfspawn2017-03-2411-41/+2092
|
* A cleanup for "MDEV-11952 Oracle-style packages: Phase#1: ..."Alexander Barkov2017-03-245-10/+150
| | | | | | | | | Fixed that a syntax error inside CREATE PACKAGE [BODY] caused a crash. The problem happened because thd->lex was not restored to the top level LEX when recovering from a syntax error in LEX::cleanup_lex_after_parse_error(). thd->lex was left assigned to the local sublex corresponding to a routine definition.
* MDEV-12007 Allow ROW variables as a cursor FETCH targetAlexander Barkov2017-03-247-4/+316
|
* MDEV-10914 ROW data type for stored routine variablesAlexander Barkov2017-03-2442-303/+9226
|
* Removing redundant tests for "SET (global|local|session).varname"Alexander Barkov2017-03-24120-404/+0
| | | | | | | | | This is covered in mysql-test/t/variables.test. There is no sense to test this for every individual variables. This is to reduce the coming soon patch for ROW-type routine variables, which will change the error from ER_PARSE_ERROR to a new error "unknown structured variable".
* MDEV-10655 Anonymous blocksAlexander Barkov2017-03-245-85/+478
|
* MDEV-11952 Oracle-style packages: Phase#1: Translate packages to databasesAlexander Barkov2017-03-2416-299/+903
|
* MDEV-11880 sql_mode=ORACLE: Make the concatenation operator ignore NULL ↵Alexander Barkov2017-03-246-98/+483
| | | | | | | | | arguments Now when sql_mode=ORACLE, the concatenation operator || treats NULLs as empty strings. Based on the contributed patch from Jérôme Brauge.
* Fixing that LEX::sp_add_for_loop_variable() did not initialize pack_flagAlexander Barkov2017-03-241-0/+6
| | | | This fixes compat/oracle.sp test failure in release builds.
* Fixing compilation failure on Windows (LEX defined as struct vs class)Alexander Barkov2017-03-241-2/+2
|
* MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarationsAlexander Barkov2017-03-2430-111/+2712
|
* MDEV-10588 sql_mode=ORACLE: TRUNCATE TABLE t1 [ {DROP|REUSE} STORAGE ]Alexander Barkov2017-03-247-0/+43
|
* MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N))Alexander Barkov2017-03-245-0/+43
|
* MDEV-10597 Cursors with parametersAlexander Barkov2017-03-2415-222/+1606
|
* MDEV-10587 sql_mode=ORACLE: User defined exceptionsAlexander Barkov2017-03-2412-113/+655
|
* MDEV-11037 Diagnostics_area refactoring for user defined exceptionsAlexander Barkov2017-03-244-125/+134
| | | | | | | | | | | | | | | Part 2: Moving the part of Sql_condition that contain condition items (such as m_class_origin, m_cursor_name, etc) into a separate class Sql_condition_items. This allows to remove duplicate code in different Sql_condition constructors. Also, introducing new Sql_condition constructors and removing the method Sql_condition::set(). All code sequences that called an Sql_condition constructor followed by Sql_condition::set() are now replaced to the new constructor calls. This gives light performance improvement, as the relevant members are now initialized only one time.
* MDEV-11037 Diagnostics_area refactoring for user defined exceptionsAlexander Barkov2017-03-248-301/+257
|
* MDEV-10578 sql_mode=ORACLE: SP control functions SQLCODE, SQLERRMAlexander Barkov2017-03-2411-106/+817
|
* MDEV-10411 Providing compatibility for basic PL/SQL constructsAlexander Barkov2017-03-243-2/+50
| | | | | | | | An additional change for "Part 9: EXCEPTION handlers" This construct: EXCEPTION WHEN OTHERS THEN ...; now catches warning-alike conditions, e.g. NO_DATA_FOUND.
* MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressionsAlexander Barkov2017-03-242-0/+166
| | | | | | MDEV-10867 PREPARE..EXECUTE is not consistent about non-ASCII characters Adding Oracle specific tests
* A fix for MDEV-10411 Providing compatibility for basic PL/SQL constructs ↵Alexander Barkov2017-03-246-65/+114
| | | | | | | | | (Part 6: Assignment operator) Fixed that a crash in this script: SET sql_mode=ORACLE; max_sort_length:= 1024;
* MDEV-10840 sql_mode=ORACLE: RAISE statement for predefined exceptionsAlexander Barkov2017-03-2412-45/+434
|
* MDEV-10582 sql_mode=ORACLE: explicit cursor attributes %ISOPEN, %ROWCOUNT, ↵Alexander Barkov2017-03-2412-10/+800
| | | | %FOUND, %NOTFOUND
* DEV-10583 sql_mode=ORACLE: SQL%ROWCOUNTAlexander Barkov2017-03-242-2/+2
| | | | | Fixed that EXPLAIN EXTENDED erroneously returned "SQL%%ROWCOUNT" instead of "SQL%ROWCOUNT"
* MDEV-10709 Expressions as parameters to Dynamic SQLAlexander Barkov2017-03-242-0/+83
| | | | Adding Oracle-specific tests for stored functions as EXECUTE..USING parameters.
* MDEV-10585 EXECUTE IMMEDIATE statementAlexander Barkov2017-03-242-0/+11
| | | | Adding Oracle specific tests
* MDEV-10583 sql_mode=ORACLE: SQL%ROWCOUNTAlexander Barkov2017-03-2410-1/+417
|
* MDEV-10839 sql_mode=ORACLE: Predefined exceptions: TOO_MANY_ROWS, ↵Alexander Barkov2017-03-245-4/+160
| | | | NO_DATA_FOUND, DUP_VAL_ON_INDEX
* MDEV-10709 Expressions as parameters to Dynamic SQLAlexander Barkov2017-03-242-0/+189
| | | | Adding Oracle specific tests