Commit 555e0e44 authored by unknown's avatar unknown

Merge serg.mylan:/usr/home/serg/Abk/mysql-4.1

into serg.mylan:/usr/home/serg/Abk/mysql-5.0


sql/mysqld.cc:
  Auto merged
parents 8941ac56 f3097674
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* Create a MyISAM table */ /* Create a MyISAM table */
#include "fulltext.h" #include "ftdefs.h"
#include "sp_defs.h" #include "sp_defs.h"
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
...@@ -41,7 +41,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -41,7 +41,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
File dfile,file; File dfile,file;
int errpos,save_errno; int errpos,save_errno;
myf create_flag; myf create_flag;
uint fields,length,max_key_length,packed,pointer, uint fields,length,max_key_length,packed,pointer,real_length_diff,
key_length,info_length,key_segs,options,min_key_length_skip, key_length,info_length,key_segs,options,min_key_length_skip,
base_pos,varchar_count,long_varchar_count,varchar_length, base_pos,varchar_count,long_varchar_count,varchar_length,
max_key_block_length,unique_key_parts,fulltext_keys,offset; max_key_block_length,unique_key_parts,fulltext_keys,offset;
...@@ -238,7 +238,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -238,7 +238,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{ {
share.state.key_root[i]= HA_OFFSET_ERROR; share.state.key_root[i]= HA_OFFSET_ERROR;
min_key_length_skip=length=0; min_key_length_skip=length=real_length_diff=0;
key_length=pointer; key_length=pointer;
if (keydef->flag & HA_SPATIAL) if (keydef->flag & HA_SPATIAL)
{ {
...@@ -297,6 +297,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -297,6 +297,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN; key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN;
length++; /* At least one length byte */ length++; /* At least one length byte */
min_key_length_skip+=HA_FT_MAXBYTELEN; min_key_length_skip+=HA_FT_MAXBYTELEN;
real_length_diff=HA_FT_MAXBYTELEN-FT_MAX_WORD_LEN_FOR_SORT;
} }
else else
{ {
...@@ -397,7 +398,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -397,7 +398,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_segs) key_segs)
share.state.rec_per_key_part[key_segs-1]=1L; share.state.rec_per_key_part[key_segs-1]=1L;
length+=key_length; length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE); keydef->block_length= MI_BLOCK_SIZE(length-real_length_diff,
pointer,MI_MAX_KEYPTR_SIZE);
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH || if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
length >= MI_MAX_KEY_BUFF) length >= MI_MAX_KEY_BUFF)
{ {
......
This diff is collapsed.
...@@ -607,8 +607,8 @@ private: ...@@ -607,8 +607,8 @@ private:
NdbOperation* theLastExecOpInList; // Last executing operation in list. NdbOperation* theLastExecOpInList; // Last executing operation in list.
NdbOperation* theCompletedFirstOp; // First operation in completed NdbOperation* theCompletedFirstOp; // First & last operation in completed
// operation list. NdbOperation* theCompletedLastOp; // operation list.
Uint32 theNoOfOpSent; // How many operations have been sent Uint32 theNoOfOpSent; // How many operations have been sent
Uint32 theNoOfOpCompleted; // How many operations have completed Uint32 theNoOfOpCompleted; // How many operations have completed
......
...@@ -55,6 +55,7 @@ NdbConnection::NdbConnection( Ndb* aNdb ) : ...@@ -55,6 +55,7 @@ NdbConnection::NdbConnection( Ndb* aNdb ) :
theFirstExecOpInList(NULL), theFirstExecOpInList(NULL),
theLastExecOpInList(NULL), theLastExecOpInList(NULL),
theCompletedFirstOp(NULL), theCompletedFirstOp(NULL),
theCompletedLastOp(NULL),
theNoOfOpSent(0), theNoOfOpSent(0),
theNoOfOpCompleted(0), theNoOfOpCompleted(0),
theNoOfOpFetched(0), theNoOfOpFetched(0),
...@@ -124,6 +125,7 @@ NdbConnection::init() ...@@ -124,6 +125,7 @@ NdbConnection::init()
theLastExecOpInList = NULL; theLastExecOpInList = NULL;
theCompletedFirstOp = NULL; theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
theGlobalCheckpointId = 0; theGlobalCheckpointId = 0;
theCommitStatus = Started; theCommitStatus = Started;
...@@ -256,6 +258,8 @@ NdbConnection::handleExecuteCompletion() ...@@ -256,6 +258,8 @@ NdbConnection::handleExecuteCompletion()
if (tLastExecOp != NULL) { if (tLastExecOp != NULL) {
tLastExecOp->next(theCompletedFirstOp); tLastExecOp->next(theCompletedFirstOp);
theCompletedFirstOp = tFirstExecOp; theCompletedFirstOp = tFirstExecOp;
if (theCompletedLastOp == NULL)
theCompletedLastOp = tLastExecOp;
theFirstExecOpInList = NULL; theFirstExecOpInList = NULL;
theLastExecOpInList = NULL; theLastExecOpInList = NULL;
}//if }//if
...@@ -292,6 +296,8 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -292,6 +296,8 @@ NdbConnection::execute(ExecType aTypeOfExec,
ExecType tExecType; ExecType tExecType;
NdbOperation* tPrepOp; NdbOperation* tPrepOp;
NdbOperation* tCompletedFirstOp = NULL;
NdbOperation* tCompletedLastOp = NULL;
int ret = 0; int ret = 0;
do { do {
...@@ -314,6 +320,7 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -314,6 +320,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
} }
tPrepOp = tPrepOp->next(); tPrepOp = tPrepOp->next();
} }
// save rest of prepared ops if batch // save rest of prepared ops if batch
NdbOperation* tRestOp= 0; NdbOperation* tRestOp= 0;
NdbOperation* tLastOp= 0; NdbOperation* tLastOp= 0;
...@@ -323,6 +330,7 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -323,6 +330,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
tLastOp = theLastOpInList; tLastOp = theLastOpInList;
theLastOpInList = tPrepOp; theLastOpInList = tPrepOp;
} }
if (tExecType == Commit) { if (tExecType == Commit) {
NdbOperation* tOp = theCompletedFirstOp; NdbOperation* tOp = theCompletedFirstOp;
while (tOp != NULL) { while (tOp != NULL) {
...@@ -338,6 +346,19 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -338,6 +346,19 @@ NdbConnection::execute(ExecType aTypeOfExec,
} }
} }
// completed ops are in unspecified order
if (theCompletedFirstOp != NULL) {
if (tCompletedFirstOp == NULL) {
tCompletedFirstOp = theCompletedFirstOp;
tCompletedLastOp = theCompletedLastOp;
} else {
tCompletedLastOp->next(theCompletedFirstOp);
tCompletedLastOp = theCompletedLastOp;
}
theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
}
if (executeNoBlobs(tExecType, abortOption, forceSend) == -1) if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
ret = -1; ret = -1;
#ifndef VM_TRACE #ifndef VM_TRACE
...@@ -362,6 +383,7 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -362,6 +383,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
tOp = tOp->next(); tOp = tOp->next();
} }
} }
// add saved prepared ops if batch // add saved prepared ops if batch
if (tPrepOp != NULL && tRestOp != NULL) { if (tPrepOp != NULL && tRestOp != NULL) {
if (theFirstOpInList == NULL) if (theFirstOpInList == NULL)
...@@ -373,6 +395,18 @@ NdbConnection::execute(ExecType aTypeOfExec, ...@@ -373,6 +395,18 @@ NdbConnection::execute(ExecType aTypeOfExec,
assert(theFirstOpInList == NULL || tExecType == NoCommit); assert(theFirstOpInList == NULL || tExecType == NoCommit);
} while (theFirstOpInList != NULL || tExecType != aTypeOfExec); } while (theFirstOpInList != NULL || tExecType != aTypeOfExec);
if (tCompletedFirstOp != NULL) {
tCompletedLastOp->next(theCompletedFirstOp);
theCompletedFirstOp = tCompletedFirstOp;
if (theCompletedLastOp == NULL)
theCompletedLastOp = tCompletedLastOp;
}
#if ndb_api_count_completed_ops_after_blob_execute
{ NdbOperation* tOp; unsigned n = 0;
for (tOp = theCompletedFirstOp; tOp != NULL; tOp = tOp->next()) n++;
ndbout << "completed ops: " << n << endl;
}
#endif
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
...@@ -894,6 +928,7 @@ NdbConnection::releaseOperations() ...@@ -894,6 +928,7 @@ NdbConnection::releaseOperations()
releaseOps(theFirstExecOpInList); releaseOps(theFirstExecOpInList);
theCompletedFirstOp = NULL; theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
theFirstOpInList = NULL; theFirstOpInList = NULL;
theFirstExecOpInList = NULL; theFirstExecOpInList = NULL;
theLastOpInList = NULL; theLastOpInList = NULL;
...@@ -909,6 +944,7 @@ NdbConnection::releaseCompletedOperations() ...@@ -909,6 +944,7 @@ NdbConnection::releaseCompletedOperations()
{ {
releaseOps(theCompletedFirstOp); releaseOps(theCompletedFirstOp);
theCompletedFirstOp = NULL; theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
}//NdbConnection::releaseOperations() }//NdbConnection::releaseOperations()
/****************************************************************************** /******************************************************************************
......
This diff is collapsed.
...@@ -469,6 +469,7 @@ Query_cache query_cache; ...@@ -469,6 +469,7 @@ Query_cache query_cache;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
char *shared_memory_base_name= default_shared_memory_base_name; char *shared_memory_base_name= default_shared_memory_base_name;
bool opt_enable_shared_memory; bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif #endif
#include "sslopt-vars.h" #include "sslopt-vars.h"
...@@ -746,6 +747,15 @@ void kill_mysql(void) ...@@ -746,6 +747,15 @@ void kill_mysql(void)
CloseHandle(hEvent); CloseHandle(hEvent);
*/ */
} }
#ifdef HAVE_SMEM
/*
Send event to smem_event_connect_request for aborting
*/
if (!SetEvent(smem_event_connect_request))
{
DBUG_PRINT("error",("Got error: %ld from SetEvent of smem_event_connect_request",GetLastError()));
}
#endif
#endif #endif
#elif defined(OS2) #elif defined(OS2)
pthread_cond_signal(&eventShutdown); // post semaphore pthread_cond_signal(&eventShutdown); // post semaphore
...@@ -3799,7 +3809,6 @@ pthread_handler_decl(handle_connections_shared_memory,arg) ...@@ -3799,7 +3809,6 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
/* file-mapping object, use for create shared memory */ /* file-mapping object, use for create shared memory */
HANDLE handle_connect_file_map= 0; HANDLE handle_connect_file_map= 0;
char *handle_connect_map= 0; // pointer on shared memory char *handle_connect_map= 0; // pointer on shared memory
HANDLE event_connect_request= 0; // for start connection actions
HANDLE event_connect_answer= 0; HANDLE event_connect_answer= 0;
ulong smem_buffer_length= shared_memory_buffer_length + 4; ulong smem_buffer_length= shared_memory_buffer_length + 4;
ulong connect_number= 1; ulong connect_number= 1;
...@@ -3820,7 +3829,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg) ...@@ -3820,7 +3829,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
*/ */
suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS); suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS);
strmov(suffix_pos, "CONNECT_REQUEST"); strmov(suffix_pos, "CONNECT_REQUEST");
if ((event_connect_request= CreateEvent(0,FALSE,FALSE,tmp)) == 0) if ((smem_event_connect_request= CreateEvent(0,FALSE,FALSE,tmp)) == 0)
{ {
errmsg= "Could not create request event"; errmsg= "Could not create request event";
goto error; goto error;
...@@ -3851,7 +3860,13 @@ pthread_handler_decl(handle_connections_shared_memory,arg) ...@@ -3851,7 +3860,13 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
while (!abort_loop) while (!abort_loop)
{ {
/* Wait a request from client */ /* Wait a request from client */
WaitForSingleObject(event_connect_request,INFINITE); WaitForSingleObject(smem_event_connect_request,INFINITE);
/*
it can be after shutdown command
*/
if (abort_loop)
goto error;
HANDLE handle_client_file_map= 0; HANDLE handle_client_file_map= 0;
char *handle_client_map= 0; char *handle_client_map= 0;
...@@ -3976,7 +3991,7 @@ error: ...@@ -3976,7 +3991,7 @@ error:
if (handle_connect_map) UnmapViewOfFile(handle_connect_map); if (handle_connect_map) UnmapViewOfFile(handle_connect_map);
if (handle_connect_file_map) CloseHandle(handle_connect_file_map); if (handle_connect_file_map) CloseHandle(handle_connect_file_map);
if (event_connect_answer) CloseHandle(event_connect_answer); if (event_connect_answer) CloseHandle(event_connect_answer);
if (event_connect_request) CloseHandle(event_connect_request); if (smem_event_connect_request) CloseHandle(smem_event_connect_request);
decrement_handler_count(); decrement_handler_count();
DBUG_RETURN(0); DBUG_RETURN(0);
......
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