From: Ian Jackson Subject: Re: [OSSTEST PATCH 5/7] Schema: Support database schema updates Date: Thu, 10 Dec 2015 16:46:19 +0000 Message-ID: <22121.44123.286633.276265@mariner.uk.xensource.com> References: <1449755513-4166-1-git-send-email-ian.jackson@eu.citrix.com> <1449755513-4166-6-git-send-email-ian.jackson@eu.citrix.com> <1449762235.9759.86.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a74ML-00061N-AE for xen-devel@lists.xenproject.org; Thu, 10 Dec 2015 16:46:25 +0000 In-Reply-To: <1449762235.9759.86.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [OSSTEST PATCH 5/7] Schema: Support database sche= ma updates"): > On Thu, 2015-12-10 at 13:51 +0000, Ian Jackson wrote: > > See schema/README.schema, introduced in this patch, for the design. > = > That is all I have done here. Some of the questions I had might be answer= ed > in the code. Fair enough. I have actually executed this, although obviously not on any production instances. > > +Update orders > > +------------- > > + > > +There are three reasonable plans for schema changes: > = > You've listed 4, which one is unreasonable then ;-) Oops, fixed. > > +=A0=A0=A0=A0=A0=A0Unfinished (or absent)=A0=A0=A0in old code > > +=A0=A0=A0=A0=A0=A0Ready'=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0in new code > = > Is this really "Ready-prime" or is that a typo? Typo. > The "Unfinished", "Ready", "Needed" etc are the literal strings to be used > as in the special comment, correct? Yes. I see that I used the terms `state' and `status' interchangeably. I have changed `state' to `status' (and adjusted grammar) in the docs. The code still talks about `state' in a slightly confusing way. I can fix that if you like. > Who or what is responsible for cranking the handle on the state machine? I > _think_ it is going to be the commits which make the corresponding changes > to the code or introduce the new schema snippet? Exactly. > Am I right that it would be unusual to have a literal "Unfinished" in a > schema/*.sql, but rather they would be implicitly in that state by being > absent? You might want to introduce a schema change early in a series as documentation or for testing purposes. `Unfinished' updates can be applied with -fff so you can test parts of the code before the rest is ready. > > +Update order for Populate-then-rely > > +----------------------------------- > > + > > +This is for when we want to record new information and then later rely > > +on it.=A0=A0There are typically two schema changes: to add the column(= s) > > +(`add') and then to add appropriate constraints (`constraint') to > > +prevent it being left blank. > = > Which of the 4 plans above does this correspond to? > = > I have a feeling that this actually encapsulates two schema changes in > lockstep, which may have independent determination of the plan, from the > state names it looks like the `add' schema is a "Schema first" change and > the `constraint' one is either "Code first" or "Explicit conditional". Yes. I will explain this. > > +1. Commit: new schema update `add', in state Preparatory. > = > Does "Commit" mean simple push to pretest or does it have to pass through > push gate too?=A0 I will clarify this. > The two instances of "1." are because these can happen in parallel? No. I failed to update the numbering. > > +2. Apply: `add'. > = > This is something which automated machinery does I think? No. I will clarify this. > > +3. Wait for all executions of old code to finish. > = > this is automated also? Not really. > > +5. Apply: `constraint'. > = > Does `constraint' go to `Needed' at this point, or does that depend on the > nature of the change (and therefore whether it is "Code first" or "Explic= it > conditional"? No, it doesn't. I will clarify this. > > +"Push depends on schema update" is not currently implemented. > > + > > +"Checks for live old code" means > = > These two phrases don't existing in this document. > = > I think "Push depends on schema update" was called "Schema first" further > up? This is confusing. I will rewrite it. Ian.