Skip to content

Commit 728519c

Browse files
committed
Clean up log messages, gossip state transfer
Removing all decorating symbols from logging printouts. Change-Id: I5d0aac68544df8918cbaacfd78ab3947b562a5ab Signed-off-by: Artem Barger <[email protected]>
1 parent 4e051ed commit 728519c

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

gossip/state/state.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
// capable to full fill missing blocks by running state replication and
3939
// sending request to get missing block to other nodes
4040
type GossipStateProvider interface {
41-
4241
// Retrieve block with sequence number equal to index
4342
GetBlock(index uint64) *common.Block
4443

@@ -174,7 +173,7 @@ func (s *GossipStateProviderImpl) listen() {
174173
break next
175174
}
176175
}
177-
s.logger.Debug("[XXX]: Stop listening for new messages")
176+
s.logger.Debug("Stop listening for new messages")
178177
s.done.Done()
179178
}
180179

@@ -288,7 +287,7 @@ func (s *GossipStateProviderImpl) deliverPayloads() {
288287
for payload := s.payloads.Pop(); payload != nil; payload = s.payloads.Pop() {
289288
rawblock := &common.Block{}
290289
if err := pb.Unmarshal(payload.Data, rawblock); err != nil {
291-
s.logger.Errorf("Error getting block with seqNum = %d due to (%s)...dropping block\n", payload.SeqNum, err)
290+
s.logger.Errorf("Error getting block with seqNum = %d due to (%s)...dropping block", payload.SeqNum, err)
292291
continue
293292
}
294293
s.logger.Debug("New block with sequence number ", payload.SeqNum, " transactions num ", len(rawblock.Data.Data))
@@ -331,6 +330,7 @@ func (s *GossipStateProviderImpl) antiEntropy() {
331330

332331
s.requestBlocksInRange(uint64(current), uint64(max))
333332
}
333+
s.logger.Debug("Stateprovider stopped, stopping anti entropy procedure.")
334334
s.done.Done()
335335
}
336336

@@ -367,7 +367,7 @@ func (s *GossipStateProviderImpl) requestBlocksInRange(start uint64, end uint64)
367367
request.SeqNums = append(request.SeqNums, uint64(i))
368368
}
369369

370-
s.logger.Debug("[$$$$$$$$$$$$$$$$]: Sending direct request to complete missing blocks, ", request, "for chain", s.chainID)
370+
s.logger.Debug("Sending direct request to complete missing blocks,", request, "for chain", s.chainID)
371371
s.gossip.Send(&proto.GossipMessage{
372372
Nonce: 0,
373373
Tag: proto.GossipMessage_CHAN_OR_ORG,
@@ -395,7 +395,7 @@ func (s *GossipStateProviderImpl) AddPayload(payload *proto.Payload) error {
395395

396396
func (s *GossipStateProviderImpl) commitBlock(block *common.Block, seqNum uint64) error {
397397
if err := s.committer.Commit(block); err != nil {
398-
s.logger.Errorf("Got error while committing(%s)\n", err)
398+
s.logger.Errorf("Got error while committing(%s)", err)
399399
return err
400400
}
401401

@@ -409,6 +409,6 @@ func (s *GossipStateProviderImpl) commitBlock(block *common.Block, seqNum uint64
409409
s.logger.Errorf("Unable to serialize node meta state, error = %s", err)
410410
}
411411

412-
s.logger.Debug("[XXX]: Commit success, created a block!")
412+
s.logger.Debug("Commit success, created a block!")
413413
return nil
414414
}

gossip/state/state_test.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -324,25 +324,24 @@ func TestNewGossipStateProvider_SendingManyMessages(t *testing.T) {
324324
waitUntilTrueOrTimeout(t, func() bool {
325325
for _, p := range peersSet {
326326
if len(p.g.PeersOfChannel(common.ChainID(util.GetTestChainID()))) != bootstrapSetSize+standartPeersSize-1 {
327-
logger.Debug("[XXXXXXX]: Peer discovery has not finished yet")
327+
logger.Debug("Peer discovery has not finished yet")
328328
return false
329329
}
330330
}
331-
logger.Debug("[AAAAAA]: All peer discovered each other!!!")
331+
logger.Debug("All peer discovered each other!!!")
332332
return true
333333
}, 30*time.Second)
334334

335-
logger.Debug("[!!!!!]: Waiting for all blocks to arrive.")
335+
logger.Debug("Waiting for all blocks to arrive.")
336336
waitUntilTrueOrTimeout(t, func() bool {
337-
logger.Debug("[*****]: Trying to see all peers get all blocks")
337+
logger.Debug("Trying to see all peers get all blocks")
338338
for _, p := range peersSet {
339339
height, err := p.commit.LedgerHeight()
340340
if height != uint64(msgCount+1) || err != nil {
341-
//logger.Debug("[XXXXXXX]: Ledger height is at: ", height)
342341
return false
343342
}
344343
}
345-
logger.Debug("[#####]: All peers have same ledger height!!!")
344+
logger.Debug("All peers have same ledger height!!!")
346345
return true
347346
}, 60*time.Second)
348347
}
@@ -401,7 +400,7 @@ func TestGossipStateProvider_TestStateMessages(t *testing.T) {
401400
select {
402401
case <-readyCh:
403402
{
404-
logger.Info("[XXX]: Done!!!")
403+
logger.Info("Done!!!")
405404

406405
}
407406
case <-time.After(time.Duration(10) * time.Second):
@@ -414,12 +413,12 @@ func TestGossipStateProvider_TestStateMessages(t *testing.T) {
414413
func waitUntilTrueOrTimeout(t *testing.T, predicate func() bool, timeout time.Duration) {
415414
ch := make(chan struct{})
416415
go func() {
417-
logger.Debug("[@@@@@]: Started to spin off, until predicate will be satisfied.")
416+
logger.Debug("Started to spin off, until predicate will be satisfied.")
418417
for !predicate() {
419418
time.Sleep(1 * time.Second)
420419
}
421420
ch <- struct{}{}
422-
logger.Debug("[@@@@@]: Done.")
421+
logger.Debug("Done.")
423422
}()
424423

425424
select {
@@ -429,5 +428,5 @@ func waitUntilTrueOrTimeout(t *testing.T, predicate func() bool, timeout time.Du
429428
t.Fatal("Timeout has expired")
430429
break
431430
}
432-
logger.Debug("[>>>>>] Stop wainting until timeout or true")
431+
logger.Debug("Stop waiting until timeout or true")
433432
}

0 commit comments

Comments
 (0)