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 2022/08/03 13:24:27 UTC

[skywalking-banyandb] branch tsdb-block created (now 25fe41d)

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

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


      at 25fe41d  Merge primary index into lsm index

This branch includes the following new commits:

     new 25fe41d  Merge primary index into lsm index

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.



[skywalking-banyandb] 01/01: Merge primary index into lsm index

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

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

commit 25fe41dd90649c5be26e3c9b3f2a1edca69e96e3
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Wed Aug 3 13:18:43 2022 +0000

    Merge primary index into lsm index
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 banyand/tsdb/block.go  | 28 +++++++---------------------
 banyand/tsdb/metric.go |  1 -
 2 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/banyand/tsdb/block.go b/banyand/tsdb/block.go
index f913ce2..3419a34 100644
--- a/banyand/tsdb/block.go
+++ b/banyand/tsdb/block.go
@@ -43,7 +43,6 @@ import (
 
 const (
 	componentMain              = "main"
-	componentPrimaryIdx        = "primary"
 	componentSecondInvertedIdx = "inverted"
 	componentSecondLSMIdx      = "lsm"
 )
@@ -58,7 +57,6 @@ type block struct {
 	position common.Position
 
 	store         kv.TimeSeriesStore
-	primaryIndex  index.Store
 	invertedIndex index.Store
 	lsmIndex      index.Store
 	closableLst   []io.Closer
@@ -144,13 +142,7 @@ func (b *block) open() (err error) {
 	); err != nil {
 		return err
 	}
-	if b.primaryIndex, err = lsm.NewStore(lsm.StoreOpts{
-		Path:   path.Join(b.path, componentPrimaryIdx),
-		Logger: b.l.Named(componentPrimaryIdx),
-	}); err != nil {
-		return err
-	}
-	b.closableLst = append(b.closableLst, b.store, b.primaryIndex)
+	b.closableLst = append(b.closableLst, b.store)
 	if b.invertedIndex, err = inverted.NewStore(inverted.StoreOpts{
 		Path:   path.Join(b.path, componentSecondInvertedIdx),
 		Logger: b.l.Named(componentSecondInvertedIdx),
@@ -222,8 +214,8 @@ func (b *block) String() string {
 }
 
 func (b *block) stats() (names []string, stats []observability.Statistics) {
-	names = append(names, componentMain, componentPrimaryIdx, componentSecondInvertedIdx, componentSecondLSMIdx)
-	stats = append(stats, b.store.Stats(), b.primaryIndex.Stats(), b.invertedIndex.Stats(), b.lsmIndex.Stats())
+	names = append(names, componentMain, componentSecondInvertedIdx, componentSecondLSMIdx)
+	stats = append(stats, b.store.Stats(), b.invertedIndex.Stats(), b.lsmIndex.Stats())
 	return names, stats
 }
 
@@ -237,7 +229,7 @@ type blockDelegate interface {
 	dataReader() kv.TimeSeriesReader
 	lsmIndexReader() index.Searcher
 	invertedIndexReader() index.Searcher
-	primaryIndexReader() index.Searcher
+	primaryIndexReader() index.FieldIterable
 	identity() (segID uint16, blockID uint16)
 	startTime() time.Time
 	String() string
@@ -261,8 +253,8 @@ func (d *bDelegate) invertedIndexReader() index.Searcher {
 	return d.delegate.invertedIndex
 }
 
-func (d *bDelegate) primaryIndexReader() index.Searcher {
-	return d.delegate.primaryIndex
+func (d *bDelegate) primaryIndexReader() index.FieldIterable {
+	return d.delegate.lsmIndex
 }
 
 func (d *bDelegate) startTime() time.Time {
@@ -278,20 +270,14 @@ func (d *bDelegate) write(key []byte, val []byte, ts time.Time) error {
 }
 
 func (d *bDelegate) writePrimaryIndex(field index.Field, id common.ItemID) error {
-	return d.delegate.primaryIndex.Write(field, id)
+	return d.delegate.lsmIndex.Write(field, id)
 }
 
 func (d *bDelegate) writeLSMIndex(field index.Field, id common.ItemID) error {
-	if d.delegate.lsmIndex == nil {
-		return nil
-	}
 	return d.delegate.lsmIndex.Write(field, id)
 }
 
 func (d *bDelegate) writeInvertedIndex(field index.Field, id common.ItemID) error {
-	if d.delegate.invertedIndex == nil {
-		return nil
-	}
 	return d.delegate.invertedIndex.Write(field, id)
 }
 
diff --git a/banyand/tsdb/metric.go b/banyand/tsdb/metric.go
index 6cdfd0c..d3d6c06 100644
--- a/banyand/tsdb/metric.go
+++ b/banyand/tsdb/metric.go
@@ -114,7 +114,6 @@ func (s *shard) curry(gv *prometheus.GaugeVec) *prometheus.GaugeVec {
 func newBlockStat() map[string]*observability.Statistics {
 	return map[string]*observability.Statistics{
 		componentMain:              {},
-		componentPrimaryIdx:        {},
 		componentSecondInvertedIdx: {},
 		componentSecondLSMIdx:      {},
 	}