rpc

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DumpTableObjectList = "object_list"
	DumpTableSchema     = "schema"
	DumpTableTable      = "table"
)
View Source
const (
	ObjectListAttr_ObjectType  = "object_type"
	ObjectListAttr_ID          = "id"
	ObjectListAttr_CreateTS    = "create_ts"
	ObjectListAttr_DeleteTS    = "delete_ts"
	ObjectListAttr_IsPersisted = "is_persisted"
)
View Source
const (
	ObjectListAttr_ObjectType_Idx = iota
	ObjectListAttr_ID_Idx
	ObjectListAttr_CreateTS_Idx
	ObjectListAttr_DeleteTS_Idx
	ObjectListAttr_IsPersisted_Idx
)
View Source
const (
	MAX_ALLOWED_TXN_LATENCY = time.Millisecond * 300
	MAX_TXN_COMMIT_LATENCY  = time.Minute * 2
)
View Source
const AllowPruneDuration = 24 * time.Hour
View Source
const (
	DefaultTimeout = time.Minute * 3 / 2
)
View Source
const (
	DumpTableDir = "dumpTable"
)
View Source
const (
	DumpTableFileTTL = time.Hour * 24 * 30
)

Variables

View Source
var MaxBlks = regexp.MustCompile(`blks:(\d+)`)
View Source
var MaxRows = regexp.MustCompile(`rows:(\d+)`)
View Source
var ObjectListSeqnums = []uint16{0, 1, 2, 3, 4}
View Source
var ObjectListTypes = []types.Type{
	types.T_int8.ToType(),
	types.T_varchar.ToType(),
	types.T_TS.ToType(),
	types.T_TS.ToType(),
	types.T_bool.ToType(),
}
View Source
var TaskCache = &objsPruneTask{
	memos: make(map[int]pruneTask),
}

Functions

func AppendDataToTable added in v0.8.0

func AppendDataToTable(ctx context.Context, rel handle.Relation, bat *batch.Batch) (err error)

func CreateRelation added in v0.8.0

func CreateRelation(
	_ context.Context,
	dbH handle.Database,
	name string,
	id uint64,
	defs []engine.TableDef) (err error)

func DecodeDumpTableDir

func DecodeDumpTableDir(dir string) (tid uint64, createTime time.Time, snapshotTS types.TS, err error)

func GCDumpTableFiles

func GCDumpTableFiles(filePath string, fs fileservice.FileService) (neesGC bool, err error)

func GenerateManifest

func GenerateManifest(table *catalog.TableEntry, dataDir string) ([]byte, error)

GenerateManifest serializes a table's catalog state into a manifest JSON that the DuckDB TAE scanner can read. It uses the current catalog snapshot (all committed objects visible now) without requiring a user transaction.

dataDir is the base directory where .tae object files are stored (e.g., the fileservice shared path).

func GenerateManifestForTxn

func GenerateManifestForTxn(
	table *catalog.TableEntry,
	txn *txnbase.TxnMVCCNode,
	dataDir string,
) ([]byte, error)

GenerateManifestForTxn currently behaves the same as GenerateManifest. The provided transaction is accepted for API compatibility but is NOT used to determine object visibility — this always uses the latest committed snapshot. MVCC-bound visibility is not yet implemented.

func GenerateManifestPretty

func GenerateManifestPretty(table *catalog.TableEntry, dataDir string) ([]byte, error)

GenerateManifestPretty is like GenerateManifest but produces indented JSON.

func GetDumpTableDir

func GetDumpTableDir(tid uint64, snapshotTS types.TS) string

func GetHideKeysOfTable added in v0.8.0

func GetHideKeysOfTable(rel handle.Relation) ([]*engine.Attribute, error)

func MockInspectContext

func MockInspectContext(db *db.DB) *inspectContext

func NewObjectListBatch

func NewObjectListBatch() *batch.Batch

func OutputLayerZeroStats

func OutputLayerZeroStats(
	out *bytes.Buffer,
	tbl *catalog.TableEntry,
	statsList []*objectio.ObjectStats,
	opts *merge.LayerZeroOpts,
)

func OutputOverlapStats

func OutputOverlapStats(
	out *bytes.Buffer,
	statsList []*objectio.ObjectStats,
	opts *merge.OverlapOpts,
)

