From e00cfdbd302330082912b9b2d2074a847330c57b Mon Sep 17 00:00:00 2001 From: Valentin Kuznetsov Date: Fri, 18 Mar 2022 10:59:17 -0400 Subject: [PATCH] Improve error messages --- dbs/bulkblocks2.go | 4 ++-- dbs/fileparents.go | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dbs/bulkblocks2.go b/dbs/bulkblocks2.go index 380a3c29..d2956818 100644 --- a/dbs/bulkblocks2.go +++ b/dbs/bulkblocks2.go @@ -673,8 +673,8 @@ func insertFilesViaChunks(tx *sql.Tx, records []File, trec *TempFileRecord) erro } if utils.VERBOSE > 0 { log.Printf( - "insertFilesViaChunks processed %d goroutines, elapsed time %v", - ngoroutines, time.Since(t0)) + "insertFilesViaChunks processed %d goroutines with ids %v, elapsed time %v", + ngoroutines, ids, time.Since(t0)) } wg.Wait() if trec.NErrors != 0 { diff --git a/dbs/fileparents.go b/dbs/fileparents.go index 77250fa0..d580cd73 100644 --- a/dbs/fileparents.go +++ b/dbs/fileparents.go @@ -408,20 +408,23 @@ func (a *API) InsertFileParentsTxt(tx *sql.Tx) error { log.Printf("Insert FileParents record %+v", rec) } lfn := rec.LogicalFileName + pfn := rec.ParentLogicalFileName // get file id for given lfn fid, err := GetID(tx, "FILES", "file_id", "logical_file_name", lfn) if err != nil { + msg := fmt.Sprintf("unable to find logical_file_name file_id for %v", lfn) if utils.VERBOSE > 1 { - log.Println("unable to find logical_file_name file_id for", rec) + log.Println(msg) } - return Error(err, GetIDErrorCode, "", "dbs.fileparents.InsertFileParentsTxt") + return Error(err, GetIDErrorCode, msg, "dbs.fileparents.InsertFileParentsTxt") } - pid, err := GetID(tx, "FILES", "file_id", "logical_file_name", rec.ParentLogicalFileName) + pid, err := GetID(tx, "FILES", "file_id", "logical_file_name", pfn) if err != nil { + msg := fmt.Sprintf("unable to find parent_logical_file_name file_id for %s", pfn) if utils.VERBOSE > 1 { - log.Println("unable to find parent_logical_file_name file_id for", rec.ParentLogicalFileName) + log.Println(msg) } - return Error(err, GetIDErrorCode, "", "dbs.fileparents.InsertFileParentsTxt") + return Error(err, GetIDErrorCode, msg, "dbs.fileparents.InsertFileParentsTxt") } var rrr FileParents rrr.THIS_FILE_ID = fid