[SCM] CTDB repository - branch master updated - ctdb-1.12-86-g8281bb2

Michael Adam obnox at samba.org
Tue Dec 6 02:39:35 MST 2011


ronnie sahlberg wrote:
> master didnt build.    libctdb still used the old structure so
> "structure does not have a field named ..." caused it to break

Darn, I must have forgotton to make clean before all.
What I actually did forget in my patch ddc5da3a0df770193
was this bit:

--- a/libctdb/ctdb.c
+++ b/libctdb/ctdb.c
@@ -1127,7 +1127,6 @@ static void traverse_msghnd_cb(struct ctdb_connection *ctdb,
        t.db_id = ctdb_db->id;
        t.srvid = state->srvid;
        t.reqid = 0;
-       t.withemptyrecords = false;
 
        state->handle = new_ctdb_control_request(ctdb,
                                CTDB_CONTROL_TRAVERSE_START,


I think we should (for now) not use the extended start control
in libctdb. I am going to change that back...

Cheers - Michael


> On Tue, Dec 6, 2011 at 6:59 PM, Michael Adam <obnox at samba.org> wrote:
> > Hi Ronnie,
> >
> > ronnie sahlberg wrote:
> >> I see,
> >>
> >> Good work, thanks.
> >>
> >> I fixed the breakage in libctdb.
> >
> > Oh. What did actually break?
> >
> > I intended the TRAVERSE_START_EXT control
> > to be used internally, for "ctdb catdb" to be
> > able to optionally print out empty records for
> > debugging purposes. The default should be to
> > still use the unchanged TRAVERSE_START control.
> >
> > Cheers - Michael
> >
> >> regards
> >> ronnie sahlberg
> >>
> >>
> >> On Tue, Dec 6, 2011 at 6:17 PM, Michael Adam <obnox at samba.org> wrote:
> >> > Hi Ronnie,
> >> >
> >> > this commit re-establishes the original wire-format.
> >> > The previous commit ddc5da3a0df7701934404192a0a0aa659a806acb
> >> > broke it by adding a variable to the struct. I noticed
> >> > by smbstatus failing to traverse the dbs... :-}
> >> >
> >> > So this commit brings back the original format for TRAVERSE_START.
> >> > The only things that change are the more internal controls.
> >> > (look at ddc5da3a0df7701934404192a0a0aa659a806acb).
> >> >
> >> > agreed?
> >> >
> >> > Cheers - Michael
> >> >
> >> > ronnie sahlberg wrote:
> >> >> Michael
> >> >> Are you sure about this change?
> >> >>
> >> >> It changes the wire format and size of the CTDB_CONTROL_TRAVERSE_START payload
> >> >> which breaks backward compatibility.
> >> >>
> >> >> Older versions of samba that use the old, different structure will now
> >> >> get an error on this control
> >> >> since the payload is wrong.
> >> >>
> >> >> regards
> >> >> ronnie sahlberg
> >> >>
> >> >>
> >> >> On Sat, Dec 3, 2011 at 12:21 PM, Michael Adam <obnox at samba.org> wrote:
> >> >> > The branch, master has been updated
> >> >> >       via  8281bb210858ed04992eacea7f6d02261e0fc1b1 (commit)
> >> >> >      from  6489d0d9b8ec14c7764a1865618faf659800bcc3 (commit)
> >> >> >
> >> >> > http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master
> >> >> >
> >> >> >
> >> >> > - Log -----------------------------------------------------------------
> >> >> > commit 8281bb210858ed04992eacea7f6d02261e0fc1b1
> >> >> > Author: Michael Adam <obnox at samba.org>
> >> >> > Date:   Sat Dec 3 02:15:30 2011 +0100
> >> >> >
> >> >> >    traverse: fix traversing with empty records by adding a new (internal) control CTDB_CONTROL_TRAVERSE_START_EXT
> >> >> >
> >> >> >    By this, the original CTDB_CONTROL_TRAVERSE_START control that is
> >> >> >    used by e.g. samba's smbstatus, is not changed, so that samba
> >> >> >    continues working without code change.
> >> >> >
> >> >> >    The  CTDB_CONTROL_TRAVERSE_START currently just adds the "withemptyrecords"
> >> >> >    flag to the state and processon on as CTDB_CONTROL_TRAVERSE_START_EXT.
> >> >> >
> >> >> > -----------------------------------------------------------------------
> >> >> >
> >> >> > Summary of changes:
> >> >> >  client/ctdb_client.c    |    4 ++--
> >> >> >  include/ctdb_private.h  |    5 +++++
> >> >> >  include/ctdb_protocol.h |    7 +++++++
> >> >> >  server/ctdb_control.c   |    4 ++++
> >> >> >  server/ctdb_traverse.c  |   39 ++++++++++++++++++++++++++++++++++-----
> >> >> >  5 files changed, 52 insertions(+), 7 deletions(-)
> >> >> >
> >> >> >
> >> >> > Changeset truncated at 500 lines:
> >> >> >
> >> >> > diff --git a/client/ctdb_client.c b/client/ctdb_client.c
> >> >> > index 75ad0e1..224cdc0 100644
> >> >> > --- a/client/ctdb_client.c
> >> >> > +++ b/client/ctdb_client.c
> >> >> > @@ -2059,7 +2059,7 @@ static int ctdb_traverse_ext(struct ctdb_db_context *ctdb_db,
> >> >> >                             void *private_data)
> >> >> >  {
> >> >> >        TDB_DATA data;
> >> >> > -       struct ctdb_traverse_start t;
> >> >> > +       struct ctdb_traverse_start_ext t;
> >> >> >        int32_t status;
> >> >> >        int ret;
> >> >> >        uint64_t srvid = (getpid() | 0xFLL<<60);
> >> >> > @@ -2085,7 +2085,7 @@ static int ctdb_traverse_ext(struct ctdb_db_context *ctdb_db,
> >> >> >        data.dptr = (uint8_t *)&t;
> >> >> >        data.dsize = sizeof(t);
> >> >> >
> >> >> > -       ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_TRAVERSE_START, 0,
> >> >> > +       ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_TRAVERSE_START_EXT, 0,
> >> >> >                           data, NULL, NULL, &status, NULL, NULL);
> >> >> >        if (ret != 0 || status != 0) {
> >> >> >                DEBUG(DEBUG_ERR,("ctdb_traverse_all failed\n"));
> >> >> > diff --git a/include/ctdb_private.h b/include/ctdb_private.h
> >> >> > index 4155bac..f545eaa 100644
> >> >> > --- a/include/ctdb_private.h
> >> >> > +++ b/include/ctdb_private.h
> >> >> > @@ -955,6 +955,11 @@ struct ctdb_client_call_state {
> >> >> >  };
> >> >> >
> >> >> >
> >> >> > +int32_t ctdb_control_traverse_start_ext(struct ctdb_context *ctdb,
> >> >> > +                                       TDB_DATA indata,
> >> >> > +                                       TDB_DATA *outdata,
> >> >> > +                                       uint32_t srcnode,
> >> >> > +                                       uint32_t client_id);
> >> >> >  int32_t ctdb_control_traverse_start(struct ctdb_context *ctdb, TDB_DATA indata,
> >> >> >                                    TDB_DATA *outdata, uint32_t srcnode, uint32_t client_id);
> >> >> >  int32_t ctdb_control_traverse_all(struct ctdb_context *ctdb, TDB_DATA data, TDB_DATA *outdata);
> >> >> > diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
> >> >> > index 99e3f4f..c71bafa 100644
> >> >> > --- a/include/ctdb_protocol.h
> >> >> > +++ b/include/ctdb_protocol.h
> >> >> > @@ -374,6 +374,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
> >> >> >                    CTDB_CONTROL_SCHEDULE_FOR_DELETION   = 128,
> >> >> >                    CTDB_CONTROL_SET_DB_READONLY         = 129,
> >> >> >                    CTDB_CONTROL_CHECK_SRVIDS            = 130,
> >> >> > +                   CTDB_CONTROL_TRAVERSE_START_EXT      = 131,
> >> >> >  };
> >> >> >
> >> >> >  /*
> >> >> > @@ -582,6 +583,12 @@ struct ctdb_traverse_start {
> >> >> >        uint32_t db_id;
> >> >> >        uint32_t reqid;
> >> >> >        uint64_t srvid;
> >> >> > +};
> >> >> > +
> >> >> > +struct ctdb_traverse_start_ext {
> >> >> > +       uint32_t db_id;
> >> >> > +       uint32_t reqid;
> >> >> > +       uint64_t srvid;
> >> >> >        bool withemptyrecords;
> >> >> >  };
> >> >> >
> >> >> > diff --git a/server/ctdb_control.c b/server/ctdb_control.c
> >> >> > index 602e994..060f2c5 100644
> >> >> > --- a/server/ctdb_control.c
> >> >> > +++ b/server/ctdb_control.c
> >> >> > @@ -247,6 +247,10 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
> >> >> >                CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_traverse_start));
> >> >> >                return ctdb_control_traverse_start(ctdb, indata, outdata, srcnode, client_id);
> >> >> >
> >> >> > +       case CTDB_CONTROL_TRAVERSE_START_EXT:
> >> >> > +               CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_traverse_start_ext));
> >> >> > +               return ctdb_control_traverse_start_ext(ctdb, indata, outdata, srcnode, client_id);
> >> >> > +
> >> >> >        case CTDB_CONTROL_TRAVERSE_ALL:
> >> >> >                return ctdb_control_traverse_all(ctdb, indata, outdata);
> >> >> >
> >> >> > diff --git a/server/ctdb_traverse.c b/server/ctdb_traverse.c
> >> >> > index d719f6f..da5a548 100644
> >> >> > --- a/server/ctdb_traverse.c
> >> >> > +++ b/server/ctdb_traverse.c
> >> >> > @@ -557,13 +557,17 @@ static void traverse_start_callback(void *p, TDB_DATA key, TDB_DATA data)
> >> >> >  }
> >> >> >
> >> >> >
> >> >> > -/*
> >> >> > -  start a traverse_all - called as a control from a client
> >> >> > +/**
> >> >> > + * start a traverse_all - called as a control from a client.
> >> >> > + * extended version to take the "withemptyrecords" parameter.
> >> >> >  */
> >> >> > -int32_t ctdb_control_traverse_start(struct ctdb_context *ctdb, TDB_DATA data,
> >> >> > -                                   TDB_DATA *outdata, uint32_t srcnode, uint32_t client_id)
> >> >> > +int32_t ctdb_control_traverse_start_ext(struct ctdb_context *ctdb,
> >> >> > +                                       TDB_DATA data,
> >> >> > +                                       TDB_DATA *outdata,
> >> >> > +                                       uint32_t srcnode,
> >> >> > +                                       uint32_t client_id)
> >> >> >  {
> >> >> > -       struct ctdb_traverse_start *d = (struct ctdb_traverse_start *)data.dptr;
> >> >> > +       struct ctdb_traverse_start_ext *d = (struct ctdb_traverse_start_ext *)data.dptr;
> >> >> >        struct traverse_start_state *state;
> >> >> >        struct ctdb_db_context *ctdb_db;
> >> >> >        struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
> >> >> > @@ -615,3 +619,28 @@ int32_t ctdb_control_traverse_start(struct ctdb_context *ctdb, TDB_DATA data,
> >> >> >
> >> >> >        return 0;
> >> >> >  }
> >> >> > +
> >> >> > +/**
> >> >> > + * start a traverse_all - called as a control from a client.
> >> >> > + */
> >> >> > +int32_t ctdb_control_traverse_start(struct ctdb_context *ctdb,
> >> >> > +                                   TDB_DATA data,
> >> >> > +                                   TDB_DATA *outdata,
> >> >> > +                                   uint32_t srcnode,
> >> >> > +                                   uint32_t client_id)
> >> >> > +{
> >> >> > +       struct ctdb_traverse_start *d = (struct ctdb_traverse_start *)data.dptr;
> >> >> > +       struct ctdb_traverse_start_ext d2;
> >> >> > +       TDB_DATA data2;
> >> >> > +
> >> >> > +       ZERO_STRUCT(d2);
> >> >> > +       d2.db_id = d->db_id;
> >> >> > +       d2.reqid = d->reqid;
> >> >> > +       d2.srvid = d->srvid;
> >> >> > +       d2.withemptyrecords = false;
> >> >> > +
> >> >> > +       data2.dsize = sizeof(d2);
> >> >> > +       data2.dptr = (uint8_t *)&d2;
> >> >> > +
> >> >> > +       return ctdb_control_traverse_start_ext(ctdb, data2, outdata, srcnode, client_id);
> >> >> > +}
> >> >> >
> >> >> >
> >> >> > --
> >> >> > CTDB repository
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 206 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20111206/239823da/attachment.pgp>


More information about the samba-technical mailing list