Skip to content

Commit 6a9245f

Browse files
committed
refactor: increase verbosity level of some log messages
1 parent fb44ec8 commit 6a9245f

File tree

14 files changed

+21
-35
lines changed

14 files changed

+21
-35
lines changed

cluster_client.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ func (dm *ClusterDMap) Incr(ctx context.Context, key string, delta int) (int, er
224224
if err != nil {
225225
return 0, processProtocolError(err)
226226
}
227-
// TODO: Consider returning uint64 as response
228227
res, err := cmd.Uint64()
229228
if err != nil {
230229
return 0, processProtocolError(cmd.Err())
@@ -245,7 +244,6 @@ func (dm *ClusterDMap) Decr(ctx context.Context, key string, delta int) (int, er
245244
if err != nil {
246245
return 0, processProtocolError(err)
247246
}
248-
// TODO: Consider returning uint64 as response
249247
res, err := cmd.Uint64()
250248
if err != nil {
251249
return 0, processProtocolError(cmd.Err())
@@ -343,7 +341,6 @@ func (dm *ClusterDMap) Lock(ctx context.Context, key string, deadline time.Durat
343341
return nil, err
344342
}
345343

346-
// TODO: Inconsistency: TIMEOUT, duration or second?
347344
cmd := protocol.NewLock(dm.name, key, deadline.Seconds()).Command(ctx)
348345
err = rc.Process(ctx, cmd)
349346
if err != nil {
@@ -362,9 +359,8 @@ func (dm *ClusterDMap) Lock(ctx context.Context, key string, deadline time.Durat
362359
}
363360

364361
// LockWithTimeout sets a lock for the given key. If the lock is still unreleased
365-
// the end of given period of time,
366-
// it automatically releases the lock. Acquired lock is only for the key in
367-
// this dmap.
362+
// the end of given period of time, it automatically releases the lock.
363+
// Acquired lock is only for the key in this DMap.
368364
//
369365
// It returns immediately if it acquires the lock for the given key. Otherwise,
370366
// it waits until deadline.
@@ -377,7 +373,6 @@ func (dm *ClusterDMap) LockWithTimeout(ctx context.Context, key string, timeout,
377373
return nil, err
378374
}
379375

380-
// TODO: Inconsistency: TIMEOUT, duration or second?
381376
cmd := protocol.NewLock(dm.name, key, deadline.Seconds()).SetPX(timeout.Milliseconds()).Command(ctx)
382377
err = rc.Process(ctx, cmd)
383378
if err != nil {
@@ -414,7 +409,6 @@ func (c *ClusterLockContext) Lease(ctx context.Context, duration time.Duration)
414409
if err != nil {
415410
return err
416411
}
417-
// TODO: Inconsistency!
418412
cmd := protocol.NewLockLease(c.dm.name, c.key, c.token, duration.Seconds()).Command(ctx)
419413
err = rc.Process(ctx, cmd)
420414
if err != nil {

cmd/olricd/olricd-local.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ logging:
154154
# * 6 - Trace level verbosity
155155
# * Context to understand the steps leading up to neterrors and warnings
156156
# * More information for troubleshooting reported issues
157-
verbosity: 6
157+
verbosity: 3
158158

159159
# Default LogLevel is DEBUG. Available levels: "DEBUG", "WARN", "ERROR", "INFO"
160-
level: DEBUG
160+
level: INFO
161161
output: stderr
162162

163163
memberlist:

docker/olricd-consul.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ logging:
151151
# * 6 - Trace level verbosity
152152
# * Context to understand the steps leading up to neterrors and warnings
153153
# * More information for troubleshooting reported issues
154-
verbosity: 6
154+
verbosity: 3
155155

156156
# Default LogLevel is DEBUG. Available levels: "DEBUG", "WARN", "ERROR", "INFO"
157-
level: DEBUG
157+
level: INFO
158158
output: stderr
159159

160160
memberlist:

internal/cluster/routingtable/distribute.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ func (r *RoutingTable) distributePrimaryCopies(partID uint64) []discovery.Member
4444
r.log.V(6).Printf("[DEBUG] Failed to find %s in the cluster: %v", owner, err)
4545
owners = append(owners[:i], owners[i+1:]...)
4646
i--
47-
r.log.V(6).Printf("[INFO] Member: %s has been deleted from the primary owners list of PartID: %v", owner.String(), partID)
47+
r.log.V(3).Printf("[INFO] Member: %s has been deleted from the primary owners list of PartID: %v", owner.String(), partID)
4848
continue
4949
}
5050
if !owner.CompareByID(current) {
51-
r.log.V(4).Printf("[WARN] One of the partitions owners is probably re-joined: %s", current)
51+
r.log.V(3).Printf("[WARN] One of the partitions owners is probably re-joined: %s", current)
5252
owners = append(owners[:i], owners[i+1:]...)
5353
i--
5454
continue
@@ -61,17 +61,16 @@ func (r *RoutingTable) distributePrimaryCopies(partID uint64) []discovery.Member
6161
cmd := protocol.NewLengthOfPart(partID).Command(r.ctx)
6262
rc := r.client.Get(owner.String())
6363
err := rc.Process(r.ctx, cmd)
64-
// TODO: improve logging
6564
if err != nil {
66-
r.log.V(3).Printf("[ERROR] Failed to check key count on backup "+
65+
r.log.V(6).Printf("[DEBUG] Failed to check key count on backup "+
6766
"partition: %d: %v", partID, err)
6867
// Pass it. If the node is down, memberlist package will send a leave event.
6968
continue
7069
}
7170

7271
count, err := cmd.Result()
7372
if err != nil {
74-
r.log.V(3).Printf("[ERROR] Failed to check key count on backup "+
73+
r.log.V(6).Printf("[DEBUG] Failed to check key count on backup "+
7574
"partition: %d: %v", partID, err)
7675
// Pass it. If the node is down, memberlist package will send a leave event.
7776
continue
@@ -170,16 +169,15 @@ func (r *RoutingTable) distributeBackups(partID uint64) []discovery.Member {
170169
cmd := protocol.NewLengthOfPart(partID).SetReplica().Command(r.ctx)
171170
rc := r.client.Get(backup.String())
172171
err := rc.Process(r.ctx, cmd)
173-
// TODO: improve logging
174172
if err != nil {
175-
r.log.V(3).Printf("[ERROR] Failed to check key count on backup "+
173+
r.log.V(6).Printf("[DEBUG] Failed to check key count on backup "+
176174
"partition: %d: %v", partID, err)
177175
// Pass it. If the node is down, memberlist package will send a leave event.
178176
continue
179177
}
180178
count, err := cmd.Result()
181179
if err != nil {
182-
r.log.V(3).Printf("[ERROR] Failed to check key count on backup "+
180+
r.log.V(6).Printf("[DEBUG] Failed to check key count on backup "+
183181
"partition: %d: %v", partID, err)
184182
// Pass it. If the node is down, memberlist package will send a leave event.
185183
continue

internal/dmap/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (c *dmapConfig) load(dc *config.DMaps, name string) error {
7373
}
7474
}
7575

76-
// TODO: Create a new function to verify config config.
76+
//TODO: Create a new function to verify config.
7777
if c.evictionPolicy == config.LRUEviction {
7878
if c.maxInuse <= 0 && c.maxKeys <= 0 {
7979
return fmt.Errorf("maxInuse or maxKeys have to be greater than zero")

internal/dmap/delete.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ func (dm *DMap) deleteBackupOnCluster(hkey uint64, key string) error {
8282
dm.s.log.V(3).Printf("[ERROR] Failed to delete replica key/value on %s: %s", dm.name, err)
8383
return protocol.ConvertError(err)
8484
}
85-
// TODO: Improve logging
8685
return protocol.ConvertError(cmd.Err())
8786
})
8887
}

internal/dmap/destroy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ func (dm *DMap) destroyOnCluster(ctx context.Context) error {
5252
}
5353
defer sem.Release(1)
5454

55-
// TODO: Improve logging
56-
dm.s.log.V(6).Printf("[DEBUG] Calling Destroy command on %s for %s", addr, dm.name)
55+
dm.s.log.V(6).Printf("[DEBUG] Calling DM.DESTROY command on %s for %s", addr, dm.name)
5756
cmd := protocol.NewDestroy(dm.name).SetLocal().Command(dm.s.ctx)
5857
rc := dm.s.client.Get(addr)
5958
err := rc.Process(ctx, cmd)
6059
if err != nil {
60+
dm.s.log.V(3).Printf("[ERROR] DM.DESTROY returned an error: %v", err)
6161
return err
6262
}
6363
return cmd.Err()

internal/dmap/eviction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (dm *DMap) isKeyIdleOnFragment(hkey uint64, f *fragment) bool {
4444
if errors.Is(err, storage.ErrKeyNotFound) {
4545
return false
4646
}
47-
// TODO: Handle other errors.
47+
//TODO: Handle other errors.
4848
ttl := (dm.config.maxIdleDuration.Nanoseconds() + lastAccess) / 1000000
4949
return isKeyExpired(ttl)
5050
}

internal/dmap/get.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (dm *DMap) lookupOnReplicas(hkey uint64, key string) []*version {
205205
err = protocol.ConvertError(err)
206206
if err != nil {
207207
if dm.s.log.V(6).Ok() {
208-
dm.s.log.V(6).Printf("[ERROR] Failed to call get on"+
208+
dm.s.log.V(6).Printf("[DEBUG] Failed to call get on"+
209209
" a replica owner: %s: %v", host, err)
210210
}
211211
continue
@@ -214,9 +214,8 @@ func (dm *DMap) lookupOnReplicas(hkey uint64, key string) []*version {
214214
value, err := cmd.Bytes()
215215
err = protocol.ConvertError(err)
216216
if err != nil {
217-
// TODO: Improve logging
218217
if dm.s.log.V(6).Ok() {
219-
dm.s.log.V(6).Printf("[ERROR] Failed to call get on"+
218+
dm.s.log.V(6).Printf("[DEBUG] Failed to call get on"+
220219
" a replica owner: %s: %v", host, err)
221220
}
222221
}

internal/dmap/get_handlers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ func (s *Service) getEntryCommandHandler(conn redcon.Conn, cmd redcon.Command) {
6868
e.hkey = partitions.HKey(getEntryCmd.DMap, getEntryCmd.Key)
6969
e.kind = kind
7070
nt, err := dm.getOnFragment(e)
71-
// TODO: errFragmentNotFound??
7271
if err == errFragmentNotFound {
7372
err = ErrKeyNotFound
7473
}

0 commit comments

Comments
 (0)