From 8824dddc3abc9c68bab4d5fcd0a592ab4bfa5817 Mon Sep 17 00:00:00 2001 From: Samir Patel Date: Thu, 27 May 2021 19:51:52 -0500 Subject: [PATCH] add debug statements --- api.go | 7 +++++++ txfactory.go | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/api.go b/api.go index 6c3bd37a0..4c2eda116 100644 --- a/api.go +++ b/api.go @@ -1021,9 +1021,11 @@ func (api *API) calculateUsage() { } fmt.Printf("Calculate - Index Details: %+v\n", indexDetails) totalSize := nodeMetadataBytes + fmt.Printf("totalSize: %+v\n", totalSize) for _, s := range indexDetails { totalSize += s.Total } + fmt.Println("3") // NOTE: these errors are ignored in api.Info(), but checked here si := api.server.systemInfo @@ -1031,15 +1033,18 @@ func (api *API) calculateUsage() { if err != nil { api.server.logger.Infof("couldn't read disk capacity: %s", err) } + fmt.Println("4") memoryCapacity, err := si.MemTotal() if err != nil { api.server.logger.Infof("couldn't read memory capacity: %s", err) } + fmt.Println("5") memoryUse, err := si.MemUsed() if err != nil { api.server.logger.Infof("couldn't read memory usage: %s", err) } + fmt.Println("6") // Insert into result. nodeUsage := NodeUsage{ @@ -1054,9 +1059,11 @@ func (api *API) calculateUsage() { }, LastUpdated: time.Now(), } + fmt.Println("7") // api.usageCache.muRead.Lock() // defer api.usageCache.muRead.Unlock() api.usageCache.data = make(map[string]NodeUsage) + fmt.Printf("Calculate - Node Usage: %+v\n", nodeUsage) api.usageCache.data[api.server.nodeID] = nodeUsage fmt.Printf("Calculate - NU from Map: %+v\n", api.usageCache.data[api.server.nodeID]) diff --git a/txfactory.go b/txfactory.go index 1a85f05c7..e4f590b97 100644 --- a/txfactory.go +++ b/txfactory.go @@ -574,17 +574,20 @@ func (f *TxFactory) DumpAll() { // by index, field, fragments and keys. func (f *TxFactory) IndexUsageDetails() (map[string]IndexUsage, uint64, error) { indexUsage := make(map[string]IndexUsage) + fmt.Printf("f.holder: %+v\n", f.holder) holderPath, err := expandDirName(f.holder.path) + fmt.Printf("holderPath: %+v\n", holderPath) if err != nil { return indexUsage, 0, errors.Wrap(err, "expanding data directory") } indexesPath, err := expandDirName(f.holder.IndexesPath()) + fmt.Printf("indexesPath: %+v\n", indexesPath) if err != nil { return indexUsage, 0, errors.Wrap(err, "expanding indexes directory") } idxs := f.holder.Indexes() - fmt.Printf("IndexUsageDetails: %+v\n", idxs) + fmt.Printf("IndexUsageDetails - indexes: %+v\n", idxs) qcx := f.NewQcx() defer qcx.Abort()