Commit 3fbf812f authored by unknown's avatar unknown

Remove unneeded module "com"


BitKeeper/deleted/.del-Makefile.am~2b013aa835a140c4:
  Delete: innobase/com/Makefile.am
BitKeeper/deleted/.del-com0com.c~473a1f0f440ce91b:
  Delete: innobase/com/com0com.c
BitKeeper/deleted/.del-com0shm.c~6a16f0c3d81de1f:
  Delete: innobase/com/com0shm.c
BitKeeper/deleted/.del-makefilewin~3e26f0df100887f2:
  Delete: innobase/com/makefilewin
BitKeeper/deleted/.del-com0com.h~533a7eaa16ec585a:
  Delete: innobase/include/com0com.h
BitKeeper/deleted/.del-com0com.ic~671e309916e285b:
  Delete: innobase/include/com0com.ic
BitKeeper/deleted/.del-com0shm.h~5f3df7c04221b0fe:
  Delete: innobase/include/com0shm.h
BitKeeper/deleted/.del-com0shm.ic~f827cfca1603fa6b:
  Delete: innobase/include/com0shm.ic
innobase/configure.in:
  Remove com/Makefile
innobase/include/Makefile.am:
  Remove com*.h
innobase/include/usr0sess.h:
  Remove unused communication functions
innobase/include/usr0sess.ic:
  Remove unused communication functions
innobase/include/usr0types.h:
  Remove sess_sys_t and sess_sig_t
innobase/usr/usr0sess.c:
  Remove unused functions
innobase/dict/dict0crea.c:
  Remove unneeded params of que_fork_start_command()
innobase/include/que0que.h:
  Remove unneeded params of que_fork_start_command()
innobase/row/row0mysql.c:
  Remove unneeded params of que_fork_start_command()
innobase/include/srv0srv.h:
  Remove references to the com module
innobase/srv/srv0srv.c:
  Remove references to the com module
  Remove unused vars srv_n_{com,worker}_threads
  Make some global vars static
innobase/que/que0que.c:
  Remove references to odbc
  Add #ifdef UNIV_SYNC_DEBUG around some ut_ad()
  Remove unneeded params of que_fork_start_command()
  Remove unreachable code
  Output diagnostics to stderr, not stdout
innobase/include/trx0trx.h:
  Remove unneeded params of trx_sig_send() and trx_sig_reply()
innobase/trx/trx0trx.c:
  Remove unneeded params of trx_sig_send() and trx_sig_reply()
  Remove params of sess_open()
innobase/srv/srv0start.c:
  Remove reference to com0com.h
  Remove call to sess_sys_init_at_db_start()
innobase/trx/trx0purge.c:
  Remove references to the com module
  Remove params of sess_open()
  Remove unneeded params of que_fork_start_command()
innobase/trx/trx0roll.c:
  Remove params of sess_open()
  Remove unneeded params of que_fork_start_command()
  Remove unneeded params of trx_sig_send() and trx_sig_reply()
