You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafodion.apache.org by "Zhu, Wen-Jun" <we...@esgyn.cn> on 2018/01/24 06:34:03 UTC

答复: Where is the session?

Hi,

Actually I want to connect to a server when a connection from trafci is made in mxosrvr,.
And then close it when the connection is down.

As far as I can see, Sandhya's ContextCli::beginSession fits me well.

Thanks.

Regards,
Wenjun Zhu.

-----邮件原件-----
发件人: Anoop Sharma [mailto:anoop.sharma@esgyn.com] 
发送时间: 2018年1月24日 13:31
收件人: dev@trafodion.apache.org
主题: RE: Where is the session?

hi,

Is this only for when a connection is made to the master executor(mxosrvr) or does it also apply when a child process (esp, udr server, arkcmp, ...) are started as well?

Is this for trafci only or for other clients as well, like odbc/jdbc apps, or sqlci or T2/T4?

Is this for the very first context that is created or also when other contexts are created/connected as well through switchContext?

Will whatever action is being taken at beginSession be undone at endSession time when a session ends? 

Is this for first connection only by a particular client or does it need to be done whenever a new session is reconnected by the same client?

Will be good if you can provide some details on what action need to be taken or what the context is so a more relevant answer can be provided.

thanks
   
  anoop

-----Original Message-----
From: Sandhya Sundaresan [mailto:sandhya.sundaresan@esgyn.com]
Sent: Tuesday, January 23, 2018 9:10 PM
To: dev@trafodion.apache.org
Subject: RE: Where is the session?

Hi Wenjun,
  So you want to add code in the CLI layer to do something when a session is setup ? 
If so , set a breakpoint at : ContextCli::beginSession .  
Thanks
Sandhya

-----Original Message-----
From: Zhu, Wen-Jun [mailto:wenjun.zhu@esgyn.cn]
Sent: Tuesday, January 23, 2018 8:13 PM
To: dev@trafodion.apache.org
Subject: Where is the session?

Hi,

I'd like to do something when a session opens, i.e., when a client(like trafci) connects to the Trafodion server.

I thought it was class ContextCli, as the following stacks showed:
#0  ContextCli::ContextCli (this=0x7f3286f97260, cliGlobals=0x2b0f2c0) at ../cli/Context.cpp:175
#1  0x00007f329afc1f2d in CliGlobals::init (this=0x2b0f2c0, espProcess=0, statsGlobals=0x0) at ../cli/Globals.cpp:241
#2  0x00007f329afc154b in CliGlobals::CliGlobals (this=0x2b0f2c0, espProcess=0) at ../cli/Globals.cpp:113
#3  0x00007f329afc2a8f in CliGlobals::createCliGlobals (espProcess=0) at ../cli/Globals.cpp:477
#4  0x00007f329affd116 in CliNonPrivPrologue () at ../cli/CliExtern.cpp:891
#5  0x00007f329affd62c in SQL_EXEC_ClearDiagnostics (statement_id=0x0) at ../cli/CliExtern.cpp:1162
#6  0x00007f329d90d44f in SRVR::WSQL_EXEC_ClearDiagnostics (statement_id=0x0) at SQLWrapper.cpp:141
#7  0x0000000000585e70 in odbc_SQLSvc_InitializeDialogue_ame_ (objtag_=0x2afb820, call_id_=0x2afb878, userDesc=0x7f3287a01750, inContext=0x7f3287a00bb0, dialo
gueId=63314812) at SrvrConnect.cpp:2170
#8  0x0000000000523e6d in SQLCONNECT_IOMessage (objtag_=0x2afb820, call_id_=0x2afb878) at Interface/odbcs_srvr.cpp:625
#9  0x00000000005262fd in DISPATCH_TCPIPRequest (objtag_=0x2afb820, call_id_=0x2afb878, operation_id=3001) at Interface/odbcs_srvr.cpp:1865
#10 0x0000000000467d68 in BUILD_TCPIP_REQUEST (pnode=0x2afb820) at ../Common/TCPIPSystemSrvr.cpp:606
#11 0x0000000000467caf in PROCESS_TCPIP_REQUEST (pnode=0x2afb820) at ../Common/TCPIPSystemSrvr.cpp:584
#12 0x00000000004b7370 in CNSKListenerSrvr::CheckTCPIPRequest (this=0x29a91a0, ipnode=0x2afb820) at Interface/Listener_srvr.cpp:64
#13 0x00000000004c928e in CNSKListenerSrvr::tcpip_listener (arg=0x29a91a0) at Interface/linux/Listener_srvr_ps.cpp:452
#14 0x00007f329b29166e in sb_thread_sthr_disp (pp_arg=0x2ad24f0) at threadl.cpp:270
#15 0x00007f329e023aa1 in start_thread () from /lib64/libpthread.so.0
#16 0x00007f329b594bcd in clone () from /lib64/libc.so.6 And
#0  ContextCli::ContextCli (this=0x7f3286f9d200, cliGlobals=0x2b0f2c0) at ../cli/Context.cpp:175
#1  0x00007f329afc2e26 in CliGlobals::createContext (this=0x2b0f2c0, newContext=@0x7f3275acd508) at ../cli/Globals.cpp:524
#2  0x00007f329af600e2 in SQLCLI_CreateContext (cliGlobals=0x2b0f2c0, contextHandle=0x7f3275acdb8c, sqlAuthId=0x0, mustBeZero=0) at ../cli/Cli.cpp:1201
#3  0x00007f329affd835 in SQL_EXEC_CreateContext (context_handle=0x7f3275acdb8c, sqlAuthId=0x0, forFutureUse=0) at ../cli/CliExtern.cpp:1261
#4  0x00007f329d90d5ea in SRVR::WSQL_EXEC_CreateContext (context_handle=0x7f3275acdb8c, sqlAuthId=0x0, future=0) at SQLWrapper.cpp:178
#5  0x000000000057c470 in SessionWatchDog (arg=0x0) at SrvrConnect.cpp:376
#6  0x00007f329e023aa1 in start_thread () from /lib64/libpthread.so.0
#7  0x00007f329b594bcd in clone () from /lib64/libc.so.6

But it is created only for the first time. So it is not the place to handle the session, right?

So my question is, where dose the session-handling class reside?

Thanks.

Regards
Wenjun Zhu


RE: Where is the session?

Posted by Anoop Sharma <an...@esgyn.com>.
hi
  good that it works out.
If this is for an experiment or prototype, then that is fine.
But if this will be part of product, then few other considerations need to be kept in mind.

- is the server being connected to a persistent process or will it need to be started and then connected
- are there any security implication of connecting to a server from within cli code
- what is the performance impact of connecting and disconnecting for each begin/end session. 
  It may impact short queries.
  also, begin/end can happen multiple times from a client.
- is this only for trafci or will other clients also go through it. If only trafci, how will it know that
  the cli call is from trafci

Hopefully there will be a JIRA that contains design details that could be looked at if this change is going to be delivered.


anoop

-----Original Message-----
From: Zhu, Wen-Jun [mailto:wenjun.zhu@esgyn.cn] 
Sent: Tuesday, January 23, 2018 10:34 PM
To: dev@trafodion.apache.org
Subject: 答复: Where is the session?

Hi,

Actually I want to connect to a server when a connection from trafci is made in mxosrvr,.
And then close it when the connection is down.

As far as I can see, Sandhya's ContextCli::beginSession fits me well.

Thanks.

Regards,
Wenjun Zhu.

-----邮件原件-----
发件人: Anoop Sharma [mailto:anoop.sharma@esgyn.com] 
发送时间: 2018年1月24日 13:31
收件人: dev@trafodion.apache.org
主题: RE: Where is the session?

hi,

Is this only for when a connection is made to the master executor(mxosrvr) or does it also apply when a child process (esp, udr server, arkcmp, ...) are started as well?

Is this for trafci only or for other clients as well, like odbc/jdbc apps, or sqlci or T2/T4?

Is this for the very first context that is created or also when other contexts are created/connected as well through switchContext?

Will whatever action is being taken at beginSession be undone at endSession time when a session ends? 

Is this for first connection only by a particular client or does it need to be done whenever a new session is reconnected by the same client?

Will be good if you can provide some details on what action need to be taken or what the context is so a more relevant answer can be provided.

thanks
   
  anoop

-----Original Message-----
From: Sandhya Sundaresan [mailto:sandhya.sundaresan@esgyn.com]
Sent: Tuesday, January 23, 2018 9:10 PM
To: dev@trafodion.apache.org
Subject: RE: Where is the session?

Hi Wenjun,
  So you want to add code in the CLI layer to do something when a session is setup ? 
If so , set a breakpoint at : ContextCli::beginSession .  
Thanks
Sandhya

-----Original Message-----
From: Zhu, Wen-Jun [mailto:wenjun.zhu@esgyn.cn]
Sent: Tuesday, January 23, 2018 8:13 PM
To: dev@trafodion.apache.org
Subject: Where is the session?

Hi,

I'd like to do something when a session opens, i.e., when a client(like trafci) connects to the Trafodion server.

I thought it was class ContextCli, as the following stacks showed:
#0  ContextCli::ContextCli (this=0x7f3286f97260, cliGlobals=0x2b0f2c0) at ../cli/Context.cpp:175
#1  0x00007f329afc1f2d in CliGlobals::init (this=0x2b0f2c0, espProcess=0, statsGlobals=0x0) at ../cli/Globals.cpp:241
#2  0x00007f329afc154b in CliGlobals::CliGlobals (this=0x2b0f2c0, espProcess=0) at ../cli/Globals.cpp:113
#3  0x00007f329afc2a8f in CliGlobals::createCliGlobals (espProcess=0) at ../cli/Globals.cpp:477
#4  0x00007f329affd116 in CliNonPrivPrologue () at ../cli/CliExtern.cpp:891
#5  0x00007f329affd62c in SQL_EXEC_ClearDiagnostics (statement_id=0x0) at ../cli/CliExtern.cpp:1162
#6  0x00007f329d90d44f in SRVR::WSQL_EXEC_ClearDiagnostics (statement_id=0x0) at SQLWrapper.cpp:141
#7  0x0000000000585e70 in odbc_SQLSvc_InitializeDialogue_ame_ (objtag_=0x2afb820, call_id_=0x2afb878, userDesc=0x7f3287a01750, inContext=0x7f3287a00bb0, dialo
gueId=63314812) at SrvrConnect.cpp:2170
#8  0x0000000000523e6d in SQLCONNECT_IOMessage (objtag_=0x2afb820, call_id_=0x2afb878) at Interface/odbcs_srvr.cpp:625
#9  0x00000000005262fd in DISPATCH_TCPIPRequest (objtag_=0x2afb820, call_id_=0x2afb878, operation_id=3001) at Interface/odbcs_srvr.cpp:1865
#10 0x0000000000467d68 in BUILD_TCPIP_REQUEST (pnode=0x2afb820) at ../Common/TCPIPSystemSrvr.cpp:606
#11 0x0000000000467caf in PROCESS_TCPIP_REQUEST (pnode=0x2afb820) at ../Common/TCPIPSystemSrvr.cpp:584
#12 0x00000000004b7370 in CNSKListenerSrvr::CheckTCPIPRequest (this=0x29a91a0, ipnode=0x2afb820) at Interface/Listener_srvr.cpp:64
#13 0x00000000004c928e in CNSKListenerSrvr::tcpip_listener (arg=0x29a91a0) at Interface/linux/Listener_srvr_ps.cpp:452
#14 0x00007f329b29166e in sb_thread_sthr_disp (pp_arg=0x2ad24f0) at threadl.cpp:270
#15 0x00007f329e023aa1 in start_thread () from /lib64/libpthread.so.0
#16 0x00007f329b594bcd in clone () from /lib64/libc.so.6 And
#0  ContextCli::ContextCli (this=0x7f3286f9d200, cliGlobals=0x2b0f2c0) at ../cli/Context.cpp:175
#1  0x00007f329afc2e26 in CliGlobals::createContext (this=0x2b0f2c0, newContext=@0x7f3275acd508) at ../cli/Globals.cpp:524
#2  0x00007f329af600e2 in SQLCLI_CreateContext (cliGlobals=0x2b0f2c0, contextHandle=0x7f3275acdb8c, sqlAuthId=0x0, mustBeZero=0) at ../cli/Cli.cpp:1201
#3  0x00007f329affd835 in SQL_EXEC_CreateContext (context_handle=0x7f3275acdb8c, sqlAuthId=0x0, forFutureUse=0) at ../cli/CliExtern.cpp:1261
#4  0x00007f329d90d5ea in SRVR::WSQL_EXEC_CreateContext (context_handle=0x7f3275acdb8c, sqlAuthId=0x0, future=0) at SQLWrapper.cpp:178
#5  0x000000000057c470 in SessionWatchDog (arg=0x0) at SrvrConnect.cpp:376
#6  0x00007f329e023aa1 in start_thread () from /lib64/libpthread.so.0
#7  0x00007f329b594bcd in clone () from /lib64/libc.so.6

But it is created only for the first time. So it is not the place to handle the session, right?

So my question is, where dose the session-handling class reside?

Thanks.

Regards
Wenjun Zhu