Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH v2 3/4] session: store vtab in struct session
Date: Fri, 21 Dec 2018 14:23:55 +0300	[thread overview]
Message-ID: <95de280a-429a-7aad-6381-81e88ce11c04@tarantool.org> (raw)
In-Reply-To: <20181221110456.7gavqguwgxx7ijoh@esperanza>



On 21/12/2018 14:04, Vladimir Davydov wrote:
> On Tue, Dec 11, 2018 at 07:10:22PM +0300, Vladislav Shpilevoy wrote:
>> @@ -587,7 +587,8 @@ applier_f(va_list ap)
>>   	 * Set correct session type for use in on_replace()
>>   	 * triggers.
>>   	 */
>> -	if (session_create_on_demand(SESSION_TYPE_APPLIER) == NULL) {
>> +	if (session_create_on_demand(SESSION_TYPE_APPLIER,
>> +				     &generic_session_vtab) == NULL) {
>>   		diag_log();
>>   		return -1;
>>   	}
> 
>> @@ -51,12 +52,12 @@ lbox_session_create(struct lua_State *L, enum session_type type)
>>   {
>>   	struct session *session = fiber_get_session(fiber());
>>   	if (session == NULL) {
>> -		session = session_create_on_demand(type);
>> +		session = session_create_on_demand(type, &console_session_vtab);
>>   		if (session == NULL)
>>   			return luaT_error(L);
>>   		session->meta.fd = lua_tointeger(L, 1);
>>   	} else {
>> -		session_set_type(session, type);
>> +		session_set_type(session, type, &console_session_vtab);
>>   	}
> 
> IMHO the new API is confusing, because it allows to do e.g.
> 
>    session_set_type(SESSION_TYPE_APPLIER, &console_session_vtab);
> 
> What about leaving the session vtab registry and using it in
> session_set_type to set session->vtab consistent with a given type?

I do not like having both session->vtab and session_registry. Also,
Kostja asked to delete session_registry. But as you wish.

> Then, to kill a session we would introduce a separate method, which
> would reset session->vtab. And we could add an assertion ensuring that
> session_set_type isn't called on a dead session.
> 

  reply	other threads:[~2018-12-21 11:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 16:10 [PATCH v2 0/4] Outdate binary session on disconnect Vladislav Shpilevoy
2018-12-11 16:10 ` [PATCH v2 1/4] console: forbid arbitrary session type setting Vladislav Shpilevoy
2018-12-21 11:17   ` Vladimir Davydov
2018-12-11 16:10 ` [PATCH v2 2/4] session: minimize number of session type resets Vladislav Shpilevoy
2018-12-11 16:10 ` [PATCH v2 3/4] session: store vtab in struct session Vladislav Shpilevoy
2018-12-21 11:04   ` Vladimir Davydov
2018-12-21 11:23     ` Vladislav Shpilevoy [this message]
2018-12-11 16:10 ` [PATCH v2 4/4] session: outdate a session of a closed connection Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95de280a-429a-7aad-6381-81e88ce11c04@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] Re: [PATCH v2 3/4] session: store vtab in struct session' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox