You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2023/05/30 03:37:55 UTC

[skywalking-banyandb] branch load-tet updated (51c53a2c -> 452fb217)

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a change to branch load-tet
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


 discard 51c53a2c Refactor several parameters
     new 452fb217 Refactor several parameters

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (51c53a2c)
            \
             N -- N -- N   refs/heads/load-tet (452fb217)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.md | 2 ++
 1 file changed, 2 insertions(+)


[skywalking-banyandb] 01/01: Refactor several parameters

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch load-tet
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit 452fb2175d5c36177be8f7368d1bc414d84618b6
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Tue May 30 03:32:04 2023 +0000

    Refactor several parameters
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 CHANGES.md                  |   2 +
 banyand/kv/kv.go            |  47 ++++++++++------
 banyand/measure/encode.go   |  96 --------------------------------
 banyand/measure/metadata.go |  14 ++++-
 banyand/measure/tstable.go  | 130 +++++++++++++++++++++++++++++++++-----------
 banyand/stream/tstable.go   |   6 +-
 banyand/tsdb/block.go       |   5 +-
 banyand/tsdb/tstable.go     |   2 -
 8 files changed, 148 insertions(+), 154 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 8b520926..850f8754 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -16,6 +16,8 @@ Release Notes.
 - Fix max ModRevision computation with inclusion of `TopNAggregation`
 - Enhance meter performance
 - Reduce logger creation frequency
+- Add units to memory flags
+- Introduce TSTable to customize the block's structure 
 
 ### Bugs
 
diff --git a/banyand/kv/kv.go b/banyand/kv/kv.go
index cc816211..49b105c3 100644
--- a/banyand/kv/kv.go
+++ b/banyand/kv/kv.go
@@ -111,12 +111,14 @@ func TSSWithLogger(l *logger.Logger) TimeSeriesOptions {
 func TSSWithEncoding(encoderPool encoding.SeriesEncoderPool, decoderPool encoding.SeriesDecoderPool, chunkSize int) TimeSeriesOptions {
 	return func(store TimeSeriesStore) {
 		if btss, ok := store.(*badgerTSS); ok {
-			btss.dbOpts = btss.dbOpts.WithKeyBasedEncoder(
-				&encoderPoolDelegate{
-					encoderPool,
-				}, &decoderPoolDelegate{
-					decoderPool,
-				}, chunkSize)
+			btss.dbOpts = btss.dbOpts.
+				WithKeyBasedEncoder(
+					&encoderPoolDelegate{
+						encoderPool,
+					}, &decoderPoolDelegate{
+						decoderPool,
+					}, chunkSize).
+				WithSameKeyBlock()
 		}
 	}
 }
@@ -128,7 +130,7 @@ func TSSWithZSTDCompression(chunkSize int) TimeSeriesOptions {
 			btss.dbOpts = btss.dbOpts.
 				WithCompression(options.ZSTD).
 				WithBlockSize(chunkSize).
-				WithSameKeyBlock()
+				WithZSTDCompressionLevel(3)
 		}
 	}
 }
@@ -180,15 +182,20 @@ func OpenTimeSeriesStore(path string, options ...TimeSeriesOptions) (TimeSeriesS
 		opt(btss)
 	}
 	// Put all values into LSM
-	btss.dbOpts = btss.dbOpts.WithNumVersionsToKeep(math.MaxUint32)
-	btss.dbOpts = btss.dbOpts.WithVLogPercentile(1.0)
+	btss.dbOpts = btss.dbOpts.
+		WithNumVersionsToKeep(math.MaxUint32).
+		WithVLogPercentile(1.0).
+		WithInTable().
+		WithMaxLevels(2).
+		WithBaseTableSize(10 << 20).
+		WithBaseLevelSize(math.MaxInt64)
 	if btss.dbOpts.MemTableSize < int64(defaultKVMemorySize) {
 		btss.dbOpts.MemTableSize = int64(defaultKVMemorySize)
 	}
 	if btss.dbOpts.MemTableSize < 8<<20 {
 		btss.dbOpts = btss.dbOpts.WithValueThreshold(1 << 10)
 	}
