create_conn_struct_tos() and connection re-use
Andrew Bartlett
abartlet at samba.org
Fri Jun 22 21:56:43 UTC 2018
On Fri, 2018-06-22 at 14:15 -0700, Jeremy Allison wrote:
> On Sat, Jun 23, 2018 at 08:57:35AM +1200, Andrew Bartlett via samba-technical wrote:
> >
> > OK. I recently got asked to make samba-tool ntacl sysvolreset faster.
> > (Folks do this once after every rsync to keep their sysvol permissions
> > in line, so it is really important to make fast).
> >
> > One thing that code did is call create_conn_struct() for every python
> > function call, now replaced by create_conn_struct_tos().
> >
> > Assuming this repeated setup is part of what is making this so slow
> > (I've not checked yet, that will be step 0), what is the right way to
> > set up a connection only once for this use case?
>
> Looking at the python wrappers:
>
> Each call does:
>
> if (!PyArg_ParseTupleAndKeywords(args, kwargs, "si|z", discard_const_p(char *, kwnames),
> &fname, &security_info_wanted, &service)) {
> TALLOC_FREE(frame);
> return NULL;
> }
>
> conn = get_conn_tos(service);
>
> so the char *service parameter can be different for
> each call.
>
> You'd have to create varients of the python wrappers that
> guarantee a constant server name and hold the frame across
> multiple calls.
Well, I can't hold a talloc_stackframe() across different calls, that's
the thing, we will need to return to python a connection object.
The idea is to have a call to set up a connection, and then make file
operations in new function calls that pass in that connection. How do
I do that safely?
(If I have to, I can do that, call back to python from the C with a
function pointer, but some info on how to do plan A would help).
I'm asking now because I've just got the task in from the client and it
is on-topic and top of mind right now.
Thanks!
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Catalyst IT http://catalyst.net.nz/services/samba
More information about the samba-technical
mailing list