Merge pull request #366 from prometheus/32bit

Fixes for 32bit archs
This commit is contained in:
Fabian Reinartz 2018-08-07 06:25:08 -05:00 committed by GitHub
commit 06f01d45ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -80,7 +80,7 @@ func (s *Segment) Dir() string {
// CorruptionErr is an error that's returned when corruption is encountered. // CorruptionErr is an error that's returned when corruption is encountered.
type CorruptionErr struct { type CorruptionErr struct {
Segment int Segment int
Offset int Offset int64
Err error Err error
} }
@ -590,7 +590,7 @@ func listSegments(dir string) (refs []segmentRef, err error) {
// NewSegmentsReader returns a new reader over all segments in the directory. // NewSegmentsReader returns a new reader over all segments in the directory.
func NewSegmentsReader(dir string) (io.ReadCloser, error) { func NewSegmentsReader(dir string) (io.ReadCloser, error) {
return NewSegmentsRangeReader(dir, 0, math.MaxInt64) return NewSegmentsRangeReader(dir, 0, math.MaxInt32)
} }
// NewSegmentsRangeReader returns a new reader over the given WAL segment range. // NewSegmentsRangeReader returns a new reader over the given WAL segment range.
@ -674,7 +674,7 @@ type Reader struct {
err error err error
rec []byte rec []byte
buf [pageSize]byte buf [pageSize]byte
total int // total bytes processed. total int64 // total bytes processed.
} }
// NewReader returns a new reader. // NewReader returns a new reader.
@ -722,7 +722,7 @@ func (r *Reader) next() (err error) {
if err != nil { if err != nil {
return errors.Wrap(err, "read remaining zeros") return errors.Wrap(err, "read remaining zeros")
} }
r.total += n r.total += int64(n)
for _, c := range buf[:k] { for _, c := range buf[:k] {
if c != 0 { if c != 0 {
@ -735,7 +735,7 @@ func (r *Reader) next() (err error) {
if err != nil { if err != nil {
return errors.Wrap(err, "read remaining header") return errors.Wrap(err, "read remaining header")
} }
r.total += n r.total += int64(n)
var ( var (
length = binary.BigEndian.Uint16(hdr[1:]) length = binary.BigEndian.Uint16(hdr[1:])
@ -749,7 +749,7 @@ func (r *Reader) next() (err error) {
if err != nil { if err != nil {
return err return err
} }
r.total += n r.total += int64(n)
if n != int(length) { if n != int(length) {
return errors.Errorf("invalid size: expected %d, got %d", length, n) return errors.Errorf("invalid size: expected %d, got %d", length, n)
@ -798,7 +798,7 @@ func (r *Reader) Err() error {
return &CorruptionErr{ return &CorruptionErr{
Err: r.err, Err: r.err,
Segment: b.segs[b.cur].Index(), Segment: b.segs[b.cur].Index(),
Offset: b.off, Offset: int64(b.off),
} }
} }
return &CorruptionErr{ return &CorruptionErr{