diff

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: PostgreSQL Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDiffFileFormat

func CheckDiffFileFormat(filePath string, task *TableDiffTask) error

func RepsetDiff

func RepsetDiff(task *RepsetDiffCmd) (err error)

Types

type DiffSummary added in v1.7.1

type DiffSummary struct {
	MatchedTables  []string
	DifferedTables []string
	FailedTables   []FailedTableInfo
	MissingTables  []MissingTableInfo
	SkippedTables  []string
}

DiffSummary collects per-table outcomes during a schema-diff or repset-diff run and prints a human-readable summary at the end.

func (*DiffSummary) PrintAndFinalize added in v1.7.1

func (s *DiffSummary) PrintAndFinalize(commandName, label string) error

PrintAndFinalize logs the summary and returns an error if any tables failed. The label identifies the scope (e.g. "schema public" or "repset default").

type FailedTableInfo added in v1.7.1

type FailedTableInfo struct {
	Table string // schema-qualified table name
	Err   error  // the error that caused the failure
}

FailedTableInfo records a table whose diff failed along with the reason.

type HashResult

type HashResult struct {
	// contains filtered or unexported fields
}

type HashTask

type HashTask struct {
	// contains filtered or unexported fields
}

type MissingTableInfo added in v1.7.1

type MissingTableInfo struct {
	Table       string   // schema-qualified table name
	PresentOn   []string // node names where the table exists
	MissingFrom []string // node names where the table does not exist
}

MissingTableInfo records a table that was not found on every node.

type NodeComparisonReport

type NodeComparisonReport struct {
	Status string              `json:"status"`
	Diffs  map[string]NodeDiff `json:"diffs,omitempty"`
}

type NodeDiff

type NodeDiff struct {
	MissingObjects SchemaObjects `json:"missing_objects"`
	ExtraObjects   SchemaObjects `json:"extra_objects"`
}

type NodeSchemaReport

type NodeSchemaReport struct {
	NodeName string        `json:"node_name"`
	Objects  SchemaObjects `json:"objects"`
}

type Range

type Range struct {
	Start any
	End   any
}

type RangeResults

type RangeResults map[string]HashResult

type RecursiveDiffTask

type RecursiveDiffTask struct {
	Node1Name                 string
	Node2Name                 string
	CurrentRange              Range
	CurrentEstimatedBlockSize int
}

type RepsetDiffCmd

type RepsetDiffCmd struct {
	types.Task

	ClusterName string
	DBName      string
	RepsetName  string
	Nodes       string
	Quiet       bool
	SkipTables  string
	SkipFile    string

	ConnectionPool    *pgxpool.Pool
	ConcurrencyFactor float64
	MaxConnections    int
	BlockSize         int
	CompareUnitSize   int
	Output            string
	TableFilter       string
	OverrideBlockSize bool
	Ctx               context.Context

	ClientRole   string
	InvokeMethod string

	SkipDBUpdate  bool
	TaskStore     *taskstore.Store
	TaskStorePath string
	// contains filtered or unexported fields
}

func NewRepsetDiffTask

func NewRepsetDiffTask() *RepsetDiffCmd

func (*RepsetDiffCmd) CloneForSchedule

func (task *RepsetDiffCmd) CloneForSchedule(ctx context.Context) *RepsetDiffCmd

func (*RepsetDiffCmd) GetClusterName

func (c *RepsetDiffCmd) GetClusterName() string

func (*RepsetDiffCmd) GetClusterNodes

func (c *RepsetDiffCmd) GetClusterNodes() []map[string]any

func (*RepsetDiffCmd) GetDBName

func (c *RepsetDiffCmd) GetDBName() string

func (*RepsetDiffCmd) GetNodeList

func (c *RepsetDiffCmd) GetNodeList() []string

func (*RepsetDiffCmd) GetNodes

func (c *RepsetDiffCmd) GetNodes() string

func (*RepsetDiffCmd) RunChecks

func (c *RepsetDiffCmd) RunChecks(skipValidation bool) error

func (*RepsetDiffCmd) SetClusterNodes

func (c *RepsetDiffCmd) SetClusterNodes(cn []map[string]any)

func (*RepsetDiffCmd) SetDBName

