Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix Loki arm builds #15936

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/dataobj/internal/dataset/dataset_iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dataset

import (
"context"
"math"

"github.com/grafana/loki/v3/pkg/dataobj/internal/result"
)
Expand All @@ -26,7 +25,7 @@ func Iter(ctx context.Context, columns []Column) result.Seq[Row] {
// more efficient implementation is needed for reading Datasets backed by
// object storage.

totalRows := math.MinInt64
var totalRows int
for _, col := range columns {
totalRows = max(totalRows, col.ColumnInfo().RowsCount)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/dataobj/internal/dataset/value_encoding_bitmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ type bitpackBuffer struct {

width int

sets int // Number of encoded sets. Each set has 8 elements.
sets uint64 // Number of encoded sets. Each set has 8 elements.
data []byte // Total amount of data.
}

Expand Down Expand Up @@ -409,7 +409,7 @@ func (b *bitpackBuffer) Flush(w streamio.Writer) error {
//
// To encode the width in 6 bits, we encode width-1. That reserves the bottom
// 7 bits for metadata, and the remaining 57 bits for the number of sets.
const maxSets = 1<<57 - 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be explicitly typed as const maxSets uint64 so we wouldn't have to decrease the value on 32 bit ARM?

(I'm fine with the other change to remove math.MinInt64)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You compare the value later with a variable s.sets of type int. We could change that field to uint64 if you want

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha sorry, I was reviewing this from my phone 🤦 At my desk now; I think your change is fine, we'll see if anything breaks.

Can you update the doc comment on the bitpackBuffer struct? Right now it still says the max value for bit_packed_sets is 2^57-1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the field sets to type uint64, which seems to be the more appropriate option.

const maxSets uint64 = 1<<57 - 1

// Validate constraints for safety.
switch {
Expand All @@ -423,7 +423,7 @@ func (b *bitpackBuffer) Flush(w streamio.Writer) error {

// Width can be between 1 and 64. To pack it into 6 bits, we subtract 1 from
// the value.
header := (uint64(b.sets) << 7) | (uint64(b.width-1) << 1) | 1
header := (b.sets << 7) | (uint64(b.width-1) << 1) | 1
if err := streamio.WriteUvarint(w, header); err != nil {
return err
}
Expand Down
Loading