Skip to content

Commit

Permalink
Merge pull request #146 from disney/tpch-support
Browse files Browse the repository at this point in the history
Merge fixes to develop for release candidate 3
  • Loading branch information
guymolinari authored Aug 9, 2024
2 parents 48e8d73 + b13b66e commit afe43be
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
6 changes: 6 additions & 0 deletions server/bitmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,9 @@ func (m *BitmapIndex) PartitionInfo(ctx context.Context,
if req.Index != "" && p.Index != req.Index {
return nil
}
if p.TQType == "" {
return nil
}
bsi := p.Shard.(*BSIBitmap)
r := &pb.PartitionInfoResult{Time: p.Time.UnixNano(), Index: p.Index, Field: p.Field,
RowIdOrValue: p.RowIDOrBits * -1, ModTime: bsi.ModTime.UnixNano(), TqType: p.TQType}
Expand All @@ -1407,6 +1410,9 @@ func (m *BitmapIndex) PartitionInfo(ctx context.Context,
if req.Index != "" && p.Index != req.Index {
return nil
}
if p.TQType == "" {
return nil
}
bitmap := p.Shard.(*StandardBitmap)
r := &pb.PartitionInfoResult{Time: p.Time.UnixNano(), Index: p.Index, Field: p.Field,
RowIdOrValue: p.RowIDOrBits, ModTime: bitmap.ModTime.UnixNano(), TqType: p.TQType}
Expand Down
46 changes: 33 additions & 13 deletions server/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,26 +475,46 @@ func (m *KVStore) DeleteIndicesWithPrefix(ctx context.Context,
if req.Prefix == "" {
return &empty.Empty{}, fmt.Errorf("Index prefix must be specified")
}

u.Infof("Deleting index files for prefix %v, retain enums = %v", req.Prefix, req.RetainEnums)

// Interate over storeCache and close everything currently open for this prefix
m.storeCacheLock.Lock()
defer m.storeCacheLock.Unlock()
for k, v := range m.storeCache {
if strings.HasPrefix(k, req.Prefix) {
if strings.HasPrefix(k, req.Prefix + sep) {
v.db.Sync()
v.db.Close()
delete(m.storeCache, k)
if req.RetainEnums && strings.HasSuffix(k, "StringEnum") {
u.Infof("Sync and close [%s]", k)
continue
}
if err := os.RemoveAll(m.Node.dataDir + sep + "index" + sep + k); err != nil {
return &empty.Empty{}, fmt.Errorf("DeleteIndicesWithPrefix error [%v]", err)
}
u.Infof("Sync, close, and delete [%s]", k)
u.Infof("Sync and close [%s]", k)
}
}
if !req.RetainEnums {
if err := os.RemoveAll(m.Node.dataDir + sep + "index" + sep + req.Prefix); err != nil {
return &empty.Empty{}, fmt.Errorf("DeleteIndicesWithPrefix error [%v]", err)
m.storeCacheLock.Unlock()

// retrieve list of indices matching the prefix from the filesystem
baseDir := m.Node.dataDir + sep + "index" + sep + req.Prefix
files, err := os.ReadDir(baseDir)
if err != nil {
return &empty.Empty{}, fmt.Errorf("DeleteIndicesWithPrefix: %v", err)
}
for _, file := range files {
if !file.IsDir() {
continue
}
k := baseDir + sep + file.Name()
if !req.RetainEnums {
if err := os.RemoveAll(baseDir); err != nil {
return &empty.Empty{}, fmt.Errorf("DeleteIndicesWithPrefix retain is false: error [%v]", err)
} else {
u.Infof("Deleted [%s]", k)
}
} else {
if !strings.HasSuffix(k, "StringEnum") {
if err := os.RemoveAll(k); err != nil {
return &empty.Empty{}, fmt.Errorf("DeleteIndicesWithPrefix retain is true:error [%v]", err)
} else {
u.Infof("Deleted [%s]", k)
}
}
}
}
return &empty.Empty{}, nil
Expand Down
2 changes: 1 addition & 1 deletion test-integration/sqlrunner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestMutate(t *testing.T) {
// ensure we have a cluster on localhost, start one if necessary
state := test.Ensure_cluster(3)

fmt.Println("TestBasic")
fmt.Println("TestMutate")
currentDir, err := os.Getwd()
check(err)
err = os.Chdir("../sqlrunner") // these run from the sqlrunner/ directory
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
quanta 0.9.14-rc-2
quanta 0.9.14-rc-3

0 comments on commit afe43be

Please sign in to comment.