/srv/irclogs.ubuntu.com/2014/02/16/#juju-dev.txt

=== _mup__ is now known as _mup_
=== zz_mwhudson is now known as mwhudson
fwereadewaigani___, heyhey22:12
waigani_____fwereade: hello :)22:12
fwereadewaigani___, how's it going?22:13
waigani_____getting there22:13
fwereadewaigani___, sorry I haven't really said hi properly since you joined :(22:13
waigani_____a LOT of code to get my head around!22:13
fwereadewaigani___, ha, yes indeed22:13
waigani_____no problem, totally understandable22:13
waigani_____ditto, sorry for not saying hi :)22:13
waigani_____so, I'm getting racy hey?22:14
fwereadewaigani___, I'm kinda going to bed shortly but I just wanted to chat briefly about the set environ config stuff22:14
waigani_____sure22:14
waigani____fwereade: hangout or irc?22:17
fwereadewaigani___, the issue is mainly that I don't really want it to be possible to set an invalid environ config, and I am not convinced that it's possible to guarantee the sanity of a given change without (1) validating the change from the previous version --which is fine, you do it-- and (2) asserting in state that the previous version, from which the change is known to be valid, still applies22:17
fwereadewaigani____, I think I can irc it, I will be off to bed in a mo22:17
waigani____ok22:18
fwereadewaigani____, does that make sense at first reading or shall I expand a little? ;)22:18
waigani____right, so the real issue is the last one22:19
waigani____how do you ensure the oldconfig is itslef valid22:19
fwereadewaigani____, if you can guarantee every change is valid, I think yu can guarantee that the previous version was22:19
fwereadewaigani____, because you cannot bootstrap but with a valid config22:20
waigani____can we?22:20
waigani____right22:20
waigani____in which case the current method works then?22:20
waigani____we can rely on an oldconfig22:21
waigani____oohhhh22:21
waigani____lol22:21
waigani____i see22:21
waigani____THAT is why you don't want to allow setconfig without validating22:21
fwereadewaigani____, the current method is (at least in theory) crack, because the *actual* change we end up making is pretty random -- see state/state.go:26422:22
waigani____so this is the race condition you mentioned?22:23
fwereadewaigani____, in *practice* it's usually ok, but that's because we don't get many concurrent updates to environ config22:24
fwereadewaigani____, yeah, I think so22:24
fwereadewaigani____, I have a tendency to froth about a wide range of possible race conditions22:24
waigani____heh22:24
fwereadewaigani____, ah, but, yes, that's the one22:25
fwereadewaigani____, so what's interesting is that axw is doing some work that involves using an Environ inside state22:25
waigani____what does axw mean when he says The settings changes are actually applied as a delta to what's on disk22:25
waigani____"applied as a delta"?22:26
fwereadewaigani____, there's a Settings type22:26
fwereadewaigani____, it was written in python for zookeeper and ported straight without much consideration for whether it still makes sense22:26
fwereadewaigani____, hint: it doesn't22:26
waigani____lol, okay...22:26
fwereadewaigani____, I am struggling to remember the *exact* details22:27
fwereadewaigani____, but it is itself fundamentally racy22:27
waigani____don't worry, I'll follow up22:27
fwereadewaigani____, it reads existing state, calculates delta, applies delta22:27
waigani____now I know the direction to look in22:27
fwereadewaigani____, pretty sure it doesn't assert the base state still holds22:28
waigani____now state == mongodb?22:28
fwereadewaigani____, yeah, take a look at that for a bit of context22:28
fwereadewaigani____, yep22:28
waigani____i.e. config stored in mdb22:28
fwereadewaigani____, but have a word with axw, because *he* is doing some work that involves using an Environ inside state to check sanity of AddMachine ops by checking with the provider22:29
fwereadewaigani____, and *you* are doing something that involves checking sanity of applying changes to Environ (configs)22:29
waigani____will do.22:30
waigani____would you like to see the ApplyAndValidate method I've refactored out, added back into SetEnvironConfig?22:30
waigani____Such that you cannot set an environ config without validating it?22:31
fwereadewaigani____, I think that is at least part of it, but be suspicious of what actually happens when you try to use that settings type22:31
waigani____fwereade: be suspicious of SetEnvironConfig?22:32
fwereadewaigani____, it may be that you're best off using entirely different code that just happens to use the same data format22:32
fwereadewaigani____, more of state.Settings22:32
fwereadewaigani____, ...or, heh, maybe converting it to use a new data format22:33
fwereadewaigani____, I'm also pretty sure that the fields are dumped straight into the mongo document22:33
waigani____fwereade: just saw your comment: TODO(fwereade) state.Settings is itself really problematic in just about every use case22:33
fwereadewaigani____, and by sheer conincidence magic fields like txn-revno happen not to collide with actual env settings22:33
fwereadewaigani____, I think what I'm saying is that you have stumbled into a rabbit hole22:34
fwereadewaigani____, do not feel obliged to fix everything22:34
waigani____I was just about to say the same!22:34
fwereadewaigani____, but be careful to understand what you're fixing and what you're not, and please document it clearly22:35
fwereadewaigani____, take heart: you're unlikely to make that specific code *worse*22:35
waigani____obviously my understanding is cursory, so I'll follow up with axw and look into state.Settings22:35
fwereadewaigani____, and I'll be happy if it just gets a little bit better22:35
fwereadewaigani____, awesome, thanks22:36
waigani____are there any other hits for me?22:36
waigani____bits of code I should look at?22:36
fwereadewaigani____, for this particular stuff it's quite localised22:36
fwereadewaigani____, there are a couple of other Settings clients22:37
fwereadewaigani____, one day we'll get rid of them all22:37
waigani____okay22:37
fwereadewaigani____, but it's the env config that really upsets me22:37
fwereadewaigani____, because it's the most potentially horrible one ;)22:38
fwereadewaigani____, anyway I should get some sleep22:38
waigani____just before you go .... :D22:38
fwereadewaigani____, I might be a little late tomorrow, but dimitern is staying here, so if you see him and want to talk to me tell him to come shout at me :)22:38
fwereadewaigani____, I'm still here :)22:39
waigani____could you give me one example of the race conditon?22:39
waigani____two clients trying to set the config at the same time? Is that right?22:39
fwereadewaigani____, yeah22:39
waigani____clients = machine agent, juju cli, ...22:40
fwereadewaigani____, ah!22:40
fwereadewaigani____, there *is* a replaceSettingsOp func22:40
fwereadewaigani____, that I think is not racy22:40
waigani____oh22:40
fwereadewaigani____, it may need to be retried22:40
fwereadewaigani____, but if you use it the txn will abort22:40
waigani____okay, lots to learn ... I'll let you sleep22:41
fwereadewaigani____, so, *if* you can construct a known-valid config, you can use replaceSettingsOp to be sure it actually lands in state22:41
waigani____thanks for taking the time to walk me through the rabbit whole, a little ;)22:41
fwereadewaigani____, but to construct a known-valid one inside state, you'll need to talk to axw22:41
waigani____*hole22:41
fwereadewaigani____, because22:41
fwereade(you're sitting down, right)22:41
waigani____hehe yep22:42
fwereadewaigani____, just because it's a valid config.Config22:42
fwereadewaigani____, it is *not* necessarily a valid config for any given provider22:42
waigani____ugh22:42
fwereadewaigani____, let alone a valid change for that specific environ22:42
waigani____what?22:42
waigani____I get that it might not be valid for other providers22:43
fwereadewaigani____, simplest case: some fields are immutable, or should be22:43
fwereadewaigani____, change an env's name from foo to bar, bad things will happenb22:43
fwereadewaigani____, constructing an env, and setting the new config, *should* catch all those cases22:43
waigani____so that should be caught as invalid by the environ provider validator?22:43
waigani____right22:44
fwereadewaigani____, *but* the environs package uses the state package, so you can't directly reference an Environ as such from code inside state22:44
fwereadewaigani____, axw is dealing with *exactly* the same problem, creating environs inside state to validate machine addition22:44
fwereadewaigani____, so it would be good if your solutions were roughly aligned :)22:45
fwereadewaigani____, was that a bit more helpful?22:45
waigani____yes, you've set me in the right direction22:46
fwereade(ok, it's not *exactly* the same problem, but you can surely talk productively)22:46
waigani____ I'll go annoy axw now  ;)22:46
fwereadewaigani____, cool, cheers22:46
waigani____thanks again, sleep well22:47
* fwereade disappears22:47

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!