diff --git a/Makefile b/Makefile index bbf9bb7176..ac08b56525 100644 --- a/Makefile +++ b/Makefile @@ -114,9 +114,9 @@ cli: ## Build CLI binary. NOTE: 1) a separate go.mod, 2) static linkage with cgo @echo "Building ais (CLI) => $(BUILD_DEST)/ais [build tags:$(BUILD_TAGS)]" ifdef CROSS_COMPILE_CLI cd $(BUILD_DIR)/cli && \ - $(CROSS_COMPILE_CLI) go build -o ./ais $(BUILD_FLAGS) $(LDFLAGS) *.go && mv ./ais $(BUILD_DEST)/. + $(CROSS_COMPILE_CLI) go build -o ./ais -tags="$(BUILD_TAGS)" $(BUILD_FLAGS) $(LDFLAGS) *.go && mv ./ais $(BUILD_DEST)/. else - @cd $(BUILD_DIR)/cli && $(CGO_DISABLE) go build -o $(BUILD_DEST)/ais $(BUILD_FLAGS) $(LDFLAGS) *.go + @cd $(BUILD_DIR)/cli && $(CGO_DISABLE) go build -o $(BUILD_DEST)/ais -tags="$(BUILD_TAGS)" $(BUILD_FLAGS) $(LDFLAGS) *.go endif @echo "*** To enable autocompletions in your current shell, run:" ifeq ($(AISTORE_PATH),$(PWD)) diff --git a/api/bucket.go b/api/bucket.go index 646eac082d..e013f744b4 100644 --- a/api/bucket.go +++ b/api/bucket.go @@ -90,7 +90,6 @@ func HeadBucket(bp BaseParams, bck cmn.Bck, dontAddRemote bool) (p *cmn.Bprops, func hdr2msg(bck cmn.Bck, status int, err error) error { herr, ok := err.(*cmn.ErrHTTP) if !ok { - debug.FailTypeCast(err) return err } debug.Assert(herr.Status == status) diff --git a/api/client.go b/api/client.go index 85cb2432b0..4d9055039b 100644 --- a/api/client.go +++ b/api/client.go @@ -116,12 +116,15 @@ func (reqParams *ReqParams) DoRequest() error { } // same as above except that it also returns response header -func (reqParams *ReqParams) doReqHdr() (http.Header, int, error) { +func (reqParams *ReqParams) doReqHdr() (_ http.Header, status int, _ error) { resp, err := reqParams.do() - if err != nil { - return nil, resp.StatusCode, err + if err == nil { + return resp.Header, resp.StatusCode, reqParams.cdc(resp) + } + if resp != nil { + status = resp.StatusCode } - return resp.Header, resp.StatusCode, reqParams.cdc(resp) + return nil, status, err } // Makes request via do(), decodes `resp.Body` into the `out` structure, diff --git a/bench/tools/aisloader/run.go b/bench/tools/aisloader/run.go index 2fea75fcd4..5b8cc0216f 100644 --- a/bench/tools/aisloader/run.go +++ b/bench/tools/aisloader/run.go @@ -73,6 +73,9 @@ const ( wo2FreeDelay = 3*time.Second + time.Millisecond ua = "aisloader" + + defaultClusterIP = "localhost" + defaultClusterIPv4 = "127.0.0.1" ) type ( @@ -501,7 +504,7 @@ func addCmdLine(f *flag.FlagSet, p *params) { f.StringVar(&p.bck.Provider, "provider", apc.AIS, "ais - for AIS bucket, \"aws\", \"azure\", \"gcp\", \"hdfs\" for Azure, Amazon, Google, and HDFS clouds respectively") - f.StringVar(&ip, "ip", "localhost", "AIS proxy/gateway IP address or hostname") + f.StringVar(&ip, "ip", defaultClusterIP, "AIS proxy/gateway IP address or hostname") f.StringVar(&port, "port", "8080", "AIS proxy/gateway port") // @@ -676,7 +679,7 @@ func validateCmdLine(p *params) (err error) { if p.randomProxy { return errors.New("command line options '-s3endpoint' and '-randomproxy' are mutually exclusive") } - if ip != "" && ip != "localhost" && ip != "127.0.0.1" { // TODO: hardcoded default + if ip != "" && ip != defaultClusterIP && ip != defaultClusterIPv4 { return errors.New("command line options '-s3endpoint' and '-ip' are mutually exclusive") } if port != "" && port != "8080" { // TODO: ditto @@ -858,7 +861,7 @@ func validateCmdLine(p *params) (err error) { // see also: tlsArgs envEndpoint = os.Getenv(env.AIS.Endpoint) if envEndpoint != "" { - if ip != "" { + if ip != "" && ip != defaultClusterIP && ip != defaultClusterIPv4 { return fmt.Errorf("'%s=%s' environment and '--ip=%s' command-line are mutually exclusive", env.AIS.Endpoint, envEndpoint, ip) } diff --git a/cmd/cli/cli/object.go b/cmd/cli/cli/object.go index 0f0dc5f629..716990fb40 100644 --- a/cmd/cli/cli/object.go +++ b/cmd/cli/cli/object.go @@ -356,8 +356,10 @@ func propVal(op *cmn.ObjectProps, name string) (v string) { } case apc.GetPropsLocation: v = op.Location + case apc.GetPropsStatus: + // no "object status" in `cmn.ObjectProps` - nothing to do (see also: `cmn.LsoEntry`) default: - debug.Assert(false, name) + debug.Assert(false, "obj prop name: \""+name+"\"") } return } diff --git a/cmd/cli/cli/utils.go b/cmd/cli/cli/utils.go index c39c95ebfa..0941c3a6c3 100644 --- a/cmd/cli/cli/utils.go +++ b/cmd/cli/cli/utils.go @@ -458,7 +458,10 @@ func headBucket(bck cmn.Bck, dontAddBckMD bool) (p *cmn.Bprops, err error) { err = fmt.Errorf("failed to HEAD bucket %q: %s", bck, herr.Message) } } else { - err = fmt.Errorf("failed to HEAD bucket %q: %v", bck, err) + msg := strings.ToLower(err.Error()) + if !strings.HasPrefix(msg, "head \"http") && !strings.HasPrefix(msg, "head http") { + err = fmt.Errorf("failed to HEAD bucket %q: %v", bck, err) + } } return } diff --git a/cmd/cli/cli/xact.go b/cmd/cli/cli/xact.go index 1ee247492f..79bc1a3992 100644 --- a/cmd/cli/cli/xact.go +++ b/cmd/cli/cli/xact.go @@ -62,7 +62,7 @@ func toShowMsg(c *cli.Context, xjid, prompt string, verbose bool) string { // Wait for the caller's started xaction to run until finished _or_ idle (NOTE), // warn if aborted func waitXact(apiBP api.BaseParams, args xact.ArgsMsg) error { - debug.Assert(xact.IsValidUUID(args.ID)) + debug.Assert(args.ID == "" || xact.IsValidUUID(args.ID)) kind, xname := xact.GetKindName(args.Kind) debug.Assert(kind != "") // relying on it to decide between APIs if xact.IdlesBeforeFinishing(kind) { diff --git a/cmn/debug/debug_on.go b/cmn/debug/debug_on.go index d3293bc6e9..401b5b4cea 100644 --- a/cmn/debug/debug_on.go +++ b/cmn/debug/debug_on.go @@ -9,6 +9,7 @@ package debug import ( "bytes" "expvar" + "flag" "fmt" "net/http" "net/http/pprof" @@ -55,8 +56,12 @@ func _panic(a ...any) { fmt.Fprintf(buffer, "%s:%d", f, line) } } - nlog.Errorf("%s", buffer.Bytes()) - nlog.Flush(true) + if flag.Parsed() { + nlog.Errorln(buffer.String()) + nlog.Flush(true) + } else { + fmt.Fprintln(os.Stderr, buffer.String()) + } panic(msg) } diff --git a/deploy/dev/local/deploy.sh b/deploy/dev/local/deploy.sh index 44b65e9fc1..407c6805d9 100755 --- a/deploy/dev/local/deploy.sh +++ b/deploy/dev/local/deploy.sh @@ -255,6 +255,9 @@ if command -v pgrep &> /dev/null; then run_count=$(pgrep -a aisnode | grep -c "${NEXT_TIER}") if [[ "${run_count}" -eq $((TARGET_CNT + PROXY_CNT)) ]]; then echo "${listening_on}" + if [[ -z $DEPLOY_AS_NEXT_TIER ]]; then + echo "Primary endpoint: ${AIS_PRIMARY_URL}" + fi fi else echo "Warning: pgrep not found"