func (c *RepsetDiffCmd) SetDBName(name string)

func (*RepsetDiffCmd) SetDatabase

func (c *RepsetDiffCmd) SetDatabase(db types.Database)

func (*RepsetDiffCmd) SetNodeList

func (c *RepsetDiffCmd) SetNodeList(nodes []string)

func (*RepsetDiffCmd) Validate

func (c *RepsetDiffCmd) Validate() error

type SchemaDiffCmd

type SchemaDiffCmd struct {
	types.Task

	ClusterName string
	DBName      string
	SchemaName  string
	Nodes       string
	Quiet       bool
	SkipTables  string
	SkipFile    string
	DDLOnly     bool

	ConnectionPool    *pgxpool.Pool
	ConcurrencyFactor float64
	MaxConnections    int
	BlockSize         int
	CompareUnitSize   int
	Output            string
	TableFilter       string
	OverrideBlockSize bool
	Ctx               context.Context

	SkipDBUpdate  bool
	TaskStore     *taskstore.Store
	TaskStorePath string
	// contains filtered or unexported fields
}

func NewSchemaDiffTask

func NewSchemaDiffTask() *SchemaDiffCmd

func (*SchemaDiffCmd) CloneForSchedule

func (task *SchemaDiffCmd) CloneForSchedule(ctx context.Context) *SchemaDiffCmd

func (*SchemaDiffCmd) GetClusterName

func (c *SchemaDiffCmd) GetClusterName() string

func (*SchemaDiffCmd) GetClusterNodes

func (c *SchemaDiffCmd) GetClusterNodes() []map[string]any

func (*SchemaDiffCmd) GetDBName

func (c *SchemaDiffCmd) GetDBName() string

func (*SchemaDiffCmd) GetNodeList

func (c *SchemaDiffCmd) GetNodeList() []string

func (*SchemaDiffCmd) GetNodes

func (c *SchemaDiffCmd) GetNodes() string

func (*SchemaDiffCmd) RunChecks

func (c *SchemaDiffCmd) RunChecks(skipValidation bool) error

func (*SchemaDiffCmd) SchemaTableDiff

func (task *SchemaDiffCmd) SchemaTableDiff() (err error)

func (*SchemaDiffCmd) SetClusterNodes

func (c *SchemaDiffCmd) SetClusterNodes(cn []map[string]any)

func (*SchemaDiffCmd) SetDBName

func (c *SchemaDiffCmd) SetDBName(name string)

func (*SchemaDiffCmd) SetDatabase

func (c *SchemaDiffCmd) SetDatabase(db types.Database)

func (*SchemaDiffCmd) SetNodeList

func (c *SchemaDiffCmd) SetNodeList(nodes []string)

func (*SchemaDiffCmd) Validate

func (c *SchemaDiffCmd) Validate() error

type SchemaObjects

type SchemaObjects struct {
	Tables    []string `json:"tables"`
	Views     []string `json:"views"`
	Functions []string `json:"functions"`
	Indices   []string `json:"indices"`
}

func (SchemaObjects) IsEmpty

func (so SchemaObjects) IsEmpty() bool

type SpockDiffTask

type SpockDiffTask struct {
	types.Task
	types.DerivedFields
	DBName string
	Nodes  string
	Output string

	ClientRole   string
	InvokeMethod string
	Pools        map[string]*pgxpool.Pool

	DiffResult   *types.SpockDiffOutput
	DiffFilePath string
	SkipDBUpdate bool

	TaskStore     *taskstore.Store
	TaskStorePath string

	Ctx context.Context
}

SpockDiffTask defines the task for comparing spock metadata across nodes.

func NewSpockDiffTask

func NewSpockDiffTask() *SpockDiffTask

func (*SpockDiffTask) ExecuteTask

func (t *SpockDiffTask) ExecuteTask() (err error)

func (*SpockDiffTask) GetClusterName

func (t *SpockDiffTask) GetClusterName() string

Implement ClusterConfigProvider interface for SpockDiffTask

func (*SpockDiffTask) GetClusterNodes

func (t *SpockDiffTask) GetClusterNodes() []map[string]any

func (*SpockDiffTask) GetDBName

func (t *SpockDiffTask) GetDBName() string