func OutputVacuumStats

func OutputVacuumStats(
	out *bytes.Buffer,
	tbl catalog.MergeTable,
	opts *merge.VacuumOpts,
)

func RegisterManifestHTTP

func RegisterManifestHTTP(d *db.DB)

RegisterManifestHTTP registers /debug/tae/manifest on the default HTTP mux. The endpoint is served by the debug HTTP server (-debug-http flag). Safe to call multiple times; the handler is registered only once.

Usage:

GET /debug/tae/manifest?table=db.table

Returns the DuckDB TAE scanner manifest as JSON.

func RunFactory added in v1.0.0

func RunFactory[T InspectCmd](t T) func(cmd *cobra.Command, args []string)

func RunInspect added in v0.7.0

func RunInspect(ctx context.Context, inspectCtx *inspectContext)

func TableDefs added in v0.8.0

func TableDefs(rel handle.Relation) ([]engine.TableDef, error)

func TableNamesOfDB added in v0.8.0

func TableNamesOfDB(db handle.Database) ([]string, error)

Types

type ApplyTableDataArg

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

func NewApplyTableDataArg

func NewApplyTableDataArg(
	ctx context.Context,
	dir string,
	inspectContext *inspectContext,
	dbName string,
	tableName string,
	mp *mpool.MPool,
	fs fileservice.FileService,
) (*ApplyTableDataArg, error)

func (*ApplyTableDataArg) FromCommand

func (a *ApplyTableDataArg) FromCommand(cmd *cobra.Command) (err error)

func (*ApplyTableDataArg) PrepareCommand

func (a *ApplyTableDataArg) PrepareCommand() *cobra.Command

func (*ApplyTableDataArg) Run

func (a *ApplyTableDataArg) Run() (err error)

func (*ApplyTableDataArg) String

func (a *ApplyTableDataArg) String() string

func (*ApplyTableDataArg) Usage

func (a *ApplyTableDataArg) Usage() (res string)

type BlockJson

type BlockJson struct {
	Index   uint16       `json:"block_index"`
	Rows    uint32       `json:"row_count,omitempty"`
	Cols    uint16       `json:"column_count,omitempty"`
	Columns []ColumnJson `json:"columns,omitempty"`
}

type CkpEntries

type CkpEntries struct {
	Count   int        `json:"count"`
	Entries []CkpEntry `json:"entries"`
}

func NewCkpEntries

func NewCkpEntries(
	capacity int,
) *CkpEntries

func (*CkpEntries) Add

func (c *CkpEntries) Add(entry *checkpoint.CheckpointEntry)

func (*CkpEntries) ToJson

func (c *CkpEntries) ToJson() (string, error)

type CkpEntry

type CkpEntry struct {
	*checkpoint.CheckpointEntry
	Index int      `json:"index"`
	Table []uint64 `json:"table,omitempty"`
}

type CkpTableRange

type CkpTableRange struct {
	Entry  *checkpoint.CheckpointEntry
	Ranges []ckputil.TableRange
}

type ColumnJson

type ColumnJson struct {
	Index       uint16 `json:"col_index"`
	Ndv         uint32 `json:"ndv,omitempty"`
	NullCnt     uint32 `json:"null_count,omitempty"`
	DataSize    string `json:"data_size,omitempty"`
	OriDataSize string `json:"original_data_size,omitempty"`
	Zonemap     string `json:"zonemap,omitempty"`
	Data        string `json:"data,omitempty"`
	DataType    string `json:"data_type,omitempty"`
}

type DumpTableArg

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

func NewDumpTableArg

func NewDumpTableArg(
	ctx context.Context,
	table *catalog.TableEntry,
	dir string,
	inspectContext *inspectContext,
	mp *mpool.MPool,
	fs fileservice.FileService,
) *DumpTableArg

for UT

func (*DumpTableArg) FromCommand

func (c *DumpTableArg) FromCommand(cmd *cobra.Command) (err error)

func (*DumpTableArg) PrepareCommand

func (c *DumpTableArg) PrepareCommand() *cobra.Command

func (*DumpTableArg) Run

func (c *DumpTableArg) Run() (err error)

func (*DumpTableArg) String

func (c *DumpTableArg) String() string

