add debug statements

This commit is contained in:
Samir Patel 2021-05-27 19:51:52 -05:00 committed by Samir Patel
parent a0ba9327f7
commit 8824dddc3a
2 changed files with 11 additions and 1 deletions

7
api.go
View file

@ -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])

View file

@ -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()