tree: bef9504bef322b66a37ec0f2dcf5f8f81240b9ed [path history] [tgz]
  1. cmd/
  2. end_to_end/
  3. .gitignore
  4. go.mod
  5. go.sum
  6. Makefile
  7. pxf-cli.go
  8. README.md
  9. tools.go
cli/README.md

pxf cluster CLI

Getting Started

  1. Ensure you are set up for PXF development by following the README.md at the root of this repository. This tool requires Go version 1.21 or higher. Follow the directions here to get the language set up.

  2. Run the tests

    make test
    
  3. Build the CLI

    make
    

    This will put the binary pxf-cli into pxf/cli/build/. You can also install the binary into ${PXF_HOME}/bin/pxf-cli with:

    make install
    
  4. There is also end to end testing for the pxf-cli. These tests can be run using the GitHub Action CI or locally via the Docker environment defined in ci/.

Debugging the CLI on a live system

Because it‘s hard to mock out a Greenplum cluster, it’s useful to debug on a real live cluster. We can do this using the delve project.

  1. Install dlv command, see here for more details:
go install github.com/go-delve/delve/cmd/dlv@latest
  1. Optionally create a file with a list of commands, this could be useful to save you from re-running commands. You can actually run them with the source command in the dlv REPL:
config max-string-len 1000
break vendor/github.com/apache/cloudberry-go-libs/cluster/cluster.go:351
continue
print commandList
  1. Run the dlv command to enter the interactive REPL:
cd ~/workspace/pxf/cli
GPHOME=/usr/local/greenplum-db dlv debug pxf-cli -- cluster restart

The help page for dlv is useful.

IDE Setup (GoLand)

  • Start GoLand. Click “Open” and select the cli folder inside the pxf repo.
  • Open preferences/settings and set under GO > GoPath, set Project GoPath to ~/workspace/pxf/cli/go or the equivalent.
  • Under GO > Go Modules, select the enable button and leave the environment field empty.
  • Check that it worked by running a test file (ex: go test pxf-cli/cmd)