func (*DumpTableArg) Usage

func (c *DumpTableArg) Usage() (res string)

type GCArg

type GCArg struct {
}

func (*GCArg) FromCommand

func (c *GCArg) FromCommand(cmd *cobra.Command) (err error)

func (*GCArg) PrepareCommand

func (c *GCArg) PrepareCommand() *cobra.Command

func (*GCArg) Run

func (c *GCArg) Run() error

func (*GCArg) String

func (c *GCArg) String() string

func (*GCArg) Usage

func (c *GCArg) Usage() (res string)

type Handle

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

func NewTAEHandle

func NewTAEHandle(ctx context.Context, path string, client client.QueryClient, opt *options.Options) *Handle

func (*Handle) GetDB added in v0.8.0

func (h *Handle) GetDB() *db.DB

func (*Handle) HandleAddFaultPoint added in v1.0.0

func (h *Handle) HandleAddFaultPoint(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.FaultPoint,
	resp *api.SyncLogTailResp) (func(), error)

func (*Handle) HandleAlterTable added in v0.8.0

func (h *Handle) HandleAlterTable(
	ctx context.Context,
	txn txnif.AsyncTxn,
	req *api.AlterTableReq,
) (err error)

func (*Handle) HandleBackup added in v1.0.0

func (h *Handle) HandleBackup(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.Checkpoint,
	resp *api.SyncLogTailResp,
) (cb func(), err error)

func (*Handle) HandleClose

func (h *Handle) HandleClose(ctx context.Context) (err error)

func (*Handle) HandleCommit

func (h *Handle) HandleCommit(
	ctx context.Context,
	meta txn.TxnMeta,
	response *txn.TxnResponse,
	commitRequests *txn.TxnCommitRequest,
) (cts timestamp.Timestamp, err error)

HandlePreCommitWrite impls TxnStorage:Commit

func (*Handle) HandleCommitMerge added in v1.2.0

func (h *Handle) HandleCommitMerge(
	ctx context.Context,
	meta txn.TxnMeta,
	req *api.MergeCommitEntry,
	resp *api.TNStringResponse,
) (err error)

func (*Handle) HandleCommitting

func (h *Handle) HandleCommitting(
	ctx context.Context,
	meta txn.TxnMeta) (err error)

func (*Handle) HandleCreateDatabase

func (h *Handle) HandleCreateDatabase(
	ctx context.Context,
	txn txnif.AsyncTxn,
	req *pkgcatalog.CreateDatabaseReq) (err error)

func (*Handle) HandleCreateRelation

func (h *Handle) HandleCreateRelation(
	ctx context.Context,
	txn txnif.AsyncTxn,
	req *pkgcatalog.CreateTableReq,
) error

func (*Handle) HandleDestroy

func (h *Handle) HandleDestroy(ctx context.Context) (err error)

func (*Handle) HandleDiskCleaner added in v1.2.1

func (h *Handle) HandleDiskCleaner(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.DiskCleaner,
	resp *api.TNStringResponse,
) (cb func(), err error)

func (*Handle) HandleDropDatabase

func (h *Handle) HandleDropDatabase(
	ctx context.Context,
	txn txnif.AsyncTxn,
	req *pkgcatalog.DropDatabaseReq,
) (err error)

func (*Handle) HandleDropRelation

func (h *Handle) HandleDropRelation(
	ctx context.Context,
	txn txnif.AsyncTxn,
	req *pkgcatalog.DropTableReq,
) error

func (*Handle) HandleFaultInject

func (h *Handle) HandleFaultInject(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.FaultInjectReq,
	resp *api.TNStringResponse,
) (cb func(), err error)

func (*Handle) HandleFlushTable

func (h *Handle) HandleFlushTable(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.FlushTable,
	resp *api.SyncLogTailResp,
) (cb func(), err error)

func (*Handle) HandleForceCheckpoint added in v0.7.0

func (h *Handle) HandleForceCheckpoint(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.Checkpoint,
	resp *api.SyncLogTailResp,
) (cb func(), err error)

func (*Handle) HandleForceGlobalCheckpoint added in v1.1.2

func (h *Handle) HandleForceGlobalCheckpoint(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.Checkpoint,
	resp *api.SyncLogTailResp,
) (cb func(), err error)

func (*Handle) HandleGetChangedTableList

func (h *Handle) HandleGetChangedTableList(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.GetChangedTableListReq,
	resp *cmd_util.GetChangedTableListResp,
) (func(), error)

func (*Handle) HandleGetLatestCheckpoint

func (h *Handle) HandleGetLatestCheckpoint(
	_ context.Context,
	_ txn.TxnMeta,
	_ *cmd_util.Checkpoint,
	resp *api.CheckpointResp,
) (cb func(), err error)

func (*Handle) HandleGetLogTail

func (h *Handle) HandleGetLogTail(
	ctx context.Context,
	meta txn.TxnMeta,
	req *api.SyncLogTailReq,
	resp *api.SyncLogTailResp) (closeCB func(), err error)

HandleGetLogTail impls TxnStorage:Read

func (*Handle) HandleInspectTN added in v1.0.0

func (h *Handle) HandleInspectTN(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.InspectTN,
	resp *cmd_util.InspectResp) (cb func(), err error)

func (*Handle) HandleInterceptCommit added in v1.2.0

func (h *Handle) HandleInterceptCommit(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.InterceptCommit,
	resp *api.SyncLogTailResp) (cb func(), err error)

func (*Handle) HandlePreCommitWrite

func (h *Handle) HandlePreCommitWrite(
	ctx context.Context,
	meta txn.TxnMeta,
	req *api.PrecommitWriteCmd,
	_ *api.TNStringResponse) (err error)

HandlePreCommitWrite impls TxnStorage:Write Deprecated: This method is no longer used in production. The new commit flow uses HandleCommit with TxnCommitRequest directly. This is kept only for interface compatibility.

func (*Handle) HandlePrepare

func (h *Handle) HandlePrepare(
	ctx context.Context,
	meta txn.TxnMeta) (pts timestamp.Timestamp, err error)

func (*Handle) HandleRollback

func (h *Handle) HandleRollback(
	ctx context.Context,
	meta txn.TxnMeta) (err error)

func (*Handle) HandleSnapshotRead

func (h *Handle) HandleSnapshotRead(
	ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.SnapshotReadReq,
	resp *cmd_util.SnapshotReadResp,
) (func(), error)

func (*Handle) HandleSoftDeleteObject

func (h *Handle) HandleSoftDeleteObject(
	ctx context.Context,
	txn txnif.AsyncTxn,
	req *cmd_util.WriteReq,
) error

HandleSoftDeleteObject handles soft delete object request It sets the object's deleteat timestamp to the transaction's commit timestamp Similar to merge's soft delete mechanism

func (*Handle) HandleStartRecovery

func (h *Handle) HandleStartRecovery(
	ctx context.Context,
	ch chan txn.TxnMeta)

func (*Handle) HandleStorageUsage added in v1.0.1

func (h *Handle) HandleStorageUsage(ctx context.Context, meta txn.TxnMeta,
	req *cmd_util.StorageUsageReq, resp *cmd_util.StorageUsageResp_V3) (func(), error)

func (*Handle) HandleTraceSpan added in v1.0.0

func (h *Handle) HandleTraceSpan(ctx context.Context,
	meta txn.TxnMeta,
	req *cmd_util.TraceSpan,
	resp *api.SyncLogTailResp) (func(), error)

func (*Handle) HandleWrite

func (h *Handle) HandleWrite(
	ctx context.Context,
	txn txnif.AsyncTxn,
	req *cmd_util.WriteReq,
) (
	inMemoryInsertRows int,
	persistedMemoryInsertRows int,
	inMemoryTombstoneRows int,
	persistedTombstoneRows int,
	postFunc []func(),
	err error,
)

HandleWrite Handle DML commands

func (*Handle) IsInterceptTable added in v1.2.0

func (h *Handle) IsInterceptTable(name string) bool

func (*Handle) UpdateInterceptMatchRegexp added in v1.2.0

func (h *Handle) UpdateInterceptMatchRegexp(name string)

type InspectCmd added in v1.0.0

type InspectCmd interface {
	FromCommand(cmd *cobra.Command) error
	String() string
	Run() error
}

type Manifest

type Manifest struct {
	Version    int              `json:"version"`
	Database   string           `json:"database"`
	Table      string           `json:"table"`
	DataDir    string           `json:"data_dir"`
	SortColumn string           `json:"sort_column,omitempty"`
	Columns    []ManifestColumn `json:"columns"`
	Objects    []ManifestObject `json:"objects"`
	Stats      *ManifestStats   `json:"stats,omitempty"`
}

Manifest is the JSON structure consumed by the DuckDB TAE scanner extension. See duckdb_tae_scanner/DESIGN.md §13.3 for the full specification.

type ManifestColumn

type ManifestColumn struct {
	Name  string `json:"name"`
	OID   int    `json:"oid"`
	Width int    `json:"width,omitempty"`
	Scale int    `json:"scale,omitempty"`
}

type ManifestObject

type ManifestObject struct {
	Path       string `json:"path"`
	Rows       int64  `json:"rows"`
	Blocks     int64  `json:"blocks"`
	Size       uint64 `json:"size,omitempty"`
	OriginSize uint64 `json:"origin_size,omitempty"`
	ZoneMap    string `json:"zone_map,omitempty"`
}

type ManifestStats

type ManifestStats struct {
	TotalRows    int64  `json:"total_rows"`
	TotalObjects int    `json:"total_objects"`
	TotalSize    uint64 `json:"total_origin_size"`
}

type MoInspectArg

type MoInspectArg struct {
}

func (*MoInspectArg) FromCommand

func (c *MoInspectArg) FromCommand(cmd *cobra.Command) (err error)

func (*MoInspectArg) PrepareCommand

func (c *MoInspectArg) PrepareCommand() *cobra.Command

func (*MoInspectArg) Run

func (c *MoInspectArg) Run() (err error)

func (*MoInspectArg) String

func (c *MoInspectArg) String() string

func (*MoInspectArg) Usage

func (c *MoInspectArg) Usage() (res string)

type ObjArg

type ObjArg struct {
}

func (*ObjArg) FromCommand

func (c *ObjArg) FromCommand(cmd *cobra.Command) (err error)

func (*ObjArg) PrepareCommand

func (c *ObjArg) PrepareCommand() *cobra.Command

func (*ObjArg) Run

func (c *ObjArg) Run() (err error)

func (*ObjArg) String

func (c *ObjArg) String() string

func (*ObjArg) Usage

func (c *ObjArg) Usage() (res string)

type ObjectJson

type ObjectJson struct {
	Name        string       `json:"name"`
	Rows        uint32       `json:"row_count,omitempty"`
	Cols        uint16       `json:"column_count,omitempty"`
	BlkCnt      uint32       `json:"block_count,omitempty"`
	MetaSize    string       `json:"meta_size,omitempty"`
	OriMetaSize string       `json:"original_meta_size,omitempty"`
	DataSize    string       `json:"data_size,omitempty"`
	OriDataSize string       `json:"original_data_size,omitempty"`
	Zonemap     string       `json:"zonemap,omitempty"`
	Columns     []ColumnJson `json:"columns,omitempty"`
	Blocks      []BlockJson  `json:"blocks,omitempty"`
}

type PolicyStatus added in v1.2.0

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

func (*PolicyStatus) FromCommand added in v1.2.0

func (c *PolicyStatus) FromCommand(cmd *cobra.Command) (err error)

func (*PolicyStatus) PrepareCommand added in v1.2.0

func (c *PolicyStatus) PrepareCommand() *cobra.Command

func (*PolicyStatus) Run added in v1.2.0

func (c *PolicyStatus) Run() (err error)

func (*PolicyStatus) String added in v1.2.0

func (c *PolicyStatus) String() string

type TableArg

type TableArg struct {
}

func (*TableArg) FromCommand

func (c *TableArg) FromCommand(cmd *cobra.Command) (err error)

func (*TableArg) PrepareCommand

func (c *TableArg) PrepareCommand() *cobra.Command

func (*TableArg) Run

func (c *TableArg) Run() error

func (*TableArg) String

func (c *TableArg) String() string

func (*TableArg) Usage

func (c *TableArg) Usage() (res string)

type TableIds

type TableIds struct {
	TableCnt int      `json:"table_count"`
	Ids      []uint64 `json:"tables"`
}

Jump to

Keyboard shortcuts

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