Skip to content

Commit

Permalink
Remove native pooling (#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
robskillington authored Aug 30, 2018
1 parent 399d904 commit 606981d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 46 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ test-ci-big-unit: test-big-base

.PHONY: test-ci-integration
test-ci-integration:
INTEGRATION_TIMEOUT=4m TEST_NATIVE_POOLING=false TEST_SERIES_CACHE_POLICY=$(cache_policy) make test-base-ci-integration
INTEGRATION_TIMEOUT=4m TEST_SERIES_CACHE_POLICY=$(cache_policy) make test-base-ci-integration
$(process_coverfile) $(coverfile)

define SUBDIR_RULES
Expand Down Expand Up @@ -278,16 +278,15 @@ test-html-$(SUBDIR):
@echo test-html $(SUBDIR)
SRC_ROOT=./src/$(SUBDIR) make test-base-html

# Note: do not test native pooling since it's experimental/deprecated
.PHONY: test-integration-$(SUBDIR)
test-integration-$(SUBDIR):
@echo test-integration $(SUBDIR)
SRC_ROOT=./src/$(SUBDIR) TEST_NATIVE_POOLING=false make test-base-integration
SRC_ROOT=./src/$(SUBDIR) make test-base-integration

# Usage: make test-single-integration name=<test_name>
.PHONY: test-single-integration-$(SUBDIR)
test-single-integration-$(SUBDIR):
SRC_ROOT=./src/$(SUBDIR) TEST_NATIVE_POOLING=false make test-base-single-integration name=$(name)
SRC_ROOT=./src/$(SUBDIR) make test-base-single-integration name=$(name)

.PHONY: test-ci-unit-$(SUBDIR)
test-ci-unit-$(SUBDIR):
Expand All @@ -304,7 +303,7 @@ test-ci-big-unit-$(SUBDIR):
.PHONY: test-ci-integration-$(SUBDIR)
test-ci-integration-$(SUBDIR):
@echo test-ci-integration $(SUBDIR)
SRC_ROOT=./src/$(SUBDIR) INTEGRATION_TIMEOUT=4m TEST_NATIVE_POOLING=false TEST_SERIES_CACHE_POLICY=$(cache_policy) make test-base-ci-integration
SRC_ROOT=./src/$(SUBDIR) INTEGRATION_TIMEOUT=4m TEST_SERIES_CACHE_POLICY=$(cache_policy) make test-base-ci-integration
$(codecov_push) -f $(coverfile) -F $(SUBDIR)

endef
Expand Down
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package: github.com/m3db/m3
import:
- package: github.com/m3db/m3x
version: 31a628e11c478af132b6eab71506fb93c7f9ca39
version: 0d74829a38311339911aeb8ff22c84c710832ab7
vcs: git
subpackages:
- checked
Expand Down
7 changes: 1 addition & 6 deletions src/cmd/services/m3dbnode/config/pooling.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ type PoolingType string
const (
// SimplePooling uses the basic Go runtime to allocate bytes for bytes pools.
SimplePooling PoolingType = "simple"
// NativePooling uses a mmap syscall to allocate bytes for bytes pools, take
// great care when experimenting with this. There's not enough protection
// even with ref counting that M3DB performs to use this safely in
// production. Here be dragons and so forth.
NativePooling PoolingType = "native"
)

const (
Expand All @@ -42,7 +37,7 @@ type PoolingPolicy struct {
// The initial alloc size for a block
BlockAllocSize int `yaml:"blockAllocSize"`

// The general pool type: simple or native.
// The general pool type (currently only supported: simple).
Type PoolingType `yaml:"type"`

// The Bytes pool buckets to use
Expand Down
25 changes: 3 additions & 22 deletions src/dbnode/integration/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import (
"github.com/m3db/m3cluster/shard"
"github.com/m3db/m3x/ident"
xlog "github.com/m3db/m3x/log"
"github.com/m3db/m3x/pool"
xsync "github.com/m3db/m3x/sync"

"github.com/stretchr/testify/require"
Expand All @@ -67,10 +66,9 @@ var (
tchannelNodeAddr = flag.String("nodetchanneladdr", "127.0.0.1:9003", "Node TChannel server address")
httpDebugAddr = flag.String("debughttpaddr", "127.0.0.1:9004", "HTTP debug server address")

errServerStartTimedOut = errors.New("server took too long to start")
errServerStopTimedOut = errors.New("server took too long to stop")
testNamespaces = []ident.ID{ident.StringID("testNs1"), ident.StringID("testNs2")}
testNativePoolingBuckets = []pool.Bucket{{Capacity: 4096, Count: 256}}
errServerStartTimedOut = errors.New("server took too long to start")
errServerStopTimedOut = errors.New("server took too long to stop")
testNamespaces = []ident.ID{ident.StringID("testNs1"), ident.StringID("testNs2")}

created = uint64(0)
)
Expand All @@ -87,7 +85,6 @@ type testSetup struct {
db cluster.Database
storageOpts storage.Options
fsOpts fs.Options
nativePooling bool
hostID string
topoInit topology.Initializer
shardSet sharding.ShardSet
Expand Down Expand Up @@ -142,21 +139,6 @@ func newTestSetup(t *testing.T, opts testOptions, fsOpts fs.Options) (*testSetup
return nil, err
}

nativePooling := strings.ToLower(os.Getenv("TEST_NATIVE_POOLING")) == "true"
if nativePooling {
buckets := testNativePoolingBuckets
bytesPool := pool.NewCheckedBytesPool(buckets, nil, func(s []pool.Bucket) pool.BytesPool {
return pool.NewNativeHeap(s, nil)
})
bytesPool.Init()

storageOpts = storageOpts.SetBytesPool(bytesPool)

idPool := ident.NewNativePool(bytesPool, ident.PoolOptions{})

storageOpts = storageOpts.SetIdentifierPool(idPool)
}

// Set up shard set
shardSet, err := newTestShardSet(opts.NumShards())
if err != nil {
Expand Down Expand Up @@ -327,7 +309,6 @@ func newTestSetup(t *testing.T, opts testOptions, fsOpts fs.Options) (*testSetup
logger: logger,
storageOpts: storageOpts,
fsOpts: fsOpts,
nativePooling: nativePooling,
hostID: id,
topoInit: topoInit,
shardSet: shardSet,
Expand Down
7 changes: 0 additions & 7 deletions src/dbnode/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -918,13 +918,6 @@ func withEncodingAndPoolingOptions(
func(s []pool.Bucket) pool.BytesPool {
return pool.NewBytesPool(s, bytesPoolOpts)
})
case config.NativePooling:
bytesPool = pool.NewCheckedBytesPool(
buckets,
checkedBytesPoolOpts,
func(s []pool.Bucket) pool.BytesPool {
return pool.NewNativeHeap(s, bytesPoolOpts)
})
default:
logger.Fatalf("unrecognized pooling type: %s", policy.Type)
}
Expand Down
4 changes: 2 additions & 2 deletions src/dbnode/storage/bootstrap/bootstrapper/commitlog/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ func (s *commitLogSource) newReadCommitLogPredBasedOnAvailableSnapshotFiles(
instrument.InvariantViolatedMetricName, shard, block.ToTime().String())
}

s.log.Infof(
s.log.Debugf(
"most recent snapshot for block: %s and shard: %d is %s",
block.ToTime().String(), shard, mostRecent.CachedSnapshotTime.String())
}
Expand All @@ -723,7 +723,7 @@ func (s *commitLogSource) newReadCommitLogPredBasedOnAvailableSnapshotFiles(
minimumMostRecentSnapshotTimeByBlock := s.minimumMostRecentSnapshotTimeByBlock(
shardsTimeRanges, blockSize, mostRecentCompleteSnapshotByBlockShard)
for block, minSnapshotTime := range minimumMostRecentSnapshotTimeByBlock {
s.log.Infof(
s.log.Debugf(
"min snapshot time for block: %s is: %s",
block.ToTime().String(), minSnapshotTime.String())
}
Expand Down

0 comments on commit 606981d

Please sign in to comment.