Skip to content

Commit a3c0e47

Browse files
committed
Added missing newline symbol when writing to CRDT log. Removed or clarified some log printings.
1 parent a176bda commit a3c0e47

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

comm/receiver.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,13 @@ func (recv *Receiver) StoreIncMsgs(conn net.Conn) {
376376
log.Fatalf("[comm.StoreIncMsgs] Writing to CRDT log file failed with: %s\n", err.Error())
377377
}
378378

379+
// Append a newline symbol to just written line.
380+
newline := []byte("\n")
381+
_, err = recv.writeLog.Write(newline)
382+
if err != nil {
383+
log.Fatalf("[comm.StoreIncMsgs] Appending a newline symbol to CRDT log file failed with: %s\n", err.Error())
384+
}
385+
379386
// Save to stable storage.
380387
err = recv.writeLog.Sync()
381388
if err != nil {

comm/sender.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,13 @@ func (sender *Sender) SendMsgs() {
287287
// Connect to node.
288288
conn, err := ReliableConnect(nodeAddr, sender.tlsConfig, sender.intlConnRetry)
289289
if err != nil {
290-
log.Fatalf("[comm.SendMsgs] Failed to connect to %s: %s\n", err.Error())
290+
log.Fatalf("[comm.SendMsgs] Failed to connect to '%s': %s\n", nodeAddr, err.Error())
291291
}
292292

293293
// Send payload reliably to other nodes.
294294
err = ReliableSend(conn, marshalledMsg, nodeAddr, sender.tlsConfig, sender.intlConnTimeout, sender.intlConnRetry)
295295
if err != nil {
296-
log.Fatalf("[comm.SendMsgs] Failed to send: %s\n", err.Error())
296+
log.Fatalf("[comm.SendMsgs] Failed to send to '%s': %s\n", nodeAddr, err.Error())
297297
}
298298
}
299299

imap/distributor-commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func (distr *Distributor) Proxy(c *Connection, rawReq string) bool {
217217
// Pass message to worker node.
218218
err := c.InternalSend(false, rawReq)
219219
if err != nil {
220-
fmt.Printf("HERE HERE HERE: '%s'\n", err.Error())
220+
c.Error("Could not proxy request to worker", err)
221221
return false
222222
}
223223

@@ -227,7 +227,7 @@ func (distr *Distributor) Proxy(c *Connection, rawReq string) bool {
227227
// Receive incoming worker response.
228228
curResp, err := c.InternalReceive(false)
229229
if err != nil {
230-
c.Error("123: Encountered receive error from worker", err)
230+
c.Error("Failed to receive worker's response to proxied command", err)
231231
return false
232232
}
233233

imap/worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ func (failWorker *FailoverWorker) HandleFailover(conn net.Conn) {
524524
// Pass message to storage node.
525525
err := c.InternalSend(false, rawReq)
526526
if err != nil {
527-
fmt.Printf("HERE 2 HERE 2 HERE 2: '%s'\n", err.Error())
527+
c.Error("Could not proxy request to storage", err)
528528
return
529529
}
530530

@@ -534,7 +534,7 @@ func (failWorker *FailoverWorker) HandleFailover(conn net.Conn) {
534534
// Receive incoming storage response.
535535
curResp, err := c.InternalReceive(false)
536536
if err != nil {
537-
c.Error("Encountered receive error from storage", err)
537+
c.Error("Failed to receive storage's response to proxied command", err)
538538
return
539539
}
540540

0 commit comments

Comments
 (0)