Skip to content

Commit 1b097ad

Browse files
committed
Refactor variable name in readRepair for clarity
Renamed the loop variable "version" to "value" in the readRepair function for improved code readability and to better reflect its purpose. This change ensures consistency and avoids potential confusion with the "version" struct. No functional changes were made.
1 parent 0818e3b commit 1b097ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/dmap/get.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,13 @@ func (dm *DMap) lookupOnReplicas(hkey uint64, key string) []*version {
230230
}
231231

232232
func (dm *DMap) readRepair(winner *version, versions []*version) {
233-
for _, version := range versions {
234-
if version.entry != nil && winner.entry.Timestamp() == version.entry.Timestamp() {
233+
for _, value := range versions {
234+
if value.entry != nil && winner.entry.Timestamp() == value.entry.Timestamp() {
235235
continue
236236
}
237237

238238
// Sync
239-
tmp := *version.host
239+
tmp := *value.host
240240
if tmp.CompareByID(dm.s.rt.This()) {
241241
hkey := partitions.HKey(dm.name, winner.entry.Key())
242242
part := dm.getPartitionByHKey(hkey, partitions.PRIMARY)
@@ -259,15 +259,15 @@ func (dm *DMap) readRepair(winner *version, versions []*version) {
259259
} else {
260260
// If readRepair is enabled, this function is called by every GET request.
261261
cmd := protocol.NewPutEntry(dm.name, winner.entry.Key(), winner.entry.Encode()).Command(dm.s.ctx)
262-
rc := dm.s.client.Get(version.host.String())
262+
rc := dm.s.client.Get(value.host.String())
263263
err := rc.Process(dm.s.ctx, cmd)
264264
if err != nil {
265-
dm.s.log.V(3).Printf("[ERROR] Failed to synchronize replica %s: %v", version.host, err)
265+
dm.s.log.V(3).Printf("[ERROR] Failed to synchronize replica %s: %v", value.host, err)
266266
continue
267267
}
268268
err = cmd.Err()
269269
if err != nil {
270-
dm.s.log.V(3).Printf("[ERROR] Failed to synchronize replica %s: %v", version.host, err)
270+
dm.s.log.V(3).Printf("[ERROR] Failed to synchronize replica %s: %v", value.host, err)
271271
}
272272
}
273273
}

0 commit comments

Comments
 (0)