util

package
v0.0.0-...-d84ef59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLI_BIN           = "mxbench"
	MX_GATE_CLI_BIN   = "mxgated"
	GP_CONFIG_CLI_BIN = "gpconfig"
	GP_STOP_CLI_BIN   = "gpstop"
	MX_STOP_CLI_BIN   = "mxstop"
	CREATEDB_CLI_BIN  = "createdb"
	PSQL_BIN          = "psql"

	TIME_FMT         = "2006-01-02 15:04:05"
	TIME_WITH_TZ_FMT = "2006-01-02 15:04:05 -0700"
	DELIMITER        = "|"
	ENV_KEY_MXHOME   = "GPHOME"
)
View Source
const (
	MAJOR_VERSION_5 uint64 = 5
)

Variables

View Source
var (
	VersionStr string
	BranchStr  string
	CommitStr  string
)

Functions

func CreateDBConnection

func CreateDBConnection(params DBConnParams) (*sqlx.DB, error)

CreateDBConnection establishes a connection to YMatrix Call Close() after use

func CreateDBIfNotExists

func CreateDBIfNotExists(params DBConnParams) error

func FindMxCommand

func FindMxCommand(cmdName string) (cmdPath, mxDBHome string, err error)

FindMxCommand locate ABS path for a matrixdb/bin executable, such as initdb or pg_ctl. It will try same dir as mxctl is located, then $PATH, finally $GPHOME

func GetMxbenchVersion

func GetMxbenchVersion() string

func GetVersionStr

func GetVersionStr() string

func Intn

func Intn(n int) int
func PrintLogo(license string)

func RestartDB

func RestartDB() error

func SetGUC

func SetGUC(gucName, gucValueOnMaster, gucValueOnSegments string) error

func ShowGUC

func ShowGUC(gucName string) (string, string, error)

Values on all segments are consistent GUC : gp_vmem_protect_limit Master value: 4096 Segment value: 8192

func StartMxgate

func StartMxgate(mxgatePath, arguments string) (*exec.Cmd, io.Reader, error)

func StartMxgateStdin

func StartMxgateStdin(mxgatePath, arguments string) (*exec.Cmd, io.WriteCloser, *bytes.Buffer, *bytes.Buffer, error)

func StartMxgateStdinWithContext

func StartMxgateStdinWithContext(ctx context.Context, mxgatePath, arguments string) (*exec.Cmd, io.WriteCloser, *bytes.Buffer, *bytes.Buffer, error)

func StartMxgateWithContext

func StartMxgateWithContext(ctx context.Context, mxgatePath, arguments string) (*exec.Cmd, io.Reader, error)

func String

func String(length int) string

func StringWithCharset

func StringWithCharset(length int, charset string) string

func TempDir

func TempDir() string

Types

type DBConnParams

type DBConnParams struct {
	MasterPort     int    `mapstructure:"db-master-port"`
	MaxConnections int    `mapstructure:"db-max-conn"`
	MasterHost     string `mapstructure:"db-master-host"`
	User           string `mapstructure:"db-user"`
	Database       string `mapstructure:"db-database"`
	Password       string `mapstructure:"db-password"`
	Options        []string
}

func (*DBConnParams) GetConnStr

func (params *DBConnParams) GetConnStr() string

func (*DBConnParams) GetCreateDBParams

func (params *DBConnParams) GetCreateDBParams() []string

type DBVersion

type DBVersion struct {
	VersionString string
	SemVer        semver.Version
}

func GetMXDBVersionFromDB

func GetMXDBVersionFromDB(params DBConnParams) (DBVersion, error)

func NewMXDBVersion

func NewMXDBVersion(version string) (DBVersion, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL