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

Fixed chunkSize addition to TS.INFO ( backwards compatible ) #78

Merged
merged 4 commits into from
Aug 28, 2020
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
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func TestClientInfo(t *testing.T) {
res, err := client.Info(key)
assert.Nil(t, err)
expected := KeyInfo{ChunkCount: 1,
MaxSamplesPerChunk: 256, LastTimestamp: 0, RetentionTime: 3600000,
ChunkSize: 4096, LastTimestamp: 0, RetentionTime: 3600000,
Rules: []Rule{{DestKey: destKey, BucketSizeSec: 100, AggType: AvgAggregation}},
Labels: map[string]string{},
}
Expand Down
3 changes: 2 additions & 1 deletion common.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ type Rule struct {

type KeyInfo struct {
ChunkCount int64
MaxSamplesPerChunk int64
MaxSamplesPerChunk int64 // As of RedisTimeseries >= v1.4 MaxSamplesPerChunk is deprecated in favor of ChunkSize
ChunkSize int64
LastTimestamp int64
RetentionTime int64
Rules []Rule
Expand Down
8 changes: 7 additions & 1 deletion reply_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ func ParseInfo(result interface{}, err error) (info KeyInfo, outErr error) {
info.RetentionTime, outErr = redis.Int64(values[i+1], nil)
case "chunkCount":
info.ChunkCount, outErr = redis.Int64(values[i+1], nil)
// Backwards compatible
case "maxSamplesPerChunk":
info.MaxSamplesPerChunk, outErr = redis.Int64(values[i+1], nil)
var v int64
v, outErr = redis.Int64(values[i+1], nil)
info.MaxSamplesPerChunk = v
info.ChunkSize = 16 * v
case "chunkSize":
info.ChunkSize, outErr = redis.Int64(values[i+1], nil)
case "lastTimestamp":
info.LastTimestamp, outErr = redis.Int64(values[i+1], nil)
case "labels":
Expand Down