From 5e7cd0df7fbca609e5105557dbfa9dc01a421e2d Mon Sep 17 00:00:00 2001 From: Tomasz Szarstuk Date: Thu, 17 Mar 2016 12:03:30 +0000 Subject: [PATCH] Fix offest calculation when part of requested data is in memory buffer --- apps/metric_vnode/src/metric_vnode.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/metric_vnode/src/metric_vnode.erl b/apps/metric_vnode/src/metric_vnode.erl index c9f48e8..fe37efa 100644 --- a/apps/metric_vnode/src/metric_vnode.erl +++ b/apps/metric_vnode/src/metric_vnode.erl @@ -241,7 +241,7 @@ handle_command({get, ReqID, Bucket, Metric, {Time, Count}}, Sender, -> PartStart = max(Time, Start), PartCount = min(Time + Count, Start + Size) - PartStart, - SkipBytes = (PartStart - Start), + SkipBytes = (PartStart - Start) * ?DATA_SIZE, Bin = k6_bytea:get(Array, SkipBytes, (PartCount * ?DATA_SIZE)), Offset = PartStart - Time, Part = {Offset, PartCount, Bin},