fix . Create a checkpoint before executing a delete query

pull/443/head
John Shahid 2014-04-15 15:49:31 -04:00
parent 6cb941310e
commit afb76a8183
3 changed files with 23 additions and 0 deletions

View File

@ -8,6 +8,7 @@
causing count(*) queries on large time series to use
lots of memory
- [Issue #437](https://github.com/influxdb/influxdb/issues/437). Queries with negative constants don't parse properly
- [Issue #432](https://github.com/influxdb/influxdb/issues/432). Deleted data using a delete query is resurrected after a server restart
## v0.5.6 [2014-04-08]

View File

@ -90,6 +90,10 @@ func (self *CoordinatorImpl) RunQuery(user common.User, database string, querySt
querySpec := parser.NewQuerySpec(user, database, query)
if query.DeleteQuery != nil {
if err := self.clusterConfiguration.CreateCheckpoint(); err != nil {
return err
}
if err := self.runDeleteQuery(querySpec, seriesWriter); err != nil {
return err
}

View File

@ -142,6 +142,24 @@ func (self *SingleServerSuite) TestDeletingNewDatabase(c *C) {
}
}
// issue #432
func (self *SingleServerSuite) TestDataResurrectionAfterRestartWithDeleteQuery(c *C) {
s := CreatePoints("data_resurrection_with_delete", 1, 10)
self.server.WriteData(s, c)
self.server.WaitForServerToSync()
series := self.server.RunQuery("select count(column0) from data_resurrection_with_delete", "s", c)
c.Assert(series, HasLen, 1)
c.Assert(series[0].Points[0][1], Equals, 10.0)
self.server.RunQuery("delete from data_resurrection_with_delete", "s", c)
series = self.server.RunQuery("select count(column0) from data_resurrection_with_delete", "s", c)
c.Assert(series, HasLen, 0)
self.server.Stop()
c.Assert(self.server.Start(), IsNil)
self.server.WaitForServerToStart()
series = self.server.RunQuery("select count(column0) from data_resurrection_with_delete", "s", c)
c.Assert(series, HasLen, 0)
}
// issue #342, #371
func (self *SingleServerSuite) TestDataResurrectionAfterRestart(c *C) {
s := CreatePoints("data_resurrection", 1, 10)