-	btss.dbOpts = btss.dbOpts.WithInTable()
+	btss.dbOpts.LmaxCompaction = true
 	var err error
 	btss.db, err = badger.Open(btss.dbOpts)
 	if err != nil {
@@ -231,10 +238,10 @@ func StoreWithMemTableSize(size int64) StoreOptions {
 
 // OpenStore creates a new Store.
 // nolint: contextcheck
-func OpenStore(path string, options ...StoreOptions) (Store, error) {
+func OpenStore(path string, opts ...StoreOptions) (Store, error) {
 	bdb := new(badgerDB)
 	bdb.dbOpts = badger.DefaultOptions(path)
-	for _, opt := range options {
+	for _, opt := range opts {
 		opt(bdb)
 	}
 	if bdb.dbOpts.MemTableSize < int64(defaultKVMemorySize) {
@@ -243,6 +250,11 @@ func OpenStore(path string, options ...StoreOptions) (Store, error) {
 	if bdb.dbOpts.MemTableSize < 8<<20 {
 		bdb.dbOpts = bdb.dbOpts.WithValueThreshold(1 << 10)
 	}
+	bdb.dbOpts = bdb.dbOpts.
+		WithBaseTableSize(5 << 20).
+		WithBaseLevelSize(25 << 20).
+		WithCompression(options.ZSTD).
+		WithZSTDCompressionLevel(1)
 
 	var err error
 	bdb.db, err = badger.Open(bdb.dbOpts)
@@ -273,10 +285,13 @@ func OpenIndexStore(path string, options ...IndexOptions) (IndexStore, error) {
 	for _, opt := range options {
 		opt(bdb)
 	}
-	bdb.dbOpts = bdb.dbOpts.WithNumVersionsToKeep(math.MaxUint32)
-	bdb.dbOpts = bdb.dbOpts.WithNumCompactors(2)
-	bdb.dbOpts = bdb.dbOpts.WithMemTableSize(2 << 20)
-	bdb.dbOpts = bdb.dbOpts.WithValueThreshold(1 << 10)
+	bdb.dbOpts = bdb.dbOpts.WithNumVersionsToKeep(math.MaxUint32).
+		WithNumCompactors(2).
+		WithMemTableSize(2 << 20).
+		WithMaxLevels(2).
+		WithBaseTableSize(2 << 20).
+		WithBaseLevelSize(math.MaxInt64).
+		WithValueThreshold(1 << 10)
 
 	var err error
 	bdb.db, err = badger.Open(bdb.dbOpts)
diff --git a/banyand/measure/encode.go b/banyand/measure/encode.go
deleted file mode 100644
index 452fbf95..00000000
--- a/banyand/measure/encode.go
+++ /dev/null
@@ -1,96 +0,0 @@
-// Licensed to Apache Software Foundation (ASF) under one or more contributor
-// license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright
-// ownership. Apache Software Foundation (ASF) licenses this file to you under
-// the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//	http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package measure
-
-import (
-	"time"
-
-	databasev1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
-	"github.com/apache/skywalking-banyandb/pkg/encoding"
-	"github.com/apache/skywalking-banyandb/pkg/logger"
-	pbv1 "github.com/apache/skywalking-banyandb/pkg/pb/v1"
-)
-
-var (
-	_          encoding.SeriesEncoderPool = (*encoderPool)(nil)
-	_          encoding.SeriesDecoderPool = (*decoderPool)(nil)
-	intervalFn                            = func(key []byte) time.Duration {
-		_, interval, err := pbv1.DecodeFieldFlag(key)
-		if err != nil {
-			panic(err)
-		}
-		return interval
-	}
-)
-
-type encoderPool struct {
-	intPool encoding.SeriesEncoderPool
-	l       *logger.Logger
-}
-
-func newEncoderPool(name string, size int, l *logger.Logger) encoding.SeriesEncoderPool {
-	return &encoderPool{
-		intPool: encoding.NewEncoderPool(name, size, intervalFn),
-		l:       l,
-	}
-}
-
-func (p *encoderPool) Get(metadata []byte, buffer encoding.BufferWriter) encoding.SeriesEncoder {
-	fieldSpec, _, err := pbv1.DecodeFieldFlag(metadata)
-	if err != nil {
-		p.l.Err(err).Msg("failed to decode field flag")
-	}
-	if fieldSpec.EncodingMethod == databasev1.EncodingMethod_ENCODING_METHOD_GORILLA {
-		return p.intPool.Get(metadata, buffer)
-	}
-	return nil
-}
-
-func (p *encoderPool) Put(encoder encoding.SeriesEncoder) {
-	p.intPool.Put(encoder)
-}
-
-type decoderPool struct {
-	intPool encoding.SeriesDecoderPool
-	l       *logger.Logger
-}
-
-func newDecoderPool(name string, size int, l *logger.Logger) encoding.SeriesDecoderPool {
-	return &decoderPool{
-		intPool: encoding.NewDecoderPool(name, size, intervalFn),
-		l:       l,
-	}
-}
-
-func (p *decoderPool) Get(metadata []byte) encoding.SeriesDecoder {
-	fieldSpec, _, err := pbv1.DecodeFieldFlag(metadata)
-	if err != nil {
-		p.l.Err(err).Msg("failed to decode field flag")
-		return nil
-	}
-	if fieldSpec.EncodingMethod == databasev1.EncodingMethod_ENCODING_METHOD_GORILLA {
-		return p.intPool.Get(metadata)
-	}
-	return nil
-}
-
-func (p *decoderPool) Put(decoder encoding.SeriesDecoder) {
-	if decoder != nil {
-		p.intPool.Put(decoder)
-	}
-}
diff --git a/banyand/measure/metadata.go b/banyand/measure/metadata.go
index 403bd560..d12533e7 100644
--- a/banyand/measure/metadata.go
+++ b/banyand/measure/metadata.go
@@ -38,6 +38,7 @@ import (
 	"github.com/apache/skywalking-banyandb/banyand/tsdb"
 	"github.com/apache/skywalking-banyandb/pkg/encoding"
 	"github.com/apache/skywalking-banyandb/pkg/logger"
+	pbv1 "github.com/apache/skywalking-banyandb/pkg/pb/v1"
 	pb_v1 "github.com/apache/skywalking-banyandb/pkg/pb/v1/tsdb"
 	resourceSchema "github.com/apache/skywalking-banyandb/pkg/schema"
 )
@@ -324,11 +325,10 @@ func (s *supplier) OpenDB(groupSchema *commonv1.Group) (tsdb.Database, error) {
 	opts.TSTableFactory = &tsTableFactory{
 		bufferSize:        s.bufferSize,
 		encoderBufferSize: s.encoderBufferSize,
-		encoderPool:       encoding.NewEncoderPool(name, intChunkSize, intervalFn),
-		decoderPool:       encoding.NewDecoderPool(name, intChunkSize, intervalFn),
+		encoderPool:       encoding.NewEncoderPool(name, intChunkNum, intervalFn),
+		decoderPool:       encoding.NewDecoderPool(name, intChunkNum, intervalFn),
 		compressionMethod: databasev1.CompressionMethod_COMPRESSION_METHOD_ZSTD,
 		encodingChunkSize: intChunkSize,
-		encodingChunkNum:  intChunkNum,
 		plainChunkSize:    plainChunkSize,
 	}
 
@@ -351,3 +351,11 @@ func (s *supplier) OpenDB(groupSchema *commonv1.Group) (tsdb.Database, error) {
 		}),
 		opts)
 }
+
+func intervalFn(key []byte) time.Duration {
+	_, interval, err := pbv1.DecodeFieldFlag(key)
+	if err != nil {
+		panic(err)
+	}
+	return interval
+}
diff --git a/banyand/measure/tstable.go b/banyand/measure/tstable.go
index 7bdb1c99..b332d2f3 100644
--- a/banyand/measure/tstable.go
+++ b/banyand/measure/tstable.go
@@ -19,8 +19,10 @@ package measure
 
 import (
 	"fmt"
+	"io"
 	"path"
 	"sync"
+	"sync/atomic"
 	"time"
 
 	"github.com/dgraph-io/badger/v3"
@@ -33,38 +35,48 @@ import (
 	"github.com/apache/skywalking-banyandb/banyand/tsdb"
 	"github.com/apache/skywalking-banyandb/pkg/encoding"
 	"github.com/apache/skywalking-banyandb/pkg/logger"
+	pbv1 "github.com/apache/skywalking-banyandb/pkg/pb/v1"
 )
 
 const (
 	defaultNumBufferShards  = 2
 	defaultWriteConcurrency = 1000
-	id                      = "tst"
+	plain                   = "tst"
+	encoded                 = "encoded"
 )
 
 var _ tsdb.TSTable = (*tsTable)(nil)
 
 type tsTable struct {
-	sst kv.TimeSeriesStore
+	encoderSST kv.TimeSeriesStore
+	sst        kv.TimeSeriesStore
 	*tsdb.BlockExpiryTracker
-	l                *logger.Logger
-	buffer           *tsdb.Buffer
-	closeBufferTimer *time.Timer
-	position         common.Position
-	bufferSize       int64
-	lock             sync.Mutex
+	l                 *logger.Logger
+	encoderBuffer     *tsdb.Buffer
+	buffer            *tsdb.Buffer
+	closeBufferTimer  *time.Timer
+	position          common.Position
+	bufferSize        int64
+	encoderBufferSize int64
+	lock              sync.Mutex
 }
 
 func (t *tsTable) SizeOnDisk() int64 {
-	return t.sst.SizeOnDisk()
+	return t.encoderSST.SizeOnDisk()
 }
 
-func (t *tsTable) OpenBuffer() (err error) {
+func (t *tsTable) openBuffer() (err error) {
 	t.lock.Lock()
 	defer t.lock.Unlock()
-	if t.buffer != nil {
+	if t.encoderBuffer != nil {
 		return nil
 	}
-	bufferSize := int(t.bufferSize / defaultNumBufferShards)
+	bufferSize := int(t.encoderBufferSize / defaultNumBufferShards)
+	if t.encoderBuffer, err = tsdb.NewBuffer(t.l, t.position, bufferSize,
+		defaultWriteConcurrency, defaultNumBufferShards, t.encoderFlush); err != nil {
+		return fmt.Errorf("failed to create encoder buffer: %w", err)
+	}
+	bufferSize = int(t.bufferSize / defaultNumBufferShards)
 	if t.buffer, err = tsdb.NewBuffer(t.l, t.position, bufferSize,
 		defaultWriteConcurrency, defaultNumBufferShards, t.flush); err != nil {
 		return fmt.Errorf("failed to create buffer: %w", err)
@@ -81,13 +93,18 @@ func (t *tsTable) OpenBuffer() (err error) {
 		}
 		t.lock.Lock()
 		defer t.lock.Unlock()
-		if t.buffer == nil {
-			return
+		if t.encoderBuffer != nil {
+			if err := t.encoderBuffer.Close(); err != nil {
+				t.l.Error().Err(err).Msg("close encoder buffer error")
+			}
+			t.encoderBuffer = nil
 		}
-		if err := t.buffer.Close(); err != nil {
-			t.l.Error().Err(err).Msg("close buffer error")
+		if t.buffer != nil {
+			if err := t.buffer.Close(); err != nil {
+				t.l.Error().Err(err).Msg("close buffer error")
+			}
+			t.buffer = nil
 		}
-		t.buffer = nil
 	})
 	return nil
 }
@@ -95,17 +112,39 @@ func (t *tsTable) OpenBuffer() (err error) {
 func (t *tsTable) Close() (err error) {
 	t.lock.Lock()
 	defer t.lock.Unlock()
-	if t.buffer != nil {
-		err = multierr.Append(err, t.buffer.Close())
+	for _, b := range []io.Closer{t.encoderBuffer, t.buffer, t.sst, t.encoderSST} {
+		if b != nil {
+			err = multierr.Append(err, b.Close())
+		}
 	}
-	return multierr.Combine(err, t.sst.Close())
+	return err
 }
 
 func (t *tsTable) CollectStats() *badger.Statistics {
-	return t.sst.CollectStats()
+	mergedMap := &sync.Map{}
+	for _, s := range []*badger.Statistics{t.encoderSST.CollectStats(), t.sst.CollectStats()} {
+		if s != nil && s.TableBuilderSize != nil {
+			s.TableBuilderSize.Range(func(key, value interface{}) bool {
+				val := value.(*atomic.Int64)
+				if val.Load() > 0 {
+					mergedMap.Store(key, val)
+				}
+				return true
+			})
+		}
+	}
+	return &badger.Statistics{
+		TableBuilderSize: mergedMap,
+	}
 }
 
 func (t *tsTable) Get(key []byte, ts time.Time) ([]byte, error) {
+	if t.toEncode(key) {
+		if v, ok := t.encoderBuffer.Read(key, ts); ok {
+			return v, nil
+		}
+		return t.encoderSST.Get(key, uint64(ts.UnixNano()))
+	}
 	if v, ok := t.buffer.Read(key, ts); ok {
 		return v, nil
 	}
@@ -113,22 +152,42 @@ func (t *tsTable) Get(key []byte, ts time.Time) ([]byte, error) {
 }
 
 func (t *tsTable) Put(key []byte, val []byte, ts time.Time) error {
-	if t.buffer != nil {
-		t.buffer.Write(key, val, ts)
+	if t.encoderBuffer != nil {
+		t.writeToBuffer(key, val, ts)
 	}
-
-	if err := t.OpenBuffer(); err != nil {
+	if err := t.openBuffer(); err != nil {
 		return err
 	}
-	t.buffer.Write(key, val, ts)
+	t.writeToBuffer(key, val, ts)
 	return nil
 }
 
+func (t *tsTable) writeToBuffer(key []byte, val []byte, ts time.Time) {
+	if t.toEncode(key) {
+		t.encoderBuffer.Write(key, val, ts)
+	} else {
+		t.buffer.Write(key, val, ts)
+	}
+}
+
+func (t *tsTable) encoderFlush(shardIndex int, skl *skl.Skiplist) error {
+	t.l.Info().Int("shard", shardIndex).Msg("flushing encoder buffer")
+	return t.encoderSST.Handover(skl)
+}
+
 func (t *tsTable) flush(shardIndex int, skl *skl.Skiplist) error {
 	t.l.Info().Int("shard", shardIndex).Msg("flushing buffer")
 	return t.sst.Handover(skl)
 }
 
+func (t *tsTable) toEncode(key []byte) bool {
+	fieldSpec, _, err := pbv1.DecodeFieldFlag(key)
+	if err != nil {
+		t.l.Err(err).Msg("failed to decode field flag")
+	}
+	return fieldSpec.EncodingMethod == databasev1.EncodingMethod_ENCODING_METHOD_GORILLA
+}
+
 var _ tsdb.TSTableFactory = (*tsTableFactory)(nil)
 
 type tsTableFactory struct {
@@ -138,30 +197,39 @@ type tsTableFactory struct {
 	encoderBufferSize int64
 	plainChunkSize    int64
 	encodingChunkSize int
-	encodingChunkNum  int
 	compressionMethod databasev1.CompressionMethod
 }
 
 func (ttf *tsTableFactory) NewTSTable(blockExpiryTracker tsdb.BlockExpiryTracker, root string, position common.Position, l *logger.Logger) (tsdb.TSTable, error) {
+	encoderSST, err := kv.OpenTimeSeriesStore(
+		path.Join(root, encoded),
+		kv.TSSWithMemTableSize(ttf.bufferSize),
+		kv.TSSWithLogger(l.Named(encoded)),
+		kv.TSSWithEncoding(ttf.encoderPool, ttf.decoderPool, ttf.encodingChunkSize),
+	)
+	if err != nil {
+		return nil, fmt.Errorf("failed to create time series table: %w", err)
+	}
 	sst, err := kv.OpenTimeSeriesStore(
-		path.Join(root, id),
+		path.Join(root, plain),
 		kv.TSSWithMemTableSize(ttf.bufferSize),
-		kv.TSSWithLogger(l.Named(id)),
+		kv.TSSWithLogger(l.Named(plain)),
 		kv.TSSWithZSTDCompression(int(ttf.plainChunkSize)),
-		kv.TSSWithEncoding(newEncoderPool(id, ttf.encodingChunkNum, l), newDecoderPool(id, ttf.encodingChunkNum, l), ttf.encodingChunkSize),
 	)
 	if err != nil {
 		return nil, fmt.Errorf("failed to create time series table: %w", err)
 	}
 	table := &tsTable{
 		bufferSize:         ttf.bufferSize,
+		encoderBufferSize:  ttf.encoderBufferSize,
 		l:                  l,
 		position:           position,
+		encoderSST:         encoderSST,
 		sst:                sst,
 		BlockExpiryTracker: &blockExpiryTracker,
 	}
 	if table.IsActive() {
-		if err := table.OpenBuffer(); err != nil {
+		if err := table.openBuffer(); err != nil {
 			return nil, fmt.Errorf("failed to open buffer: %w", err)
 		}
 	}
diff --git a/banyand/stream/tstable.go b/banyand/stream/tstable.go
index 61e7daf8..d1af0adb 100644
--- a/banyand/stream/tstable.go
+++ b/banyand/stream/tstable.go
@@ -57,7 +57,7 @@ func (t *tsTable) SizeOnDisk() int64 {
 	return t.sst.SizeOnDisk()
 }
 
-func (t *tsTable) OpenBuffer() (err error) {
+func (t *tsTable) openBuffer() (err error) {
 	t.lock.Lock()
 	defer t.lock.Unlock()
 	if t.buffer != nil {
@@ -116,7 +116,7 @@ func (t *tsTable) Put(key []byte, val []byte, ts time.Time) error {
 		t.buffer.Write(key, val, ts)
 	}
 
-	if err := t.OpenBuffer(); err != nil {
+	if err := t.openBuffer(); err != nil {
 		return err
 	}
 	t.buffer.Write(key, val, ts)
@@ -150,7 +150,7 @@ func (ttf *tsTableFactory) NewTSTable(blockExpiryTracker tsdb.BlockExpiryTracker
 		BlockExpiryTracker: &blockExpiryTracker,
 	}
 	if table.IsActive() {
-		if err := table.OpenBuffer(); err != nil {
+		if err := table.openBuffer(); err != nil {
 			return nil, fmt.Errorf("failed to open buffer: %w", err)
 		}
 	}
diff --git a/banyand/tsdb/block.go b/banyand/tsdb/block.go
index 54520524..70f97726 100644
--- a/banyand/tsdb/block.go
+++ b/banyand/tsdb/block.go
@@ -51,9 +51,8 @@ const (
 	componentSecondInvertedIdx = "inverted"
 	componentSecondLSMIdx      = "lsm"
 
-	defaultEnqueueTimeout  = 500 * time.Millisecond
-	defaultNumBufferShards = 2
-	itemIDLength           = unsafe.Sizeof(common.ItemID(0))
+	defaultEnqueueTimeout = 500 * time.Millisecond
+	itemIDLength          = unsafe.Sizeof(common.ItemID(0))
 )
 
 var (
diff --git a/banyand/tsdb/tstable.go b/banyand/tsdb/tstable.go
index 18024d20..a10d1de9 100644
--- a/banyand/tsdb/tstable.go
+++ b/banyand/tsdb/tstable.go
@@ -32,8 +32,6 @@ const maxBlockAge = time.Hour
 
 // TSTable is time series table.
 type TSTable interface {
-	// OpenBuffer opens a buffer for writing.
-	OpenBuffer() error
 	// Put a value with a timestamp/version
 	Put(key, val []byte, ts time.Time) error
 	// Get a value by its key and timestamp/version