Temporarily take out the listmanager from use

The listmanager code uses a global spinlock which might cause problems
with multiple threads.
This commit is contained in:
Markus Makela 2016-10-27 11:00:45 +03:00
parent 68d3fc1092
commit 51842333d7
3 changed files with 12 additions and 8 deletions

View File

@ -229,11 +229,12 @@ dcb_alloc(dcb_role_t role, SERV_LISTENER *listener)
{
DCB *newdcb;
if ((newdcb = (DCB *)list_find_free(&DCBlist, dcb_initialize)) == NULL)
if ((newdcb = (DCB *)MXS_MALLOC(sizeof(*newdcb))) == NULL)
{
return NULL;
}
dcb_initialize(newdcb);
newdcb->dcb_role = role;
newdcb->listener = listener;
newdcb->entry_is_ready = true;
@ -440,7 +441,7 @@ dcb_free_all_memory(DCB *dcb)
bitmask_free(&dcb->memdata.bitmask);
/* We never free the actual DCB, it is available for reuse*/
list_free_entry(&DCBlist, (list_entry_t *)dcb);
MXS_FREE(dcb);
}

View File

@ -1935,6 +1935,11 @@ int main(int argc, char **argv)
goto return_main;
}
/* Temporary - should use configuration values and test return value (bool)
* TODO: Enable the list manager code */
dcb_pre_alloc(1);
session_pre_alloc(1);
/** Initialize statistics */
ts_stats_init();

View File

@ -116,15 +116,14 @@ session_pre_alloc(int number)
SESSION *
session_alloc(SERVICE *service, DCB *client_dcb)
{
SESSION *session;
SESSION *session = (SESSION *)(MXS_MALLOC(sizeof(*session)));
session = (SESSION *)list_find_free(&SESSIONlist, session_initialize);
ss_info_dassert(session != NULL, "Allocating memory for session failed.");
if (NULL == session)
{
MXS_OOM();
return NULL;
}
session_initialize(session);
/** Assign a session id and increase */
session->ses_id = (size_t)atomic_add(&session_id, 1) + 1;
session->ses_is_child = (bool) DCB_IS_CLONE(client_dcb);
@ -445,8 +444,7 @@ session_free(SESSION *session)
static void
session_final_free(SESSION *session)
{
/* We never free the actual session, it is available for reuse*/
list_free_entry(&SESSIONlist, (list_entry_t *)session);
MXS_FREE(session);
}
/**