diff --git a/cluster/cluster_configuration.go b/cluster/cluster_configuration.go index 0ad021ece39..f51064f5cfa 100644 --- a/cluster/cluster_configuration.go +++ b/cluster/cluster_configuration.go @@ -161,22 +161,6 @@ func (self *ClusterConfiguration) GetShardSpaces() []*ShardSpace { return spaces } -// called by the server, this will wake up every 10 mintues to see if it should -// create a shard for the next window of time. This way shards get created before -// a bunch of writes stream in and try to create it all at the same time. -func (self *ClusterConfiguration) CreateFutureShardsAutomaticallyBeforeTimeComes() { - go func() { - for { - time.Sleep(time.Minute * 10) - log.Debug("Checking to see if future shards should be created") - spaces := self.allSpaces() - for _, s := range spaces { - self.automaticallyCreateFutureShard(s) - } - } - }() -} - func (self *ClusterConfiguration) allSpaces() []*ShardSpace { self.shardLock.RLock() defer self.shardLock.RUnlock() @@ -205,20 +189,6 @@ func (self *ClusterConfiguration) GetExpiredShards() []*ShardData { return shards } -func (self *ClusterConfiguration) automaticallyCreateFutureShard(shardSpace *ShardSpace) { - if len(shardSpace.shards) == 0 { - // don't automatically create shards if they haven't created any yet. - return - } - latestShard := shardSpace.shards[0] - if latestShard.endTime.Add(-15*time.Minute).Unix() < time.Now().Unix() { - newShardTime := latestShard.endTime.Add(time.Second) - microSecondEpochForNewShard := newShardTime.Unix() * 1000 * 1000 - log.Info("Automatically creating shard for %s", newShardTime.Format("Mon Jan 2 15:04:05 -0700 MST 2006")) - self.createShards(microSecondEpochForNewShard, shardSpace) - } -} - func (self *ClusterConfiguration) ServerId() uint32 { return self.LocalServer.Id } diff --git a/server/server.go b/server/server.go index eed92f6ac89..0f3166ea24d 100644 --- a/server/server.go +++ b/server/server.go @@ -57,7 +57,6 @@ func NewServer(config *configuration.Configuration) (*Server, error) { metaStore.SetClusterConsensus(raftServer) clusterConfig.LocalRaftName = raftServer.GetRaftName() clusterConfig.SetShardCreator(raftServer) - clusterConfig.CreateFutureShardsAutomaticallyBeforeTimeComes() coord := coordinator.NewCoordinatorImpl(config, raftServer, clusterConfig, metaStore) requestHandler := coordinator.NewProtobufRequestHandler(coord, clusterConfig)