parent 4d47802f
......@@ -22,7 +22,7 @@ TAR = gtar
noinst_HEADERS = ib_config.h
SUBDIRS = os ut btr buf com data dict dyn eval fil fsp fut \
SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \
ha ibuf include lock log mach mem mtr page \
pars que read rem row srv sync thr trx usr
......
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libcom.a
libcom_a_SOURCES = com0com.c com0shm.c
EXTRA_PROGRAMS =
/******************************************************
The communication primitives
(c) 1995 Innobase Oy
Created 9/23/1995 Heikki Tuuri
*******************************************************/
#include "com0com.h"
#ifdef UNIV_NONINL
#include "com0com.ic"
#endif
#include "mem0mem.h"
#include "com0shm.h"
/*
IMPLEMENTATION OF COMMUNICATION PRIMITIVES
==========================================
The primitives provide a uniform function interface for
use in communication. The primitives have been modeled
after the Windows Sockets interface. Below this uniform
API, the precise methods of communication, for example,
shared memory or Berkeley sockets, can be implemented
as subroutines.
*/
struct com_endpoint_struct{
ulint type; /* endpoint type */
void* par; /* type-specific data structures */
ibool bound; /* TRUE if the endpoint has been
bound to an address */
};
/*************************************************************************
Accessor functions for an endpoint */
UNIV_INLINE
ulint
com_endpoint_get_type(
/*==================*/
com_endpoint_t* ep)
{
ut_ad(ep);
return(ep->type);
}
UNIV_INLINE
void
com_endpoint_set_type(
/*==================*/
com_endpoint_t* ep,
ulint type)
{
ut_ad(ep);
ut_ad(type == COM_SHM);
ep->type = type;
}
UNIV_INLINE
void*
com_endpoint_get_par(
/*=================*/
com_endpoint_t* ep)
{
ut_ad(ep);
return(ep->par);
}
UNIV_INLINE
void
com_endpoint_set_par(
/*=================*/
com_endpoint_t* ep,
void* par)
{
ut_ad(ep);
ut_ad(par);
ep->par = par;
}
UNIV_INLINE
ibool
com_endpoint_get_bound(
/*===================*/
com_endpoint_t* ep)
{
ut_ad(ep);
return(ep->bound);
}
UNIV_INLINE
void
com_endpoint_set_bound(
/*===================*/
com_endpoint_t* ep,
ibool bound)
{
ut_ad(ep);
ep->bound = bound;
}
/*************************************************************************
Creates a communications endpoint. */
com_endpoint_t*
com_endpoint_create(
/*================*/
/* out, own: communications endpoint, NULL if
did not succeed */
ulint type) /* in: communication type of endpoint:
only COM_SHM supported */
{
com_endpoint_t* ep;
void* par;
ep = mem_alloc(sizeof(com_endpoint_t));
com_endpoint_set_type(ep, type);
com_endpoint_set_bound(ep, FALSE);
if (type == COM_SHM) {
par = com_shm_endpoint_create();
com_endpoint_set_par(ep, par);
} else {
par = NULL;
ut_error;
}
if (par != NULL) {
return(ep);
} else {
mem_free(ep);
return(NULL);
}
}
/*************************************************************************
Frees a communications endpoint. */
ulint
com_endpoint_free(
/*==============*/
/* out: O if succeed, else error number */
com_endpoint_t* ep) /* in, own: communications endpoint */
{
ulint type;
ulint ret;
void* par;
type = com_endpoint_get_type(ep);
par = com_endpoint_get_par(ep);
if (type == COM_SHM) {
ret = com_shm_endpoint_free((com_shm_endpoint_t*)par);
} else {
ret = 0;
ut_error;
}
if (ret) {
return(ret);
} else {
mem_free(ep);
return(0);
}
}
/*************************************************************************
Sets an option, like the maximum datagram size for an endpoint.
The options may vary depending on the endpoint type. */
ulint
com_endpoint_set_option(
/*====================*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: endpoint */
ulint optno, /* in: option number, only
COM_OPT_MAX_DGRAM_SIZE currently supported */
byte* optval, /* in: pointer to a buffer containing the
option value to set */
ulint optlen) /* in: option value buffer length */
{
ulint type;
ulint ret;
void* par;
type = com_endpoint_get_type(ep);
par = com_endpoint_get_par(ep);
if (type == COM_SHM) {
ret = com_shm_endpoint_set_option((com_shm_endpoint_t*)par,
optno, optval, optlen);
} else {
ret = 0;
ut_error;
}
return(ret);
}
/*************************************************************************
Binds a communications endpoint to the specified address. */
ulint
com_bind(
/*=====*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: communications endpoint */
char* name, /* in: address name */
ulint len) /* in: name length */
{
ulint type;
ulint ret;
void* par;
ut_ad(len <= COM_MAX_ADDR_LEN);
if (com_endpoint_get_bound(ep)) {
return(COM_ERR_ALREADY_BOUND);
}
type = com_endpoint_get_type(ep);
par = com_endpoint_get_par(ep);
if (type == COM_SHM) {
ret = com_shm_bind((com_shm_endpoint_t*)par, name, len);
} else {
ret = 0;
ut_error;
}
if (ret == 0) {
com_endpoint_set_bound(ep, TRUE);
}
return(ret);
}
/*************************************************************************
Waits for a datagram to arrive at an endpoint. */
ulint
com_recvfrom(
/*=========*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: communications endpoint */
byte* buf, /* out: datagram buffer; the buffer is
supplied by the caller */
ulint buf_len,/* in: datagram buffer length */
ulint* len, /* out: datagram length */
char* from, /* out: address name buffer; the buffer is
supplied by the caller */
ulint from_len,/* in: address name buffer length */
ulint* addr_len)/* out: address name length */
{
ulint type;
ulint ret;
void* par;
if (!com_endpoint_get_bound(ep)) {
return(COM_ERR_NOT_BOUND);
}
type = com_endpoint_get_type(ep);
par = com_endpoint_get_par(ep);
if (type == COM_SHM) {
ret = com_shm_recvfrom((com_shm_endpoint_t*)par,
buf, buf_len, len, from, from_len,
addr_len);
} else {
ret = 0;
ut_error;
}
return(ret);
}
/*************************************************************************
Sends a datagram to the specified destination. */
ulint
com_sendto(
/*=======*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: communications endpoint */
byte* buf, /* in: datagram buffer */
ulint len, /* in: datagram length */
char* to, /* in: address name buffer */
ulint tolen) /* in: address name length */
{
ulint type;
ulint ret;
void* par;
if (!com_endpoint_get_bound(ep)) {
return(COM_ERR_NOT_BOUND);
}
type = com_endpoint_get_type(ep);
par = com_endpoint_get_par(ep);
if (type == COM_SHM) {
ret = com_shm_sendto((com_shm_endpoint_t*)par, buf, len,
to, tolen);
} else {
ret = 0;
ut_error;
}
return(ret);
}
/*************************************************************************
Gets the maximum datagram size for an endpoint. */
ulint
com_endpoint_get_max_size(
/*======================*/
/* out: maximum size */
com_endpoint_t* ep) /* in: endpoint */
{
ulint type;
ulint ret;
void* par;
type = com_endpoint_get_type(ep);
par = com_endpoint_get_par(ep);
if (type == COM_SHM) {
ret = com_shm_endpoint_get_size((com_shm_endpoint_t*)par);
} else {
ret = 0;
ut_error;
}
return(ret);
}
This diff is collapsed.
include ..\include\makefile.i
com.lib: com0com.obj com0shm.obj
lib -out:..\libs\com.lib com0com.obj com0shm.obj
com0com.obj: com0com.c
$(CCOM) $(CFL) -c com0com.c
com0shm.obj: com0shm.c
$(CCOM) $(CFL) -c com0shm.c
......@@ -111,7 +111,7 @@ case "$target" in
esac
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl
buf/Makefile com/Makefile data/Makefile dnl
buf/Makefile data/Makefile dnl
dict/Makefile dyn/Makefile dnl
eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl
ha/Makefile ibuf/Makefile include/Makefile dnl
......
......@@ -1088,7 +1088,7 @@ dict_create_or_check_foreign_constraint_tables(void)
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
ut_a(thr = que_fork_start_command(graph, SESS_COMM_EXECUTE, 0));
ut_a(thr = que_fork_start_command(graph));
que_run_threads(thr);
......@@ -1233,7 +1233,7 @@ dict_create_add_foreigns_to_dictionary(
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
ut_a(thr = que_fork_start_command(graph, SESS_COMM_EXECUTE, 0));
ut_a(thr = que_fork_start_command(graph));
que_run_threads(thr);
......
......@@ -18,8 +18,7 @@
noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \
btr0pcur.h btr0pcur.ic btr0sea.h btr0sea.ic btr0types.h \
buf0buf.h buf0buf.ic buf0flu.h buf0flu.ic buf0lru.h \
buf0lru.ic buf0rea.h buf0types.h com0com.h com0com.ic \
com0shm.h com0shm.ic data0data.h data0data.ic data0type.h \
buf0lru.ic buf0rea.h buf0types.h data0data.h data0data.ic data0type.h \
data0type.ic data0types.h db0err.h dict0boot.h \
dict0boot.ic dict0crea.h dict0crea.ic dict0dict.h \
dict0dict.ic dict0load.h dict0load.ic dict0mem.h \
......
/******************************************************
The communication primitives
(c) 1995 Innobase Oy
Created 9/23/1995 Heikki Tuuri
*******************************************************/
/* This module defines a standard datagram communication
function interface for use in the database. We assume that
the communication medium is reliable. */
#ifndef com0com_h
#define com0com_h
#include "univ.i"
/* The communications endpoint type definition */
typedef struct com_endpoint_struct com_endpoint_t;
/* Possible endpoint communication types */
#define COM_SHM 1 /* communication through shared memory */
/* Option numbers for endpoint */
#define COM_OPT_MAX_DGRAM_SIZE 1
/* Error numbers */
#define COM_ERR_NOT_SPECIFIED 1
#define COM_ERR_NOT_BOUND 2
#define COM_ERR_ALREADY_BOUND 3
#define COM_ERR_MAX_DATAGRAM_SIZE_NOT_SET 4
#define COM_ERR_DATA_BUFFER_TOO_SMALL 5
#define COM_ERR_ADDR_BUFFER_TOO_SMALL 6
#define COM_ERR_DATA_TOO_LONG 7
#define COM_ERR_ADDR_TOO_LONG 8
#define COM_ERR_DGRAM_NOT_DELIVERED 9
/* Maximum allowed address length in bytes */
#define COM_MAX_ADDR_LEN 100
/*************************************************************************
Creates a communications endpoint. */
com_endpoint_t*
com_endpoint_create(
/*================*/
/* out, own: communications endpoint, NULL if
did not succeed */
ulint type); /* in: communication type of endpoint:
only COM_SHM supported */
/*************************************************************************
Frees a communications endpoint. */
ulint
com_endpoint_free(
/*==============*/
/* out: O if succeed, else error number */
com_endpoint_t* ep); /* in, own: communications endpoint */
/*************************************************************************
Sets an option, like the maximum datagram size for an endpoint.
The options may vary depending on the endpoint type. */
ulint
com_endpoint_set_option(
/*====================*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: endpoint */
ulint optno, /* in: option number, only
COM_OPT_MAX_DGRAM_SIZE currently supported */
byte* optval, /* in: pointer to a buffer containing the
option value to set */
ulint optlen);/* in: option value buffer length */
/*************************************************************************
Binds a communications endpoint to a specified address. */
ulint
com_bind(
/*=====*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: communications endpoint */
char* name, /* in: address name */
ulint len); /* in: name length */
/*************************************************************************
Waits for a datagram to arrive at an endpoint. */
ulint
com_recvfrom(
/*=========*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: communications endpoint */
byte* buf, /* out: datagram buffer; the buffer must be
supplied by the caller */
ulint buf_len,/* in: datagram buffer length */
ulint* len, /* out: datagram length */
char* from, /* out: address name buffer; the buffer must be
supplied by the caller */
ulint from_len,/* in: address name buffer length */
ulint* addr_len);/* out: address name length */
/*************************************************************************
Sends a datagram to a specified destination. */
ulint
com_sendto(
/*=======*/
/* out: 0 if succeed, else error number */
com_endpoint_t* ep, /* in: communications endpoint */
byte* buf, /* in: datagram buffer */
ulint len, /* in: datagram length */
char* to, /* in: address name buffer */
ulint tolen); /* in: address name length */
/*************************************************************************
Gets the maximum datagram size for an endpoint. */
ulint
com_endpoint_get_max_size(
/*======================*/
/* out: maximum size */
com_endpoint_t* ep); /* in: endpoint */
#ifndef UNIV_NONINL
#include "com0com.ic"
#endif
#endif
/******************************************************
The communication primitives
(c) 1995 Innobase Oy
Created 9/23/1995 Heikki Tuuri
*******************************************************/
/******************************************************
The communication through shared memory
(c) 1995 Innobase Oy
Created 9/23/1995 Heikki Tuuri
*******************************************************/
#ifndef com0shm_h
#define com0shm_h
#include "univ.i"
typedef struct com_shm_endpoint_struct com_shm_endpoint_t;
/* The performance of communication in NT depends on how
many times a system call is made (excluding os_thread_yield,
as that is the fastest way to switch thread).
The following variable counts such events. */
extern ulint com_shm_system_call_count;
/*************************************************************************
Creates a communications endpoint. */
com_shm_endpoint_t*
com_shm_endpoint_create(void);
/*=========================*/
/* out, own: communications endpoint, NULL if
did not succeed */
/*************************************************************************
Frees a communications endpoint. */
ulint
com_shm_endpoint_free(
/*==================*/
/* out: O if succeed, else error number */
com_shm_endpoint_t* ep);/* in, own: communications endpoint */
/*************************************************************************
Sets an option, like the maximum datagram size for an endpoint.
The options may vary depending on the endpoint type. */
ulint
com_shm_endpoint_set_option(
/*========================*/
/* out: 0 if succeed, else error number */
com_shm_endpoint_t* ep, /* in: endpoint */
ulint optno, /* in: option number, only
COM_OPT_MAX_DGRAM_SIZE currently supported */
byte* optval, /* in: pointer to a buffer containing the
option value to set */
ulint optlen);/* in: option value buffer length */
/*************************************************************************
Bind a communications endpoint to a specified address. */
ulint
com_shm_bind(
/*=========*/
/* out: 0 if succeed, else error number */
com_shm_endpoint_t* ep, /* in: communications endpoint */
char* name, /* in: address name */
ulint len); /* in: address name length */
/*************************************************************************
Waits for a datagram to arrive at an endpoint. */
ulint
com_shm_recvfrom(
/*=============*/
/* out: 0 if succeed, else error number */
com_shm_endpoint_t* ep, /* in: communications endpoint */
byte* buf, /* out: datagram buffer; the buffer is
supplied by the caller */
ulint buf_len,/* in: datagram buffer length */
ulint* len, /* out: datagram length */
char* from, /* out: address name buffer; the buffer is
supplied by the caller */
ulint from_len,/* in: address name buffer length */
ulint* addr_len);/* out: address name length */
/*************************************************************************
Sends a datagram to the specified destination. */
ulint
com_shm_sendto(
/*===========*/
/* out: 0 if succeed, else error number */
com_shm_endpoint_t* ep, /* in: communications endpoint */
byte* buf, /* in: datagram buffer */
ulint len, /* in: datagram length */
char* to, /* in: address name buffer */
ulint tolen); /* in: address name length */
ulint
com_shm_endpoint_get_size(
/*======================*/
com_shm_endpoint_t* ep);
#ifndef UNIV_NONINL
#include "com0shm.ic"
#endif
#endif
/******************************************************
Communication through shared memory
(c) 1995 Innobase Oy
Created 9/23/1995 Heikki Tuuri
*******************************************************/
......@@ -216,9 +216,7 @@ que_fork_start_command(
QUE_THR_RUNNING state, or NULL; the query
thread should be executed by que_run_threads
by the caller */
que_fork_t* fork, /* in: a query fork */
ulint command,/* in: command SESS_COMM_FETCH_NEXT, ... */
ulint param); /* in: possible parameter to the command */
que_fork_t* fork); /* in: a query fork */
/***************************************************************************
Gets the trx of a query thread. */
UNIV_INLINE
......@@ -388,11 +386,6 @@ struct que_fork_struct{
sym_tab_t* sym_tab; /* symbol table of the query,
generated by the parser, or NULL
if the graph was created 'by hand' */
ulint id; /* id of this query graph */
ulint command; /* command currently executed in the
graph */
ulint param; /* possible command parameter */
/* The following cur_... fields are relevant only in a select graph */
ulint cur_end; /* QUE_CUR_NOT_DEFINED, QUE_CUR_START,
......
......@@ -13,7 +13,6 @@ Created 10/10/1995 Heikki Tuuri
#include "univ.i"
#include "sync0sync.h"
#include "os0sync.h"
#include "com0com.h"
#include "que0types.h"
#include "trx0types.h"
......@@ -398,9 +397,6 @@ struct srv_sys_struct{
os_event_t operational; /* created threads must wait for the
server to become operational by
waiting for this event */
com_endpoint_t* endpoint; /* the communication endpoint of the
server */
srv_table_t* threads; /* server thread table */
UT_LIST_BASE_NODE_T(que_thr_t)
tasks; /* task queue */
......
......@@ -203,13 +203,9 @@ trx_sig_send(
ulint type, /* in: signal type */
ulint sender, /* in: TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
ibool reply, /* in: TRUE if the sender of the signal
wants reply after the operation induced
by the signal is completed; if type
is TRX_SIG_END_WAIT, this must be
FALSE */
que_thr_t* receiver_thr, /* in: query thread which wants the
reply, or NULL */
reply, or NULL; if type is
TRX_SIG_END_WAIT, this must be NULL */
trx_savept_t* savept, /* in: possible rollback savepoint, or
NULL */
que_thr_t** next_thr); /* in/out: next query thread to run;
......@@ -225,7 +221,6 @@ been handled. */
void
trx_sig_reply(
/*==========*/
trx_t* trx, /* in: trx handle */
trx_sig_t* sig, /* in: signal */
que_thr_t** next_thr); /* in/out: next query thread to run;
if the value which is passed in is
......@@ -297,15 +292,9 @@ struct trx_sig_struct{
TRX_SIG_BEING_HANDLED */
ulint sender; /* TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
ibool reply; /* TRUE if the sender of the signal
que_thr_t* receiver; /* non-NULL if the sender of the signal
wants reply after the operation induced
by the signal is completed; if this
field is TRUE and the receiver field
below is NULL, then a SUCCESS message
is sent to the client of the session
to which this trx belongs */
que_thr_t* receiver; /* query thread which wants the reply,
or NULL */
by the signal is completed */
trx_savept_t savept; /* possible rollback savepoint */
UT_LIST_NODE_T(trx_sig_t)
signals; /* queue of pending signals to the
......
......@@ -11,7 +11,6 @@ Created 6/25/1996 Heikki Tuuri
#include "univ.i"
#include "ut0byte.h"
#include "hash0hash.h"
#include "trx0types.h"
#include "srv0srv.h"
#include "trx0types.h"
......@@ -19,52 +18,14 @@ Created 6/25/1996 Heikki Tuuri
#include "que0types.h"
#include "data0data.h"
#include "rem0rec.h"
#include "com0com.h"
/* The session system global data structure */
extern sess_sys_t* sess_sys;
/*************************************************************************
Sets the session id in a client message. */
void
sess_cli_msg_set_sess(
/*==================*/
byte* str, /* in/out: message string */
dulint sess_id);/* in: session id */
/***************************************************************************
Sets the message type of a message from the client. */
UNIV_INLINE
void
sess_cli_msg_set_type(
/*==================*/
byte* str, /* in: message string */
ulint type); /* in: message type */
/***************************************************************************
Gets the message type of a message from the server. */
UNIV_INLINE
ulint
sess_srv_msg_get_type(
/*==================*/
/* out: message type */
byte* str); /* in: message string */
/***************************************************************************
Creates a session sytem at database start. */
void
sess_sys_init_at_db_start(void);
/*===========================*/
/*************************************************************************
Opens a session. */
sess_t*
sess_open(
/*======*/
sess_open(void);
/*============*/
/* out, own: session object */
com_endpoint_t* endpoint, /* in: communication endpoint used
for communicating with the client */
byte* addr_buf, /* in: client address */
ulint addr_len); /* in: client address length */
/*************************************************************************
Closes a session, freeing the memory occupied by it, if it is in a state
where it should be closed. */
......@@ -74,200 +35,25 @@ sess_try_close(
/*===========*/
/* out: TRUE if closed */
sess_t* sess); /* in, own: session object */
/*************************************************************************
Initializes the first fields of a message to client. */
void
sess_srv_msg_init(
/*==============*/
sess_t* sess, /* in: session object */
byte* buf, /* in: message buffer, must be at least of size
SESS_SRV_MSG_DATA */
ulint type); /* in: message type */
/*************************************************************************
Sends a simple message to client. */
void
sess_srv_msg_send_simple(
/*=====================*/
sess_t* sess, /* in: session object */
ulint type, /* in: message type */
ulint rel_kernel); /* in: SESS_RELEASE_KERNEL or
SESS_NOT_RELEASE_KERNEL */
/***************************************************************************
When a command has been completed, this function sends the message about it
to the client. */
void
sess_command_completed_message(
/*===========================*/
sess_t* sess, /* in: session */
byte* msg, /* in: message buffer */
ulint len); /* in: message data length */
/* The session handle. All fields are protected by the kernel mutex */
struct sess_struct{
dulint id; /* session id */
dulint usr_id; /* user id */
hash_node_t hash; /* hash chain node */
ulint refer_count; /* reference count to the session
object: when this drops to zero
and the session has no query graphs
left, discarding the session object
is allowed */
dulint error_count; /* if this counter has increased while
a thread is parsing an SQL command,
its graph should be discarded */
ibool disconnecting; /* TRUE if the session is to be
disconnected when its reference
count drops to 0 */
ulint state; /* state of the session */
dulint msgs_sent; /* count of messages sent to the
client */
dulint msgs_recv; /* count of messages received from the
client */
ibool client_waits; /* when the session receives a message
from the client, this set to TRUE, and
when the session sends a message to
the client this is set to FALSE */
trx_t* trx; /* transaction object permanently
assigned for the session: the
transaction instance designated by the
trx id changes, but the memory
structure is preserved */
ulint next_graph_id; /* next query graph id to assign */
UT_LIST_BASE_NODE_T(que_t)
graphs; /* query graphs belonging to this
session */
/*------------------------------*/
ulint err_no; /* latest error number, 0 if none */
char* err_str; /* latest error string */
ulint err_len; /* error string length */
/*------------------------------*/
com_endpoint_t* endpoint; /* server communications endpoint used
to communicate with the client */
char* addr_buf; /* client address string */
ulint addr_len; /* client address string length */
/*------------------------------*/
byte* big_msg; /* if the client sends a message which
does not fit in a single packet,
it is assembled in this buffer; if
this field is not NULL, it is assumed
that the message should be catenated
here */
ulint big_msg_size; /* size of the big message buffer */
ulint big_msg_len; /* length of data in the big message
buffer */
};
/* The session system; this is protected by the kernel mutex */
struct sess_sys_struct{
ulint state; /* state of the system:
SESS_SYS_RUNNING or
SESS_SYS_SHUTTING_DOWN */
sess_t* shutdown_req; /* if shutdown was requested by some
session, confirmation of shutdown
completion should be sent to this
session */
dulint free_sess_id; /* first unused session id */
hash_table_t* hash; /* hash table of the sessions */
};
/*---------------------------------------------------*/
/* The format of an incoming message from a client */
#define SESS_CLI_MSG_CHECKSUM 0 /* the checksum should be the first
field in the message */
#define SESS_CLI_MSG_SESS_ID 4 /* this is set to 0 if the client
wants to connect and establish
a new session */
#define SESS_CLI_MSG_SESS_ID_CHECK 12 /* checksum of the sess id field */
#define SESS_CLI_MSG_TYPE 16
#define SESS_CLI_MSG_NO 20
#define SESS_CLI_MSG_CONTINUE 28 /* 0, or SESS_MSG_FIRST_PART
SESS_MSG_MIDDLE_PART, or
SESS_MSG_LAST_PART */
#define SESS_CLI_MSG_CONT_SIZE 32 /* size of a multipart message in
kilobytes (rounded upwards) */
#define SESS_CLI_MSG_DATA 36
/*---------------------------------------------------*/
/* Client-to-session message types */
#define SESS_CLI_CONNECT 1
#define SESS_CLI_PREPARE 2
#define SESS_CLI_EXECUTE 3
#define SESS_CLI_BREAK_EXECUTION 4
/* Client-to-session statement command types */
#define SESS_COMM_FETCH_NEXT 1
#define SESS_COMM_FETCH_PREV 2
#define SESS_COMM_FETCH_FIRST 3
#define SESS_COMM_FETCH_LAST 4
#define SESS_COMM_FETCH_NTH 5
#define SESS_COMM_FETCH_NTH_LAST 6
#define SESS_COMM_EXECUTE 7
#define SESS_COMM_NO_COMMAND 8
/*---------------------------------------------------*/
/* The format of an outgoing message from a session to the client */
#define SESS_SRV_MSG_CHECKSUM 0 /* the checksum should be the first
field in the message */
#define SESS_SRV_MSG_SESS_ID 4
#define SESS_SRV_MSG_TYPE 12
#define SESS_SRV_MSG_NO 16
#define SESS_SRV_MSG_CONTINUE 24 /* 0, or SESS_MSG_FIRST_PART
SESS_MSG_MIDDLE_PART, or
SESS_MSG_LAST_PART */
#define SESS_SRV_MSG_CONT_SIZE 28 /* size of a multipart message
in kilobytes (rounded upward) */
#define SESS_SRV_MSG_DATA 32
/*---------------------------------------------------*/
/* Session-to-client message types */
#define SESS_SRV_ACCEPT_CONNECT 1
#define SESS_SRV_SUCCESS 2
#define SESS_SRV_ERROR 3
/* Multipart messages */
#define SESS_MSG_SINGLE_PART 0
#define SESS_MSG_FIRST_PART 1
#define SESS_MSG_MIDDLE_PART 2
#define SESS_MSG_LAST_PART 3
/* Error numbers */
#define SESS_ERR_NONE 0
#define SESS_ERR_TRX_COMMITTED 1
#define SESS_ERR_TRX_ROLLED_BACK 2
#define SESS_ERR_SESSION_DISCONNECTED 3
#define SESS_ERR_REPLY_FAILED 4
#define SESS_ERR_CANNOT_BREAK_OP 5
#define SESS_ERR_MSG_LOST 6
#define SESS_ERR_MSG_CORRUPTED 7
#define SESS_ERR_EXTRANEOUS_MSG 8
#define SESS_ERR_OUT_OF_MEMORY 9
#define SESS_ERR_SQL_ERROR 10
#define SESS_ERR_STMT_NOT_FOUND 11
#define SESS_ERR_STMT_NOT_READY 12
#define SESS_ERR_EXTRANEOUS_SRV_MSG 13
#define SESS_ERR_BREAK_BY_CLIENT 14
/* Session states */
#define SESS_ACTIVE 1
#define SESS_ERROR 2 /* session contains an error message
which has not yet been communicated
to the client */
/* Session system states */
#define SESS_SYS_RUNNING 1
#define SESS_SYS_SHUTTING_DOWN 2
/* Session hash table size */
#define SESS_HASH_SIZE 1024
/* Flags used in sess_srv_msg_send */
#define SESS_RELEASE_KERNEL 1
#define SESS_NOT_RELEASE_KERNEL 2
#ifndef UNIV_NONINL
#include "usr0sess.ic"
#endif
......
......@@ -5,27 +5,3 @@ Sessions
Created 6/25/1996 Heikki Tuuri
*******************************************************/
/***************************************************************************
Sets the message type of a message from the client. */
UNIV_INLINE
void
sess_cli_msg_set_type(
/*==================*/
byte* str, /* in: message string */
ulint type) /* in: message type */
{
mach_write_to_4(str + SESS_CLI_MSG_TYPE, type);
}
/***************************************************************************
Gets the message type of a message from the server. */
UNIV_INLINE
ulint
sess_srv_msg_get_type(
/*==================*/
/* out: message type */
byte* str) /* in: message string */
{
return(mach_read_from_4(str + SESS_SRV_MSG_TYPE));
}
......@@ -10,7 +10,5 @@ Created 6/25/1996 Heikki Tuuri
#define usr0types_h
typedef struct sess_struct sess_t;
typedef struct sess_sys_struct sess_sys_t;
typedef struct sess_sig_struct sess_sig_t;
#endif
......@@ -25,7 +25,6 @@ Created 5/27/1996 Heikki Tuuri
#include "log0log.h"
#include "eval0proc.h"
#include "eval0eval.h"
#include "odbc0odbc.h"
#define QUE_PARALLELIZE_LIMIT (64 * 256 * 256 * 256)
#define QUE_ROUND_ROBIN_LIMIT (64 * 256 * 256 * 256)
......@@ -83,7 +82,9 @@ que_graph_publish(
que_t* graph, /* in: graph */
sess_t* sess) /* in: session */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
UT_LIST_ADD_LAST(graphs, sess->graphs, graph);
}
......@@ -190,7 +191,9 @@ que_thr_end_wait(
{
ibool was_active;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
......@@ -229,7 +232,9 @@ que_thr_end_wait_no_next_thr(
ut_a(thr->state == QUE_THR_LOCK_WAIT); /* In MySQL this is the
only possible state here */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
......@@ -279,15 +284,9 @@ que_fork_start_command(
QUE_THR_RUNNING state, or NULL; the query
thread should be executed by que_run_threads
by the caller */
que_fork_t* fork, /* in: a query fork */
ulint command,/* in: command SESS_COMM_FETCH_NEXT, ... */
ulint param) /* in: possible parameter to the command */
que_fork_t* fork) /* in: a query fork */
{
que_thr_t* thr;
/* Set the command parameters in the fork root */
fork->command = command;
fork->param = param;
fork->state = QUE_FORK_ACTIVE;
......@@ -370,7 +369,9 @@ que_fork_error_handle(
{
que_thr_t* thr;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->sess->state == SESS_ERROR);
ut_ad(UT_LIST_GET_LEN(trx->reply_signals) == 0);
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
......@@ -640,7 +641,9 @@ que_graph_try_free(
{
sess_t* sess;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
sess = (graph->trx)->sess;
......@@ -665,49 +668,20 @@ does nothing! */
void
que_thr_handle_error(
/*=================*/
que_thr_t* thr, /* in: query thread */
ulint err_no, /* in: error number */
byte* err_str,/* in, own: error string or NULL; NOTE: the
que_thr_t* thr __attribute((unused)),
/* in: query thread */
ulint err_no __attribute((unused)),
/* in: error number */
byte* err_str __attribute((unused)),
/* in, own: error string or NULL; NOTE: the
function will take care of freeing of the
string! */
ulint err_len)/* in: error string length */
ulint err_len __attribute((unused)))
/* in: error string length */
{
UT_NOT_USED(thr);
UT_NOT_USED(err_no);
UT_NOT_USED(err_str);
UT_NOT_USED(err_len);
/* Does nothing */
}
/********************************************************************
Builds a command completed-message to the client. */
static
ulint
que_build_srv_msg(
/*==============*/
/* out: message data length */
byte* buf, /* in: message buffer */
que_fork_t* fork, /* in: query graph where execution completed */
sess_t* sess) /* in: session */
{
ulint len;
/* Currently, we only support stored procedures: */
ut_ad(fork->fork_type == QUE_FORK_PROCEDURE);
if (sess->state == SESS_ERROR) {
return(0);
}
sess_srv_msg_init(sess, buf, SESS_SRV_SUCCESS);
len = pars_proc_write_output_params_to_buf(buf + SESS_SRV_MSG_DATA,
fork);
return(len);
}
/********************************************************************
Performs an execution step on a thr node. */
static
......@@ -804,10 +778,6 @@ que_thr_dec_refer_count(
que_fork_t* fork;
trx_t* trx;
sess_t* sess;
ibool send_srv_msg = FALSE;
ibool release_stored_proc = FALSE;
ulint msg_len = 0;
byte msg_buf[ODBC_DATAGRAM_SIZE];
ulint fork_type;
ibool stopped;
......@@ -828,8 +798,8 @@ que_thr_dec_refer_count(
already canceled before we came here: continue
running the thread */
/* printf(
"!!!!!!!!!! Wait already ended: continue thr\n"); */
/* fputs("!!!!!!!! Wait already ended: continue thr\n",
stderr); */
if (next_thr && *next_thr == NULL) {
*next_thr = thr;
......@@ -882,40 +852,13 @@ que_thr_dec_refer_count(
} else if (fork_type == QUE_FORK_MYSQL_INTERFACE) {
/* Do nothing */
} else if (fork->common.parent == NULL
&& fork->caller == NULL
&& UT_LIST_GET_LEN(trx->signals) == 0) {
ut_a(0); /* not used in MySQL */
/* Reply to the client */
/* que_thr_add_update_info(thr); */
fork->state = QUE_FORK_COMMAND_WAIT;
msg_len = que_build_srv_msg(msg_buf, fork, sess);
send_srv_msg = TRUE;
if (fork->fork_type == QUE_FORK_PROCEDURE) {
release_stored_proc = TRUE;
}
ut_ad(trx->graph == fork);
trx->graph = NULL;
} else {
/* Subprocedure calls not implemented yet */
ut_a(0);
ut_error; /* not used in MySQL */
}
}
if (UT_LIST_GET_LEN(trx->signals) > 0 && trx->n_active_thrs == 0) {
ut_ad(!send_srv_msg);
/* If the trx is signaled and its query thread count drops to
zero, then we start processing a signal; from it we may get
a new query thread to run */
......@@ -929,26 +872,6 @@ que_thr_dec_refer_count(
}
mutex_exit(&kernel_mutex);
if (send_srv_msg) {
/* Note that, as we do not own the kernel mutex at this point,
and neither do we own it all the time when doing the actual
communication operation within the next function, it is
possible that the messages will not get delivered in the right
sequential order. This is possible if the client communicates
an extra message to the server while the message below is still
undelivered. But then the client should notice that there
is an error in the order numbers of the messages. */
sess_command_completed_message(sess, msg_buf, msg_len);
}
if (release_stored_proc) {
/* Return the stored procedure graph to the dictionary cache */
dict_procedure_release_parsed_copy(fork);
}
}
/**************************************************************************
......@@ -966,7 +889,9 @@ que_thr_stop(
que_t* graph;
ibool ret = TRUE;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
graph = thr->graph;
trx = graph->trx;
......@@ -1117,59 +1042,56 @@ que_node_print_info(
/*================*/
que_node_t* node) /* in: query graph node */
{
ulint type;
char* str;
ulint addr;
ulint type;
const char* str;
type = que_node_get_type(node);
addr = (ulint)node;
if (type == QUE_NODE_SELECT) {
str = (char *) "SELECT";
str = "SELECT";
} else if (type == QUE_NODE_INSERT) {
str = (char *) "INSERT";
str = "INSERT";
} else if (type == QUE_NODE_UPDATE) {
str = (char *) "UPDATE";
str = "UPDATE";
} else if (type == QUE_NODE_WHILE) {
str = (char *) "WHILE";
str = "WHILE";
} else if (type == QUE_NODE_ASSIGNMENT) {
str = (char *) "ASSIGNMENT";
str = "ASSIGNMENT";
} else if (type == QUE_NODE_IF) {
str = (char *) "IF";
str = "IF";
} else if (type == QUE_NODE_FETCH) {
str = (char *) "FETCH";
str = "FETCH";
} else if (type == QUE_NODE_OPEN) {
str = (char *) "OPEN";
str = "OPEN";
} else if (type == QUE_NODE_PROC) {
str = (char *) "STORED PROCEDURE";
str = "STORED PROCEDURE";
} else if (type == QUE_NODE_FUNC) {
str = (char *) "FUNCTION";
str = "FUNCTION";
} else if (type == QUE_NODE_LOCK) {
str = (char *) "LOCK";
str = "LOCK";
} else if (type == QUE_NODE_THR) {
str = (char *) "QUERY THREAD";
str = "QUERY THREAD";
} else if (type == QUE_NODE_COMMIT) {
str = (char *) "COMMIT";
str = "COMMIT";
} else if (type == QUE_NODE_UNDO) {
str = (char *) "UNDO ROW";
str = "UNDO ROW";
} else if (type == QUE_NODE_PURGE) {
str = (char *) "PURGE ROW";
str = "PURGE ROW";
} else if (type == QUE_NODE_ROLLBACK) {
str = (char *) "ROLLBACK";
str = "ROLLBACK";
} else if (type == QUE_NODE_CREATE_TABLE) {
str = (char *) "CREATE TABLE";
str = "CREATE TABLE";
} else if (type == QUE_NODE_CREATE_INDEX) {
str = (char *) "CREATE INDEX";
str = "CREATE INDEX";
} else if (type == QUE_NODE_FOR) {
str = (char *) "FOR LOOP";
str = "FOR LOOP";
} else if (type == QUE_NODE_RETURN) {
str = (char *) "RETURN";
str = "RETURN";
} else {
str = (char *) "UNKNOWN NODE TYPE";
str = "UNKNOWN NODE TYPE";
}
printf("Node type %lu: %s, address %lx\n", type, str, addr);
fprintf(stderr, "Node type %lu: %s, address %p\n", type, str, node);
}
/**************************************************************************
......@@ -1199,7 +1121,7 @@ que_thr_step(
#ifdef UNIV_DEBUG
if (que_trace_on) {
printf("To execute: ");
fputs("To execute: ", stderr);
que_node_print_info(node);
}
#endif
......@@ -1296,7 +1218,9 @@ que_run_threads(
ulint loop_count;
ut_ad(thr->state == QUE_THR_RUNNING);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
/* cumul_resource counts how much resources the OS thread (NOT the
query thread) has spent in this function */
......
......@@ -1402,8 +1402,7 @@ row_create_table_for_mysql(
thr = pars_complete_graph_for_exec(node, trx, heap);
ut_a(thr == que_fork_start_command(que_node_get_parent(thr),
SESS_COMM_EXECUTE, 0));
ut_a(thr == que_fork_start_command(que_node_get_parent(thr)));
que_run_threads(thr);
err = trx->error_state;
......@@ -1525,8 +1524,7 @@ row_create_index_for_mysql(
thr = pars_complete_graph_for_exec(node, trx, heap);
ut_a(thr == que_fork_start_command(que_node_get_parent(thr),
SESS_COMM_EXECUTE, 0));
ut_a(thr == que_fork_start_command(que_node_get_parent(thr)));
que_run_threads(thr);
err = trx->error_state;
......@@ -2070,7 +2068,7 @@ row_drop_table_for_mysql(
trx->dict_operation = TRUE;
trx->table_id = table->id;
ut_a(thr = que_fork_start_command(graph, SESS_COMM_EXECUTE, 0));
ut_a(thr = que_fork_start_command(graph));
que_run_threads(thr);
......@@ -2450,7 +2448,7 @@ row_rename_table_for_mysql(
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
ut_a(thr = que_fork_start_command(graph, SESS_COMM_EXECUTE, 0));
ut_a(thr = que_fork_start_command(graph));
que_run_threads(thr);
......
......@@ -34,8 +34,6 @@ Created 10/8/1995 Heikki Tuuri
#include "sync0sync.h"
#include "sync0ipm.h"
#include "thr0loc.h"
#include "com0com.h"
#include "com0shm.h"
#include "que0que.h"
#include "srv0que.h"
#include "log0recv.h"
......@@ -235,9 +233,6 @@ int srv_query_thread_priority = 0;
ulint srv_n_spin_wait_rounds = 20;
ulint srv_spin_wait_delay = 5;
ibool srv_priority_boost = TRUE;
char srv_endpoint_name[COM_MAX_ADDR_LEN];
ulint srv_n_com_threads = ULINT_MAX;
ulint srv_n_worker_threads = ULINT_MAX;
ibool srv_print_thread_releases = FALSE;
ibool srv_print_lock_waits = FALSE;
......@@ -245,14 +240,14 @@ ibool srv_print_buf_io = FALSE;
ibool srv_print_log_io = FALSE;
ibool srv_print_latch_waits = FALSE;
ulint srv_n_rows_inserted = 0;
ulint srv_n_rows_updated = 0;
ulint srv_n_rows_deleted = 0;
ulint srv_n_rows_read = 0;
ulint srv_n_rows_inserted_old = 0;
ulint srv_n_rows_updated_old = 0;
ulint srv_n_rows_deleted_old = 0;
ulint srv_n_rows_read_old = 0;
ulint srv_n_rows_inserted = 0;
ulint srv_n_rows_updated = 0;
ulint srv_n_rows_deleted = 0;
ulint srv_n_rows_read = 0;
static ulint srv_n_rows_inserted_old = 0;
static ulint srv_n_rows_updated_old = 0;
static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0;
/*
Set the following to 0 if you want InnoDB to write messages on
......
......@@ -39,7 +39,6 @@ Created 2/16/1996 Heikki Tuuri
#include "rem0rec.h"
#include "srv0srv.h"
#include "que0que.h"
#include "com0com.h"
#include "usr0sess.h"
#include "lock0lock.h"
#include "trx0roll.h"
......@@ -1211,8 +1210,6 @@ NetWare. */
mutex_exit(&(log_sys->mutex));
}
sess_sys_init_at_db_start();
if (create_new_db) {
mtr_start(&mtr);
......
......@@ -195,8 +195,6 @@ void
trx_purge_sys_create(void)
/*======================*/
{
com_endpoint_t* com_endpoint;
ut_ad(mutex_own(&kernel_mutex));
purge_sys = mem_alloc(sizeof(trx_purge_t));
......@@ -219,9 +217,7 @@ trx_purge_sys_create(void)
purge_sys->arr = trx_undo_arr_create();
com_endpoint = (com_endpoint_t*)purge_sys; /* This is a dummy non-NULL
value */
purge_sys->sess = sess_open(com_endpoint, (byte*)"purge_system", 13);
purge_sys->sess = sess_open();
purge_sys->trx = purge_sys->sess->trx;
......@@ -1034,11 +1030,11 @@ trx_purge(void)
mutex_enter(&kernel_mutex);
thr = que_fork_start_command(purge_sys->query, SESS_COMM_EXECUTE, 0);
thr = que_fork_start_command(purge_sys->query);
ut_ad(thr);
/* thr2 = que_fork_start_command(purge_sys->query, SESS_COMM_EXECUTE, 0);
/* thr2 = que_fork_start_command(purge_sys->query);
ut_ad(thr2); */
......
......@@ -73,8 +73,7 @@ trx_general_rollback_for_mysql(
thr = pars_complete_graph_for_exec(roll_node, trx, heap);
ut_a(thr == que_fork_start_command(que_node_get_parent(thr),
SESS_COMM_EXECUTE, 0));
ut_a(thr == que_fork_start_command(que_node_get_parent(thr)));
que_run_threads(thr);
mutex_enter(&kernel_mutex);
......@@ -354,8 +353,7 @@ trx_rollback_or_clean_all_without_sess(void)
/* Open a dummy session */
if (!trx_dummy_sess) {
trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess",
ut_strlen((char *) "Dummy sess"));
trx_dummy_sess = sess_open();
}
mutex_exit(&kernel_mutex);
......@@ -418,7 +416,7 @@ trx_rollback_or_clean_all_without_sess(void)
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
ut_a(thr == que_fork_start_command(fork));
trx_roll_max_undo_no = ut_conv_dulint_to_longlong(trx->undo_no);
trx_roll_progress_printed_pct = 0;
......@@ -981,11 +979,11 @@ trx_rollback(
trx->graph = roll_graph;
trx->que_state = TRX_QUE_ROLLING_BACK;
thr = que_fork_start_command(roll_graph, SESS_COMM_EXECUTE, 0);
thr = que_fork_start_command(roll_graph);
ut_ad(thr);
/* thr2 = que_fork_start_command(roll_graph, SESS_COMM_EXECUTE, 0);
/* thr2 = que_fork_start_command(roll_graph);
ut_ad(thr2); */
......@@ -1082,7 +1080,7 @@ trx_finish_partial_rollback_off_kernel(
/* Remove the signal from the signal queue and send reply message
to it */
trx_sig_reply(trx, sig, next_thr);
trx_sig_reply(sig, next_thr);
trx_sig_remove(trx, sig);
trx->que_state = TRX_QUE_RUNNING;
......@@ -1145,7 +1143,7 @@ trx_finish_rollback_off_kernel(
if (sig->type == TRX_SIG_TOTAL_ROLLBACK) {
trx_sig_reply(trx, sig, next_thr);
trx_sig_reply(sig, next_thr);
trx_sig_remove(trx, sig);
}
......@@ -1213,7 +1211,7 @@ trx_rollback_step(
success = trx_sig_send(thr_get_trx(thr),
sig_no, TRX_SIG_SELF,
TRUE, thr, savept, NULL);
thr, savept, NULL);
thr->state = QUE_THR_SIG_REPLY_WAIT;
......
......@@ -171,8 +171,7 @@ trx_allocate_for_mysql(void)
/* Open a dummy session */
if (!trx_dummy_sess) {
trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess",
ut_strlen((char *) "Dummy sess"));
trx_dummy_sess = sess_open();
}
trx = trx_create(trx_dummy_sess);
......@@ -205,8 +204,7 @@ trx_allocate_for_background(void)
/* Open a dummy session */
if (!trx_dummy_sess) {
trx_dummy_sess = sess_open(NULL, (byte*)"Dummy sess",
ut_strlen("Dummy sess"));
trx_dummy_sess = sess_open();
}
trx = trx_create(trx_dummy_sess);
......@@ -913,7 +911,7 @@ trx_handle_commit_sig_off_kernel(
if (sig->type == TRX_SIG_COMMIT) {
trx_sig_reply(trx, sig, next_thr);
trx_sig_reply(sig, next_thr);
trx_sig_remove(trx, sig);
}
......@@ -1002,7 +1000,6 @@ trx_sig_reply_wait_to_suspended(
thr->state = QUE_THR_SUSPENDED;
sig->receiver = NULL;
sig->reply = FALSE;
UT_LIST_REMOVE(reply_signals, trx->reply_signals, sig);
......@@ -1096,13 +1093,9 @@ trx_sig_send(
ulint type, /* in: signal type */
ulint sender, /* in: TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
ibool reply, /* in: TRUE if the sender of the signal
wants reply after the operation induced
by the signal is completed; if type
is TRX_SIG_END_WAIT, this must be
FALSE */
que_thr_t* receiver_thr, /* in: query thread which wants the
reply, or NULL */
reply, or NULL; if type is
TRX_SIG_END_WAIT, this must be NULL */
trx_savept_t* savept, /* in: possible rollback savepoint, or
NULL */
que_thr_t** next_thr) /* in/out: next query thread to run;
......@@ -1146,7 +1139,6 @@ trx_sig_send(
sig->type = type;
sig->state = TRX_SIG_WAITING;
sig->sender = sender;
sig->reply = reply;
sig->receiver = receiver_thr;
if (savept) {
......@@ -1305,7 +1297,7 @@ trx_sig_start_handle(
} else if (type == TRX_SIG_BREAK_EXECUTION) {
trx_sig_reply(trx, sig, next_thr);
trx_sig_reply(sig, next_thr);
trx_sig_remove(trx, sig);
} else {
ut_error;
......@@ -1321,7 +1313,6 @@ handled. */
void
trx_sig_reply(
/*==========*/
trx_t* trx, /* in: trx handle */
trx_sig_t* sig, /* in: signal */
que_thr_t** next_thr) /* in/out: next query thread to run;
if the value which is passed in is
......@@ -1331,11 +1322,10 @@ trx_sig_reply(
{
trx_t* receiver_trx;
ut_ad(trx && sig);
ut_ad(sig);
ut_ad(mutex_own(&kernel_mutex));
if (sig->reply && (sig->receiver != NULL)) {
if (sig->receiver != NULL) {
ut_ad((sig->receiver)->state == QUE_THR_SIG_REPLY_WAIT);
receiver_trx = thr_get_trx(sig->receiver);
......@@ -1346,18 +1336,8 @@ trx_sig_reply(
que_thr_end_wait(sig->receiver, next_thr);
sig->reply = FALSE;
sig->receiver = NULL;
} else if (sig->reply) {
/* In this case the reply should be sent to the client of
the session of the transaction */
sig->reply = FALSE;
sig->receiver = NULL;
sess_srv_msg_send_simple(trx->sess, SESS_SRV_SUCCESS,
SESS_NOT_RELEASE_KERNEL);
}
}
......@@ -1373,7 +1353,6 @@ trx_sig_remove(
ut_ad(trx && sig);
ut_ad(mutex_own(&kernel_mutex));
ut_ad(sig->reply == FALSE);
ut_ad(sig->receiver == NULL);
UT_LIST_REMOVE(signals, trx->signals, sig);
......@@ -1435,8 +1414,7 @@ trx_commit_step(
/* Send the commit signal to the transaction */
success = trx_sig_send(thr_get_trx(thr), TRX_SIG_COMMIT,
TRX_SIG_SELF, TRUE, thr, NULL,
&next_thr);
TRX_SIG_SELF, thr, NULL, &next_thr);
mutex_exit(&kernel_mutex);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment