Commit 69c2eb98 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into pcgem.rdg.cyberkinetica.com:/var/db/bk/work-acurtis/wl1967


sql/ha_innodb.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
parents fe7b8634 0e50e324
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -225,6 +225,21 @@ trx_savepoint_for_mysql(
						position corresponding to this
						connection at the time of the
						savepoint */
						
/***********************************************************************
Releases a named savepoint. Savepoints which
were set after this savepoint are deleted. */

ulint
trx_release_savepoint_for_mysql(
/*================================*/
						/* out: if no savepoint
						of the name found then
						DB_NO_SAVEPOINT,
						otherwise DB_SUCCESS */
	trx_t*		trx,			/* in: transaction handle */
	const char*	savepoint_name);	/* in: savepoint name */

/***********************************************************************
Frees savepoint structs. */

+45 −0
Original line number Diff line number Diff line
@@ -316,6 +316,51 @@ trx_savepoint_for_mysql(
	return(DB_SUCCESS);
}

/***********************************************************************
Releases a named savepoint. Savepoints which
were set after this savepoint are deleted. */

ulint
trx_release_savepoint_for_mysql(
/*================================*/
						/* out: if no savepoint
						of the name found then
						DB_NO_SAVEPOINT,
						otherwise DB_SUCCESS */
	trx_t*		trx,			/* in: transaction handle */
	const char*	savepoint_name)		/* in: savepoint name */
{
	trx_named_savept_t*	savep;

	savep = UT_LIST_GET_FIRST(trx->trx_savepoints);

	while (savep != NULL) {
	        if (0 == ut_strcmp(savep->name, savepoint_name)) {
		        /* Found */
			break;
		}
	        savep = UT_LIST_GET_NEXT(trx_savepoints, savep);
	}

	if (savep == NULL) {	

	        return(DB_NO_SAVEPOINT);
	}

	/* We can now free all savepoints strictly later than this one */

	trx_roll_savepoints_free(trx, savep);
	
	/* Now we can free this savepoint too */

	UT_LIST_REMOVE(trx_savepoints, trx->trx_savepoints, savep);

	mem_free(savep->name);
	mem_free(savep);

	return(DB_SUCCESS);
}

/***********************************************************************
Returns a transaction savepoint taken at this point in time. */

+29 −5
Original line number Diff line number Diff line
@@ -249,6 +249,30 @@ n
4
5
6
set autocommit=0;
begin;
savepoint `my_savepoint`;
insert into t1 values (7);
savepoint `savept2`;
insert into t1 values (3);
select n from t1;
n
3
4
5
6
7
rollback to savepoint `savept2`;
release savepoint `my_savepoint`;
select n from t1;
n
4
5
6
7
rollback to savepoint `my_savepoint`;
ERROR HY000: Got error 153 during ROLLBACK
set autocommit=1;
rollback;
drop table t1;
create table t1 (n int not null primary key) engine=innodb;
@@ -1609,14 +1633,14 @@ t2 CREATE TABLE `t2` (
drop table t2, t1;
show status like "binlog_cache_use";
Variable_name	Value
Binlog_cache_use	24
Binlog_cache_use	25
show status like "binlog_cache_disk_use";
Variable_name	Value
Binlog_cache_disk_use	0
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name	Value
Binlog_cache_use	25
Binlog_cache_use	26
show status like "binlog_cache_disk_use";
Variable_name	Value
Binlog_cache_disk_use	1
@@ -1625,7 +1649,7 @@ delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name	Value
Binlog_cache_use	26
Binlog_cache_use	27
show status like "binlog_cache_disk_use";
Variable_name	Value
Binlog_cache_disk_use	1
@@ -1693,10 +1717,10 @@ Variable_name Value
Innodb_rows_deleted	2070
show status like "Innodb_rows_inserted";
Variable_name	Value
Innodb_rows_inserted	31706
Innodb_rows_inserted	31708
show status like "Innodb_rows_read";
Variable_name	Value
Innodb_rows_read	80153
Innodb_rows_read	80162
show status like "Innodb_rows_updated";
Variable_name	Value
Innodb_rows_updated	29530
+13 −0
Original line number Diff line number Diff line
@@ -129,6 +129,19 @@ insert into t1 values (6);
-- error 1062
insert into t1 values (4);
select n from t1;
set autocommit=0;
begin;
savepoint `my_savepoint`;
insert into t1 values (7);
savepoint `savept2`;
insert into t1 values (3);
select n from t1;
rollback to savepoint `savept2`;
release savepoint `my_savepoint`;
select n from t1;
-- error 1181
rollback to savepoint `my_savepoint`;
set autocommit=1;
# nop
rollback;
drop table t1;
+25 −0
Original line number Diff line number Diff line
@@ -1612,6 +1612,31 @@ innobase_rollback_to_savepoint(
	DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
}

/*********************************************************************
Release transaction savepoint name. */

int
innobase_release_savepoint_name(
/*===========================*/
				/* out: 0 if success, HA_ERR_NO_SAVEPOINT if
				no savepoint with the given name */
	THD*	thd,		/* in: handle to the MySQL thread of the user
				whose transaction should be rolled back */
	char*	savepoint_name)	/* in: savepoint name */
{
	ib_longlong mysql_binlog_cache_pos;
	int	    error = 0;
	trx_t*	    trx;

	DBUG_ENTER("innobase_release_savepoint_name");

	trx = check_trx_exists(thd);

	error = trx_release_savepoint_for_mysql(trx, savepoint_name);

	DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
}

/*********************************************************************
Sets a transaction savepoint. */

Loading