Querying for data outside of existing shards should return an empty response.

Fix #1004. Close #1023
pull/1023/merge
Todd Persen 2014-10-11 21:36:05 -04:00 committed by John Shahid
parent 74dad10845
commit f16f4b6639
3 changed files with 37 additions and 1 deletions

View File

@ -4,6 +4,8 @@
- [Issue #1007](https://github.com/influxdb/influxdb/issues/1007). Return the
right content type in the response when compression is enabled
- [Issue #1004](https://github.com/influxdb/influxdb/issues/1004). Don't throw an
exception when querying for non existent data
- [Issue #722](https://github.com/influxdb/influxdb/issues/722). Add
an install target to the Makefile
- [Issue #916](https://github.com/influxdb/influxdb/issues/916). Set

View File

@ -275,7 +275,7 @@ func (self *Coordinator) runQuerySpec(querySpec *parser.QuerySpec, p engine.Proc
}
if len(shards) == 0 {
return fmt.Errorf("Couldn't look up columns")
return processor.Close()
}
shardConcurrentLimit := self.config.ConcurrentShardQueryLimit

View File

@ -587,6 +587,40 @@ func (self *SingleServerSuite) TestDataResurrectionAfterRestart(c *C) {
c.Assert(series[0].Points, HasLen, 0)
}
func (self *SingleServerSuite) TestEmptyResponseWhenNoShardsMatchQuery(c *C) {
rootUser := self.server.GetClient("", c)
rootUser.CreateDatabase("db")
c.Assert(rootUser.CreateDatabaseUser("db", "user", "pass"), IsNil)
config := &influxdb.ClientConfig{
Username: "user",
Password: "pass",
Database: "db",
}
user, _ := influxdb.NewClient(config)
data := `
[
{
"points": [
[1]
],
"name": "test_should_write",
"columns": ["value"]
}
]`
series := []*influxdb.Series{}
c.Assert(json.Unmarshal([]byte(data), &series), IsNil)
c.Assert(user.WriteSeries(series), IsNil)
failing_content := self.server.RunQueryAsRoot("select * from test_should_write where time > '1990-12-01' and time < '1990-12-12'", "m", c)
c.Assert(failing_content, HasLen, 0)
}
// issue https://github.com/influxdb/influxdb/issues/702. Dropping shards can cause server crash
// Two cases here. First is they try to drop the same shard multiple times. Second is that
// they drop a shard and the server gets restarted so the raft log replays and tries to drop it again.