diff --git a/.github/workflows/build-snapshots-14110.yaml b/.github/workflows/build-snapshots-14110.yaml index ab803ffe..62b06222 100644 --- a/.github/workflows/build-snapshots-14110.yaml +++ b/.github/workflows/build-snapshots-14110.yaml @@ -61,7 +61,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Set up JDK 11 for Verify CLI uses: actions/setup-java@v3 diff --git a/.github/workflows/build-snapshots.yaml b/.github/workflows/build-snapshots.yaml index 61fe954a..90e435f6 100644 --- a/.github/workflows/build-snapshots.yaml +++ b/.github/workflows/build-snapshots.yaml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: coherenceVersion: - - 23.09.1-SNAPSHOT + - 23.09.2-SNAPSHOT - 22.06.7-SNAPSHOT # Checkout the source, we need a depth of zero to fetch all of the history otherwise @@ -62,7 +62,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Verify Coherence CLI env: diff --git a/.github/workflows/build-test-create-cluster.yaml b/.github/workflows/build-test-create-cluster.yaml index fc6c782f..6cf9616a 100644 --- a/.github/workflows/build-test-create-cluster.yaml +++ b/.github/workflows/build-test-create-cluster.yaml @@ -25,6 +25,7 @@ jobs: - 22.06.6 - 22.06.5 - 23.09 + - 23.09.1 javaVersion: - 17 @@ -59,7 +60,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Build cohctl shell: bash diff --git a/.github/workflows/build-trivy.yaml b/.github/workflows/build-trivy.yaml index 85598450..bf7da5a1 100644 --- a/.github/workflows/build-trivy.yaml +++ b/.github/workflows/build-trivy.yaml @@ -56,9 +56,9 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Trivy Scan shell: bash run: | - make clean trivy-scan \ No newline at end of file + make clean trivy-scan diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3271df7a..206d85a9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -53,7 +53,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Code Review shell: bash diff --git a/.github/workflows/compatability-tests-14110.yaml b/.github/workflows/compatability-tests-14110.yaml new file mode 100644 index 00000000..06486123 --- /dev/null +++ b/.github/workflows/compatability-tests-14110.yaml @@ -0,0 +1,79 @@ +# Copyright 2023 Oracle Corporation and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at +# https://oss.oracle.com/licenses/upl. + +# --------------------------------------------------------------------------- +# Coherence CLI Compatability Tests against mainline of CLI - 14.1.1.0 +# --------------------------------------------------------------------------- +name: Compatability Tests 14.1.1.0 + +on: + workflow_dispatch: + push: + branches-ignore: + - gh-pages + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + coherenceVersion: + - 14.1.1-0-15 + - 14.1.1-0-16-SNAPSHOT + javaImage: + - gcr.io/distroless/java:11 + +# Checkout the source, we need a depth of zero to fetch all of the history otherwise +# the copyright check cannot work out the date of the files from Git. + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get Docker Images + shell: bash + run: | + docker pull gcr.io/distroless/java:11 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'zulu' + + - name: Cache Go Modules + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-mods-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-mods- + + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + + - name: Compatability Tests + shell: bash + run: | + export COHERENCE_BASE_IMAGE=${{ matrix.javaImage }} + export COHERENCE_VERSION=${{ matrix.coherenceVersion }} + make clean build-test-images test-e2e-standalone + make test-clean test-discovery + + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: test-output + path: build/_output/test-logs diff --git a/.github/workflows/compatability-tests-released.yaml b/.github/workflows/compatability-tests-released.yaml index 73ddec1f..7f2cb6f9 100644 --- a/.github/workflows/compatability-tests-released.yaml +++ b/.github/workflows/compatability-tests-released.yaml @@ -22,6 +22,7 @@ jobs: matrix: coherenceVersion: - 23.09 + - 23.09.1 - 22.06.6 - 22.06.7-SNAPSHOT - 14.1.1-0-14 @@ -65,7 +66,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Compatability Tests shell: bash diff --git a/.github/workflows/compatability-tests.yaml b/.github/workflows/compatability-tests.yaml index 62264e88..9acb075f 100644 --- a/.github/workflows/compatability-tests.yaml +++ b/.github/workflows/compatability-tests.yaml @@ -22,11 +22,10 @@ jobs: matrix: coherenceVersion: - 23.09 + - 23.09.1 - 22.06.5 - 22.06.6 - 22.06.7-SNAPSHOT - - 14.1.1-0-15 - - 14.1.1-0-16-SNAPSHOT javaImage: - gcr.io/distroless/java17 @@ -40,7 +39,7 @@ jobs: - name: Get Docker Images shell: bash run: | - docker pull gcr.io/distroless/java:11 + docker pull gcr.io/distroless/java17 - name: Set up JDK uses: actions/setup-java@v3 @@ -66,7 +65,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Compatability Tests shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9c1524dd..fcc317c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Code Review shell: bash diff --git a/.github/workflows/stress.yaml b/.github/workflows/stress.yaml index 9ccf5b33..6b2790cd 100644 --- a/.github/workflows/stress.yaml +++ b/.github/workflows/stress.yaml @@ -1,4 +1,4 @@ -# Copyright 2022, Oracle Corporation and/or its affiliates. +# Copyright 2022, 2023, Oracle Corporation and/or its affiliates. # Licensed under the Universal Permissive License v 1.0 as shown at # https://oss.oracle.com/licenses/upl. @@ -58,11 +58,11 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' - name: Build Test Images shell: bash - run: COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 PROFILES=,executor COHERENCE_VERSION=22.09 make clean build-test-images + run: COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 PROFILES=,executor COHERENCE_VERSION=23.09.1 make clean build-test-images - name: Run Stress Test shell: bash @@ -71,7 +71,7 @@ jobs: make test-cluster-startup ITERS="${{ github.event.inputs.iterations }}" if [ -z "$ITERS" ] ; then - ITERS=50000 + ITERS=1000 fi # Sleep for 20 seconds to allow management startup sleep 20 @@ -84,4 +84,6 @@ jobs: if: failure() with: name: test-output - path: build/_output/stress.log + path: | + build/_output/stress.log + build/_output/config diff --git a/Makefile b/Makefile index 772cf1ee..0f3dc04b 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # ====================================================================================================================== # The version of the CLI being build - this should be a valid SemVer format -VERSION ?= 1.5.2 +VERSION ?= 1.5.3 MILESTONE ?= # Maven version is always 1.0.0 as it is only for testing diff --git a/README.md b/README.md index 6f6e730d..51683ed0 100644 --- a/README.md +++ b/README.md @@ -95,8 +95,8 @@ The fastest way to experience the Coherence CLI is to follow the The CLI supports and is certified against the following Community and Commercial editions of Coherence: **Coherence Community Edition** -* 23.03 -* 22.06.x +* 23.09.+ +* 22.06.+ * 14.1.1-0-12+ **Coherence Grid/ Enterprise Edition** diff --git a/cohctl/main.go b/cohctl/main.go index 0b195515..bbfe2897 100644 --- a/cohctl/main.go +++ b/cohctl/main.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. + * Copyright (c) 2021, 2023 Oracle and/or its affiliates. * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. */ @@ -7,7 +7,9 @@ package main import ( + "fmt" "github.com/oracle/coherence-cli/pkg/cmd" + "os" ) var ( @@ -21,5 +23,9 @@ var ( // main is the main entry point to Coherence CLI func main() { + if os.Getenv("CLI_DISABLED") != "" { + fmt.Println("cohctl has been disabled from running in the Coherence Operator") + return + } cmd.Execute(Version, Date, Commit) } diff --git a/docs/reference/25_caches.adoc b/docs/reference/25_caches.adoc index 9719784b..e92b8d09 100644 --- a/docs/reference/25_caches.adoc +++ b/docs/reference/25_caches.adoc @@ -15,7 +15,10 @@ There are various commands that allow you to work with and manage cluster caches * <> - displays the caches for a cluster * <> - shows information related to a specific cache and service -* <> - displays the cache stores for a cache and service +* <> - displays cache stores for a cache and service +* <> - displays cache storage information for a cache and service +* <> - displays cache access information for a cache and service +* <> - displays cache index information for a cache and service * <> - sets an attribute for a cache across one or more members * <> - truncates a caches contents, not generating any cache events * <> - clears a caches contents @@ -206,22 +209,72 @@ You may omit the service name if the cache name is unique. NOTE: If you do not use the `-o wide` option, then you will only see service, cache name, count and size. -Display all caches for a particular service. +[#get-cache-storage] +==== Get Cache Storage + +include::../../build/_output/docs-gen/get_cache_storage.adoc[tag=text] [source,bash] ---- -cohctl get caches -c local -s PartitionedCache -o wide -m +cohctl get cache-storage -c local test ---- Output: [source,bash] ---- -Total Caches: 2, Total primary storage: 36 MB -SERVICE CACHE COUNT SIZE AVG SIZE TOTAL PUTS TOTAL GETS TOTAL REMOVES TOTAL HITS TOTAL MISSES HIT PROB -PartitionedCache customers 100,000 25 MB 262 200,000 0 0 0 0 0.00% -PartitionedCache orders 10,000 11 MB 1,160 20,000 20,000 0 20,000 0 100.00% +Cache: test + +NODE ID TIER LOCKS GRANTED LOCKS PENDING KEY LISTENERS FILTER LISTENERS MAX QUERY MS MAX QUERY DESC + 1 back 0 0 0 0 0 + 2 back 0 0 0 0 0 + 3 back 0 0 0 0 0 ---- +[#get-cache-access] +==== Get Cache Access + +include::../../build/_output/docs-gen/get_cache_access.adoc[tag=text] + +[source,bash] +---- +cohctl get cache-access -c local test +---- +Output: +[source,bash] +---- +Cache: test + +NODE ID TIER COUNT SIZE PUTS GETS REMOVES CLEARS EVICTIONS + 1 back 0 0 MB 0 0 0 2 0 + 2 back 0 0 MB 2 0 2 2 0 + 3 back 0 0 MB 0 0 0 2 0 +---- + +[#get-cache-indexes] +==== Get Cache Indexes + +include::../../build/_output/docs-gen/get_cache_indexes.adoc[tag=text] + +[source,bash] +---- +cohctl get cache-indexes -c local test +---- +Output: +[source,bash] +---- +Cache: test + +Total Indexing Bytes: 49,756 +Total Indexing: 0 MB +Total Indexing Millis: 1,942 + +Node:2: PartitionedIndex: Extractor=.toString()(), Ordered=true, Footprint=16.2KB +Node:1: PartitionedIndex: Extractor=.toString()(), Ordered=true, Footprint=16.2KB +Node:3: PartitionedIndex: Extractor=.toString()(), Ordered=true, Footprint=16.0KB +---- + +NOTE: Depending upon the Coherence version, you may not see all the above information. + [#set-cache] ==== Set Cache diff --git a/go.mod b/go.mod index 61a33737..618e00b4 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,13 @@ // module github.com/oracle/coherence-cli -go 1.19 +go 1.20 require ( github.com/fatih/color v1.14.1 github.com/ohler55/ojg v1.12.8 github.com/onsi/gomega v1.19.0 - github.com/oracle/coherence-go-client v1.0.2 + github.com/oracle/coherence-go-client v1.0.3 github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.12.0 go.uber.org/zap v1.21.0 diff --git a/go.sum b/go.sum index d812134d..0e1dfd7c 100644 --- a/go.sum +++ b/go.sum @@ -152,8 +152,8 @@ github.com/ohler55/ojg v1.12.8/go.mod h1:LBbIVRAgoFbYBXQhRhuEpaJIqq+goSO63/FQ+ny github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc= github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/oracle/coherence-go-client v1.0.2 h1:sMIkBoYDJYP3lq6Th1WAJSVKRkqERY8W7auFsoVJGJs= -github.com/oracle/coherence-go-client v1.0.2/go.mod h1:CK8c0CpzZpYXthR6U3t1UpJRkllBpabooaxewJ1oT3c= +github.com/oracle/coherence-go-client v1.0.3 h1:P8Rzgo21BAaJsKzemzMCFY9I27PdKBpr5ZqrHhZ7zPg= +github.com/oracle/coherence-go-client v1.0.3/go.mod h1:IAk8etsxzhUK6YaGzbInR1LYlh+1fiG85bGpyvzY0QY= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= diff --git a/pkg/cmd/cache.go b/pkg/cmd/cache.go index 059867d1..98143436 100644 --- a/pkg/cmd/cache.go +++ b/pkg/cmd/cache.go @@ -343,6 +343,140 @@ You can specify '-o wide' to display addition information.`, }, } +// getCacheAccessCmd represents the get cache-access command. +var getCacheAccessCmd = &cobra.Command{ + Use: "cache-access cache-name", + Short: "display cache access information for a cache and service", + Long: `The 'get cache-access' command displays cache access information related to a specific cache. +You can specify '-o wide' to display addition information.`, + ValidArgsFunction: completionCaches, + Args: func(cmd *cobra.Command, args []string) error { + if len(args) != 1 { + displayErrorAndExit(cmd, provideCacheMessage) + } + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + return getCacheDetails(cmd, args, "access") + }, +} + +// getCacheStorageCmd represents the get cache-storage command. +var getCacheStorageCmd = &cobra.Command{ + Use: "cache-storage cache-name", + Short: "display cache storage information for a cache and service", + Long: `The 'get cache-storage' command displays cache storage information related to a specific cache. +You can specify '-o wide' to display addition information.`, + ValidArgsFunction: completionCaches, + Args: func(cmd *cobra.Command, args []string) error { + if len(args) != 1 { + displayErrorAndExit(cmd, provideCacheMessage) + } + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + return getCacheDetails(cmd, args, "storage") + }, +} + +// getCacheIndexesCmd represents the get cache-indexes command. +var getCacheIndexesCmd = &cobra.Command{ + Use: "cache-indexes cache-name", + Short: "display cache index information for a cache and service", + Long: `The 'get cache-indexes' command displays cache index information related to a specific cache.`, + ValidArgsFunction: completionCaches, + Args: func(cmd *cobra.Command, args []string) error { + if len(args) != 1 { + displayErrorAndExit(cmd, provideCacheMessage) + } + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + return getCacheDetails(cmd, args, "index") + }, +} + +// getCacheDetails displays either access, storage or index details for a cache depending upon +// the value of displayType. +func getCacheDetails(cmd *cobra.Command, args []string, displayType string) error { + var ( + err error + dataFetcher fetcher.Fetcher + found bool + connection string + ) + + cacheName := args[0] + + connection, dataFetcher, err = GetConnectionAndDataFetcher() + if err != nil { + return err + } + + if serviceName, err = findServiceForCacheOrTopic(dataFetcher, cacheName, "cache"); err != nil { + return err + } + + found, err = ServiceExists(dataFetcher, serviceName) + if !found || err != nil { + return fmt.Errorf(cannotFindService, serviceName) + } + + for { + var ( + cacheResult []byte + cacheDetails = config.CacheDetails{} + result string + ) + + cacheResult, err = dataFetcher.GetCacheMembers(serviceName, cacheName) + if err != nil { + return err + } + + if string(cacheResult) == "{}" || len(cacheResult) == 0 { + return fmt.Errorf(cannotFindCache, cacheName, serviceName) + } + + if strings.Contains(OutputFormat, constants.JSONPATH) { + result, err = utils.GetJSONPathResults(cacheResult, OutputFormat) + if err != nil { + return err + } + cmd.Println(result) + } else if OutputFormat == constants.JSON { + cmd.Println(string(cacheResult)) + } else { + err = json.Unmarshal(cacheResult, &cacheDetails) + if err != nil { + return utils.GetError("unable to unmarshall cache result", err) + } + + printWatchHeader(cmd) + cmd.Println(FormatCurrentCluster(connection)) + + cmd.Printf("Cache: %s\n\n", args[0]) + + if displayType == "access" { + cmd.Println(FormatCacheDetailsSizeAndAccess(cacheDetails.Details)) + } else if displayType == "index" { + cmd.Println(FormatCacheIndexDetails(cacheDetails.Details)) + } else if displayType == "storage" { + cmd.Println(FormatCacheDetailsStorage(cacheDetails.Details)) + } + } + + // check to see if we should exit if we are not watching + if !isWatchEnabled() { + break + } + // we are watching so sleep and then repeat until CTRL-C + time.Sleep(time.Duration(watchDelay) * time.Second) + } + + return nil +} + // clearCacheCmd represents the clear cache command. var clearCacheCmd = &cobra.Command{ Use: "cache cache-name", @@ -720,6 +854,9 @@ func init() { describeCacheCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription) getCacheStoresCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription) + getCacheAccessCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription) + getCacheStorageCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription) + getCacheIndexesCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription) clearCacheCmd.Flags().StringVarP(&serviceName, serviceNameOption, serviceNameOptionShort, "", serviceNameDescription) clearCacheCmd.Flags().BoolVarP(&automaticallyConfirm, "yes", "y", false, confirmOptionMessage) diff --git a/pkg/cmd/formatting.go b/pkg/cmd/formatting.go index f85acb82..64a0f7e3 100644 --- a/pkg/cmd/formatting.go +++ b/pkg/cmd/formatting.go @@ -816,13 +816,13 @@ func FormatCacheDetailsSizeAndAccess(cacheDetails []config.CacheDetail) string { }) table := newFormattedTable().WithHeader(NodeIDColumn, "TIER", "COUNT", "SIZE", - "PUTS", "GETS", "REMOVES", "EVICTIONS") + "PUTS", "GETS", "REMOVES", "CLEARS", "EVICTIONS") if OutputFormat == constants.WIDE { - table.WithAlignment(R, L, R, R, R, R, R, R, R, R, R, R, R, R) + table.WithAlignment(R, L, R, R, R, R, R, R, R, R, R, R, R, R, R) table.AddHeaderColumns("HITS", "MISSES", "HIT PROB", "STORE READS", "WRITES", "FAILURES") } else { - table.WithAlignment(R, L, R, R, R, R, R, R) + table.WithAlignment(R, L, R, R, R, R, R, R, R) } for _, value := range cacheDetails { @@ -841,7 +841,7 @@ func FormatCacheDetailsSizeAndAccess(cacheDetails []config.CacheDetail) string { formatSmallInteger(value.CacheSize), formattingFunction(unitsBytes), formatLargeInteger(value.TotalPuts), formatLargeInteger(totalGets), formatLargeInteger(value.TotalRemoves), - formatLargeInteger(value.Evictions)) + formatLargeInteger(value.TotalClears), formatLargeInteger(value.Evictions)) if OutputFormat == constants.WIDE { table.AddColumnsToRow(formatLargeInteger(totalHits), formatLargeInteger(value.CacheMisses), formatPercent(hitProb), @@ -1452,6 +1452,12 @@ func FormatNetworkStats(details []config.NetworkStatsDetails) string { } sort.Slice(details, func(p, q int) bool { + if p2pSortByPublisher { + return details[p].PublisherSuccessRate < details[q].PublisherSuccessRate + } else if p2pSortByReceiver { + return details[p].ReceiverSuccessRate < details[q].ReceiverSuccessRate + } + nodeID1, _ := strconv.Atoi(details[p].NodeID) nodeID2, _ := strconv.Atoi(details[q].NodeID) return nodeID1 < nodeID2 @@ -1524,13 +1530,14 @@ func FormatServices(services []config.ServiceSummary) string { return strings.Compare(services[p].ServiceName, services[q].ServiceName) < 0 }) - table := newFormattedTable().WithHeader(ServiceNameColumn, "TYPE", MembersColumn, "STATUS HA", "STORAGE", "SENIOR", partitions) + table := newFormattedTable().WithHeader(ServiceNameColumn, "TYPE", MembersColumn, "STATUS HA", "STORAGE", + "SENIOR", partitions, "STATUS") if OutputFormat == constants.WIDE { - table.WithAlignment(L, L, R, L, R, R, R, R, R, R, L, L) - table.AddHeaderColumns(endangered, "VULNERABLE", "UNBALANCED", "STATUS", "SUSPENDED") + table.WithAlignment(L, L, R, L, R, R, R, L, R, R, R, L) + table.AddHeaderColumns(endangered, "VULNERABLE", "UNBALANCED", "SUSPENDED") table.AddFormattingFunction(9, statusHAFormatter) } else { - table.WithAlignment(L, L, R, L, R, R, R) + table.WithAlignment(L, L, R, L, R, R, R, L) } table.AddFormattingFunction(3, statusHAFormatter) @@ -1562,12 +1569,12 @@ func FormatServices(services []config.ServiceSummary) string { table.AddRow(value.ServiceName, value.ServiceType, formatSmallInteger(value.MemberCount), value.StatusHA, formatSmallInteger(value.StorageEnabledCount), formatSmallInteger(value.SeniorMemberID), - formatSmallInteger(value.PartitionsAll)) + formatSmallInteger(value.PartitionsAll), status) if OutputFormat == constants.WIDE { table.AddColumnsToRow(formatSmallInteger(value.PartitionsEndangered), formatSmallInteger(value.PartitionsVulnerable), - formatSmallInteger(value.PartitionsUnbalanced), status, suspended) + formatSmallInteger(value.PartitionsUnbalanced), suspended) } } diff --git a/pkg/cmd/member.go b/pkg/cmd/member.go index 05cd36e7..f79a5ea4 100644 --- a/pkg/cmd/member.go +++ b/pkg/cmd/member.go @@ -39,6 +39,8 @@ var ( attributeValue string validAttributes = []string{"loggingLevel", "resendDelay", "sendAckDelay", "trafficJamCount", "trafficJamDelay", "loggingLimit,", "loggingFormat"} + p2pSortByPublisher bool + p2pSortByReceiver bool memberSummary bool @@ -280,6 +282,10 @@ of view of a member and all the members it connects to.`, return err } + if p2pSortByReceiver && p2pSortByPublisher { + return errors.New("you cannot specify to sort by publisher and receiver, please choose only one") + } + memberResult, err = dataFetcher.GetMemberDetailsJSON(false) if err != nil { return err @@ -1155,4 +1161,7 @@ func init() { configureTracingCmd.Flags().BoolVarP(&automaticallyConfirm, "yes", "y", false, confirmOptionMessage) shutdownMemberCmd.Flags().BoolVarP(&automaticallyConfirm, "yes", "y", false, confirmOptionMessage) + + getP2PStatsCmd.Flags().BoolVarP(&p2pSortByPublisher, "publisher-sort", "P", false, "sort output by publisher rate") + getP2PStatsCmd.Flags().BoolVarP(&p2pSortByReceiver, "receiver-sort", "R", false, "sort output by receiver rate") } diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index 6710a16f..7126a7b9 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -502,6 +502,9 @@ func Initialize(command *cobra.Command) *cobra.Command { getCmd.AddCommand(getServiceDescriptionCmd) getCmd.AddCommand(getClusterDescription) getCmd.AddCommand(getMemberDescriptionCmd) + getCmd.AddCommand(getCacheAccessCmd) + getCmd.AddCommand(getCacheStorageCmd) + getCmd.AddCommand(getCacheIndexesCmd) // set command command.AddCommand(setCmd) diff --git a/pkg/cmd/service.go b/pkg/cmd/service.go index 91c410e3..6f8da11b 100644 --- a/pkg/cmd/service.go +++ b/pkg/cmd/service.go @@ -523,7 +523,7 @@ var getServiceMembersCmd = &cobra.Command{ finalDetails = membersDetails.Services } - cmd.Println("Service: " + serviceName) + cmd.Println("Service: " + serviceName + "\n") cmd.Println(FormatServiceMembers(finalDetails)) } diff --git a/pkg/config/config_helper.go b/pkg/config/config_helper.go index b43f8eeb..cca06f3c 100644 --- a/pkg/config/config_helper.go +++ b/pkg/config/config_helper.go @@ -537,6 +537,7 @@ type CacheDetail struct { TotalPuts int64 `json:"totalPuts"` TotalGets int64 `json:"totalGets"` TotalRemoves int64 `json:"removeCount"` + TotalClears int64 `json:"clearCount"` CacheHits int64 `json:"cacheHits"` CacheMisses int64 `json:"cacheMisses"` Evictions int64 `json:"evictionCount"` diff --git a/scripts/generate-doc-snippets.sh b/scripts/generate-doc-snippets.sh index 8c18a983..65ebe979 100755 --- a/scripts/generate-doc-snippets.sh +++ b/scripts/generate-doc-snippets.sh @@ -108,6 +108,9 @@ create_doc $DOCS_DIR/set_management "${COHCTL} set management --help" # Caches create_doc $DOCS_DIR/get_caches "${COHCTL} get caches --help" create_doc $DOCS_DIR/get_cache_stores "${COHCTL} get cache-stores --help" +create_doc $DOCS_DIR/get_cache_storage "${COHCTL} get cache-storage --help" +create_doc $DOCS_DIR/get_cache_access "${COHCTL} get cache-access --help" +create_doc $DOCS_DIR/get_cache_indexes "${COHCTL} get cache-indexes --help" create_doc $DOCS_DIR/describe_cache "${COHCTL} describe cache --help" create_doc $DOCS_DIR/set_cache "${COHCTL} set cache --help" create_doc $DOCS_DIR/truncate_cache "${COHCTL} truncate cache --help" diff --git a/scripts/run-compat-ce.sh b/scripts/run-compat-ce.sh index 5b7f25c5..78171554 100755 --- a/scripts/run-compat-ce.sh +++ b/scripts/run-compat-ce.sh @@ -12,15 +12,15 @@ set -e echo "Coherence CE 22.06.6" COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 COHERENCE_VERSION=22.06.6 make clean build-test-images test-e2e-standalone -echo "Coherence CE 23.09" -COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 COHERENCE_VERSION=23.09 make clean build-test-images test-e2e-standalone +echo "Coherence CE 23.09.1" +COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 COHERENCE_VERSION=23.09.1 make clean build-test-images test-e2e-standalone -echo "Coherence CE 23.09 with Executor" -COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 PROFILES=,executor COHERENCE_VERSION=23.09 make clean build-test-images test-e2e-standalone +echo "Coherence CE 23.09.1 with Executor" +COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 PROFILES=,executor COHERENCE_VERSION=23.09.1 make clean build-test-images test-e2e-standalone echo "Coherence CE 14.1.1-0-15" COHERENCE_VERSION=14.1.1-0-15 make clean build-test-images test-e2e-standalone -echo "Coherence CE 23.09 with Topics" -COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 PROFILES=,topics COHERENCE_VERSION=23.09 make clean build-test-images test-e2e-topics +echo "Coherence CE 23.09.1 with Topics" +COHERENCE_BASE_IMAGE=gcr.io/distroless/java17 PROFILES=,topics COHERENCE_VERSION=23.09.1 make clean build-test-images test-e2e-topics diff --git a/scripts/run-stress-test.sh b/scripts/run-stress-test.sh index ce0695e4..bb3bab5c 100755 --- a/scripts/run-stress-test.sh +++ b/scripts/run-stress-test.sh @@ -20,14 +20,18 @@ COHCTL=$1 ITERS=$2 BUILD_OUTPUT=$3 -CONFIG_DIR=/tmp/$$.config -trap "rm -rf $CONFIG_DIR" 0 1 2 3 +CONFIG_DIR=${BUILD_OUTPUT}/config +mkdir -p ${CONFIG_DIR} +#trap "rm -rf $CONFIG_DIR" 0 1 2 3 echo "Redirecting output to $BUILD_OUTPUT/stress.log..." exec > $BUILD_OUTPUT/stress.log 2>&1 mkdir -p $CONFIG_DIR +# Add some data +curl http://localhost:8080/populate + ARGS="--config-dir $CONFIG_DIR" $COHCTL $ARGS add cluster local -u localhost:30000 diff --git a/test/common/common.go b/test/common/common.go index 03ee1fc5..206bc547 100644 --- a/test/common/common.go +++ b/test/common/common.go @@ -1131,6 +1131,18 @@ func RunTestCachesCommands(t *testing.T) { test_utils.EnsureCommandContainsAll(g, t, cliCmd, "SERVICE,COUNT,SIZE,cache-1,cache-2", configArg, file, "get", "caches", "-c", context.ClusterName) + // test cache-storage + test_utils.EnsureCommandContainsAll(g, t, cliCmd, "LOCKS GRANTED,", configArg, file, + "get", "cache-storage", cacheName, "-c", context.ClusterName) + + // test cache-access + test_utils.EnsureCommandContainsAll(g, t, cliCmd, "EVICTIONS,", configArg, file, + "get", "cache-access", cacheName, "-c", context.ClusterName) + + // test cache-indexes + test_utils.EnsureCommandContainsAll(g, t, cliCmd, "Total Indexing Bytes,", configArg, file, + "get", "cache-indexes", cacheName, "-c", context.ClusterName) + // test write-behind test_utils.EnsureCommandContainsAll(g, t, cliCmd, "PartitionedCacheWriteBehind,QUEUE SIZE,cache-store-1", configArg, file, "get", "cache-stores", "cache-store-1", "-s", "PartitionedCacheWriteBehind", "-c", context.ClusterName)