wp
This commit is contained in:
@@ -77,6 +77,7 @@ func (s *Metric) OnMeasuresDeleteCommited(rec storage.MeasuresDeleteCommited) {
|
||||
}
|
||||
|
||||
func (s *Metric) AppendMeasures(req AppendMeasuresReq, tmp []byte, storageInbox *inbox.Inbox) {
|
||||
|
||||
if s.capturedState != nil {
|
||||
s.WaitQueue = append(s.WaitQueue, req)
|
||||
}
|
||||
@@ -118,9 +119,9 @@ func (s *Metric) AppendMeasures(req AppendMeasuresReq, tmp []byte, storageInbox
|
||||
}
|
||||
|
||||
tReport := timestamps.Evaluate(tmp[:7], measure.Timestamp)
|
||||
fmt.Printf("tReport: %#v\n", tReport)
|
||||
//fmt.Printf("tReport: %#v\n", tReport)
|
||||
vReport := values.Evaluate(tmp[7:], measure.Value)
|
||||
fmt.Printf("vReport: %#v\n", vReport)
|
||||
//fmt.Printf("vReport: %#v\n", vReport)
|
||||
|
||||
totalRequiredSpace := tReport.TotalSpace + vReport.TotalSpace
|
||||
|
||||
@@ -136,6 +137,7 @@ func (s *Metric) AppendMeasures(req AppendMeasuresReq, tmp []byte, storageInbox
|
||||
valuesRewindOffset = vReport.RewindOffset
|
||||
}
|
||||
} else {
|
||||
fmt.Println("PAGE FILLED")
|
||||
// сторінка заповнена
|
||||
since := s.timestamps.ReplaceSinceWithUntil()
|
||||
|
||||
@@ -161,6 +163,11 @@ func (s *Metric) AppendMeasures(req AppendMeasuresReq, tmp []byte, storageInbox
|
||||
// renew
|
||||
s.buffer = buf
|
||||
|
||||
tReport = timestamps.Evaluate(tmp[:7], measure.Timestamp)
|
||||
//fmt.Printf("tReport: %#v\n", tReport)
|
||||
vReport = values.Evaluate(tmp[7:], measure.Value)
|
||||
//fmt.Printf("vReport: %#v\n", vReport)
|
||||
|
||||
timestamps.Append(tReport.RewindOffset, tmp[:tReport.ChangeSize], measure.Timestamp)
|
||||
values.Append(vReport.RewindOffset, tmp[7:7+vReport.ChangeSize], measure.Value, vReport.Delta)
|
||||
}
|
||||
@@ -181,6 +188,7 @@ func (s *Metric) AppendMeasures(req AppendMeasuresReq, tmp []byte, storageInbox
|
||||
// скопіювати. Причому можна скопіювати зрізи chunks
|
||||
|
||||
if len(pages) > 0 {
|
||||
fmt.Println("push pages")
|
||||
// пишу в storage довгим шляхом через redo файл і запис в data файл
|
||||
storageInbox.Push(storage.MeasuresAppendWithGrow{
|
||||
MetricID: req.MetricID,
|
||||
@@ -198,6 +206,7 @@ func (s *Metric) AppendMeasures(req AppendMeasuresReq, tmp []byte, storageInbox
|
||||
ResultCh: req.ResultCh,
|
||||
})
|
||||
} else {
|
||||
fmt.Println("push simple")
|
||||
// короткий шлях - запис лише в storage
|
||||
storageInbox.Push(storage.MeasuresAppend{
|
||||
MetricID: req.MetricID,
|
||||
@@ -329,27 +338,27 @@ func (s *Metric) StartFullScan(req FullScanReq) {
|
||||
if done {
|
||||
break
|
||||
}
|
||||
fmt.Println("ts:", timestamp)
|
||||
//fmt.Println("ts:", timestamp)
|
||||
value, done := valueDecompressor.NextValue()
|
||||
if done {
|
||||
qb.Abort(qb.HasTimestampNoValueBug, ErrNoValueBug)
|
||||
}
|
||||
fmt.Println("value:", value)
|
||||
//fmt.Println("value:", value)
|
||||
req.ResponseWriter.FeedNoSend(timestamp, value)
|
||||
}
|
||||
|
||||
if s.lastPageNo > 0 {
|
||||
req.ResultCh <- FullScanResult{
|
||||
ResultCode: UntilFound,
|
||||
LastPageNo: s.lastPageNo,
|
||||
FracDigits: s.fracDigits,
|
||||
}
|
||||
s.rLocks++
|
||||
} else {
|
||||
req.ResultCh <- FullScanResult{
|
||||
ResultCode: QueryDone,
|
||||
}
|
||||
// if s.lastPageNo > 0 {
|
||||
// req.ResultCh <- FullScanResult{
|
||||
// ResultCode: UntilFound,
|
||||
// LastPageNo: s.lastPageNo,
|
||||
// FracDigits: s.fracDigits,
|
||||
// }
|
||||
// s.rLocks++
|
||||
// } else {
|
||||
req.ResultCh <- FullScanResult{
|
||||
ResultCode: QueryDone,
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
// індекси
|
||||
|
||||
Reference in New Issue
Block a user