aboutsummaryrefslogtreecommitdiff
path: root/weed/util/log_buffer/log_buffer.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-09-26 11:54:13 -0700
committerChris Lu <chris.lu@gmail.com>2021-09-26 11:54:13 -0700
commit9887610b545c38ac3bce580a6bbf96ba63b61308 (patch)
treef24e72901a5143754d635e31e74845a3564af5cb /weed/util/log_buffer/log_buffer.go
parent2baed2e1e995ad331985a7b8c359e732b223ad3a (diff)
downloadseaweedfs-9887610b545c38ac3bce580a6bbf96ba63b61308.tar.xz
seaweedfs-9887610b545c38ac3bce580a6bbf96ba63b61308.zip
log tsNs should be processing time
Diffstat (limited to 'weed/util/log_buffer/log_buffer.go')
-rw-r--r--weed/util/log_buffer/log_buffer.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/weed/util/log_buffer/log_buffer.go b/weed/util/log_buffer/log_buffer.go
index c2158e7eb..a6d94670a 100644
--- a/weed/util/log_buffer/log_buffer.go
+++ b/weed/util/log_buffer/log_buffer.go
@@ -56,7 +56,7 @@ func NewLogBuffer(name string, flushInterval time.Duration, flushFn func(startTi
return lb
}
-func (m *LogBuffer) AddToBuffer(partitionKey, data []byte, eventTsNs int64) {
+func (m *LogBuffer) AddToBuffer(partitionKey, data []byte, processingTsNs int64) {
m.Lock()
defer func() {
@@ -68,20 +68,20 @@ func (m *LogBuffer) AddToBuffer(partitionKey, data []byte, eventTsNs int64) {
// need to put the timestamp inside the lock
var ts time.Time
- if eventTsNs == 0 {
+ if processingTsNs == 0 {
ts = time.Now()
- eventTsNs = ts.UnixNano()
+ processingTsNs = ts.UnixNano()
} else {
- ts = time.Unix(0, eventTsNs)
+ ts = time.Unix(0, processingTsNs)
}
- if m.lastTsNs >= eventTsNs {
+ if m.lastTsNs >= processingTsNs {
// this is unlikely to happen, but just in case
- eventTsNs = m.lastTsNs + 1
- ts = time.Unix(0, eventTsNs)
+ processingTsNs = m.lastTsNs + 1
+ ts = time.Unix(0, processingTsNs)
}
- m.lastTsNs = eventTsNs
+ m.lastTsNs = processingTsNs
logEntry := &filer_pb.LogEntry{
- TsNs: eventTsNs,
+ TsNs: processingTsNs,
PartitionKeyHash: util.HashToInt32(partitionKey),
Data: data,
}