skydb/sky — pull request #141 by mkobetic (2013-09-13 16:05:44+00:00)
Title: Add MaxDBs and MaxReaders configuration options

Few notes on some of the choices I made implementing this.

I really dislike replicating the options on both the Server and factors.DB, so I added them to factors.DB only (and aligned noSync with it as well) and moved the NewDB call from Server.open to NewServer, so that the options can still be set on the server instance after creation.

This required a tweak to Server.close, to not nil out Server.fdb, because it is called right at the beginning of Server.open.

I'm not sure how controversial these tweaks will be, but I don't see a simpler change that avoids replicating these options all over the place. In fact my preference would be to keep them only in the Config and pass that as an additional argument to NewServer (and further down as needed). That would also nicely avoid replicating the defaults in both Config and factors.NewDB, but would require more changes.

I'm currently getting two failures in the test run, one of them was mentioned by Ben earlier and I suspect that the other may have something to do with the new average support. Neither seems like it would be related to my changes:
```
--- FAIL: TestServerMultiDimensionalQuery (0.04 seconds)
test.go:16: POST /tables/:name/query failed.:
exp:[200] {"_":{"avg":{"__average__":true,"avg":60,"count":6,"sum":360},"sum":2720},"gender":{"f":{"state":{"NY":{"maximum":30,"minimum":30}}},"m":{"state":{"CA":{"maximum":20,"minimum":0},"NY":{"maximum":200,"minimum":100}}}},"s1":{"gender":{"f":{"state":{"NY":{"count":1,"sum":30}}},"m":{"state":{"CA":{"count":3,"sum":30},"NY":{"count":2,"sum":300}}}}}}

got:[200] {"_":{"avg":{"__average__":true,"count":6,"sum":360},"sum":2720},"gender":{"f":{"state":{"NY":{"maximum":30,"minimum":30}}},"m":{"state":{"CA":{"maximum":20,"minimum":0},"NY":{"maximum":200,"minimum":100}}}},"s1":{"gender":{"f":{"state":{"NY":{"count":1,"sum":30}}},"m":{"state":{"CA":{"count":3,"sum":30},"NY":{"count":2,"sum":300}}}}}}

--- FAIL: TestServerHistogramQuery (0.04 seconds)
test.go:16: POST /tables/:name/query failed.:
exp:[200] {"hist":{"__histogram__":true,"bins":{"0":3,"1":1,"2":5},"count":3,"max":4,"min":0,"width":1.3333333333333333}}

got:[200] {"hist":{"__histogram__":true,"bins":{"0":8,"1":0,"2":1},"count":3,"max":100,"min":-1,"width":33.666666666666664}}
```

I think that's all worth highlighting.