Skip to content

Commit

Permalink
offline partitions not handling boolean bitmaps correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
gamolina committed Aug 29, 2024
1 parent 47b1bee commit 41bb318
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
8 changes: 8 additions & 0 deletions server/bitmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,14 @@ func (m *BitmapIndex) OfflinePartitions(ctx context.Context, req *pb.PartitionIn
return nil, fmt.Errorf("Time must be specified.")
}

ts := time.Unix(0, req.Time)

if req.Index != "" {
u.Info("Offline partition request for %v, table = %s", ts.Format(timeFmt), req.Index)
} else {
u.Info("Offline partition request for %v, all partitioned tables", ts.Format(timeFmt))
}

// Iterate over shard cache insert into partition operation queue
m.iterateBSICache(func(p *Partition) error {

Expand Down
18 changes: 9 additions & 9 deletions server/bitmapio.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,17 @@ func (po *PartitionOperation) perform(path string, info os.FileInfo, err error)
}

if info.IsDir() {
//u.Warn("Partition operation not allowed against directory [%v]", path)
return nil
}
if po.RemoveOnly {
u.Infof("Partition remove only for [%v]", path)
return os.Remove(path)
}
dest := po.newPath + sep + info.Name()
err2 := os.Rename(path, dest)
if err2 == nil {
u.Infof("Partition rename move [%v] to [%v]", path, dest)
return nil
}
if !strings.HasSuffix(err2.Error(), "invalid cross-device link") {
Expand All @@ -182,6 +185,7 @@ func (po *PartitionOperation) perform(path string, info os.FileInfo, err error)
if err4 != nil {
return err4
}
u.Infof("Partition copy move [%v] to [%v]", path, dest)
return os.Remove(path)
}

Expand Down Expand Up @@ -472,27 +476,23 @@ func (m *BitmapIndex) readBitmapFiles(fragQueue chan *BitmapFragment) error {
func (m *BitmapIndex) purgePartition(aop *Partition) {

t := aop.Time.UnixNano()
// atw - TODO - understand
// The condition is wrong for bools.
// Since the keys are unique we can just delete the key.
// from both caches.
//if aop.RowIDOrBits > 0
{
// phoneType, city, isActive, rownum, isLegalAge
if aop.RowIDOrBits >= 0 {
rowID := uint64(aop.RowIDOrBits)
m.bitmapCacheLock.Lock()
defer m.bitmapCacheLock.Unlock()
_, ok := m.bitmapCache[aop.Index][aop.Field][rowID][t]
if ok {
delete(m.bitmapCache[aop.Index][aop.Field][rowID], t)
u.Infof("Purged standard bitmap %s.%s, ts = %v, rowID = %d", aop.Index, aop.Field,
aop.Time.Format(timeFmt), rowID)
}
} // else
{ // numFamilyMembers, first_name, address, hashedCurtid. age, height, last_name
} else {
m.bsiCacheLock.Lock()
defer m.bsiCacheLock.Unlock()
_, ok := m.bsiCache[aop.Index][aop.Field][t]
if ok {
delete(m.bsiCache[aop.Index][aop.Field], t)
u.Infof("Purged BSI %s.%s, ts = %v", aop.Index, aop.Field, aop.Time.Format(timeFmt))
}
}
}
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-4
quanta 0.9.14-rc-5

0 comments on commit 41bb318

Please sign in to comment.