func (*SpockDiffTask) GetNodeList

func (t *SpockDiffTask) GetNodeList() []string

func (*SpockDiffTask) GetNodes

func (t *SpockDiffTask) GetNodes() string

func (*SpockDiffTask) RunChecks

func (t *SpockDiffTask) RunChecks(skipValidation bool) error

func (*SpockDiffTask) SetClusterNodes

func (t *SpockDiffTask) SetClusterNodes(cn []map[string]any)

func (*SpockDiffTask) SetDBName

func (t *SpockDiffTask) SetDBName(name string)

func (*SpockDiffTask) SetDatabase

func (t *SpockDiffTask) SetDatabase(db types.Database)

func (*SpockDiffTask) SetNodeList

func (t *SpockDiffTask) SetNodeList(nl []string)

func (*SpockDiffTask) Validate

func (t *SpockDiffTask) Validate() error

type SpockNodeConfig

type SpockNodeConfig struct {
	NodeName      string                    `json:"node_name"`
	Subscriptions []types.SpockSubscription `json:"subscriptions"`
	RepSetInfo    []types.SpockRepSetInfo   `json:"rep_set_info"`
	Hints         []string                  `json:"hints"`
}

SpockNodeConfig aggregates all spock configuration for a single node.

type TableDiffTask

type TableDiffTask struct {
	types.Task
	types.DerivedFields
	QualifiedTableName string
	DBName             string
	Nodes              string

	BaseTable           string
	FilteredViewName    string
	FilteredViewCreated bool

	BlockSize         int
	ConcurrencyFactor float64
	MaxConnections    int
	Output            string
	TableFilter       string
	QuietMode         bool

	AgainstOrigin string
	Until         string

	EffectiveFilter string

	Mode              string
	OverrideBlockSize bool

	DiffFilePath string

	InvokeMethod string
	ClientRole   string

	EnsurePgcrypto bool

	DiffSummary map[string]string

	SkipDBUpdate bool

	TaskStore     *taskstore.Store
	TaskStorePath string

	Pools map[string]*pgxpool.Pool

	SpockNodeNames map[string]string

	CompareUnitSize int
	MaxDiffRows     int64

	DiffResult types.DiffOutput

	Ctx context.Context
	// contains filtered or unexported fields
}

func NewTableDiffTask

func NewTableDiffTask() *TableDiffTask

func (*TableDiffTask) AddPrimaryKeyToDiffSummary

func (t *TableDiffTask) AddPrimaryKeyToDiffSummary()

func (*TableDiffTask) CheckColumnSize

func (t *TableDiffTask) CheckColumnSize() error

func (*TableDiffTask) CloneForSchedule

func (t *TableDiffTask) CloneForSchedule(ctx context.Context) *TableDiffTask

func (*TableDiffTask) ExecuteRerunTask

func (t *TableDiffTask) ExecuteRerunTask() error

func (*TableDiffTask) ExecuteTask

func (t *TableDiffTask) ExecuteTask() (err error)

func (*TableDiffTask) GetClusterName

func (t *TableDiffTask) GetClusterName() string

Implement ClusterConfigProvider interface for TableDiffTask

func (*TableDiffTask) GetClusterNodes

func (t *TableDiffTask) GetClusterNodes() []map[string]any

func (*TableDiffTask) GetDBName

func (t *TableDiffTask) GetDBName() string

func (*TableDiffTask) GetNodeList

func (t *TableDiffTask) GetNodeList() []string

func (*TableDiffTask) GetNodes

func (t *TableDiffTask) GetNodes() string

func (*TableDiffTask) RunChecks

func (t *TableDiffTask) RunChecks(skipValidation bool) (err error)

func (*TableDiffTask) SetClusterNodes

func (t *TableDiffTask) SetClusterNodes(cn []map[string]any)

func (*TableDiffTask) SetDBName

func (t *TableDiffTask) SetDBName(name string)

func (*TableDiffTask) SetDatabase

func (t *TableDiffTask) SetDatabase(db types.Database)

func (*TableDiffTask) SetNodeList

func (t *TableDiffTask) SetNodeList(nl []string)

func (*TableDiffTask) Validate

func (t *TableDiffTask) Validate() error

Jump to

Keyboard shortcuts

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