Documentation
¶
Index ¶
- Constants
- Variables
- func AppendDataToTable(ctx context.Context, rel handle.Relation, bat *batch.Batch) (err error)
- func CreateRelation(_ context.Context, dbH handle.Database, name string, id uint64, ...) (err error)
- func DecodeDumpTableDir(dir string) (tid uint64, createTime time.Time, snapshotTS types.TS, err error)
- func GCDumpTableFiles(filePath string, fs fileservice.FileService) (neesGC bool, err error)
- func GenerateManifest(table *catalog.TableEntry, dataDir string) ([]byte, error)
- func GenerateManifestForTxn(table *catalog.TableEntry, txn *txnbase.TxnMVCCNode, dataDir string) ([]byte, error)
- func GenerateManifestPretty(table *catalog.TableEntry, dataDir string) ([]byte, error)
- func GetDumpTableDir(tid uint64, snapshotTS types.TS) string
- func GetHideKeysOfTable(rel handle.Relation) ([]*engine.Attribute, error)
- func MockInspectContext(db *db.DB) *inspectContext
- func NewObjectListBatch() *batch.Batch
- func OutputLayerZeroStats(out *bytes.Buffer, tbl *catalog.TableEntry, statsList []*objectio.ObjectStats, ...)
- func OutputOverlapStats(out *bytes.Buffer, statsList []*objectio.ObjectStats, opts *merge.OverlapOpts)
- func OutputVacuumStats(out *bytes.Buffer, tbl catalog.MergeTable, opts *merge.VacuumOpts)
- func RegisterManifestHTTP(d *db.DB)
- func RunFactory[T InspectCmd](t T) func(cmd *cobra.Command, args []string)
- func RunInspect(ctx context.Context, inspectCtx *inspectContext)
- func TableDefs(rel handle.Relation) ([]engine.TableDef, error)
- func TableNamesOfDB(db handle.Database) ([]string, error)
- type ApplyTableDataArg
- type BlockJson
- type CkpEntries
- type CkpEntry
- type CkpTableRange
- type ColumnJson
- type DumpTableArg
- type GCArg
- type Handle
- func (h *Handle) GetDB() *db.DB
- func (h *Handle) HandleAddFaultPoint(ctx context.Context, meta txn.TxnMeta, req *cmd_util.FaultPoint, ...) (func(), error)
- func (h *Handle) HandleAlterTable(ctx context.Context, txn txnif.AsyncTxn, req *api.AlterTableReq) (err error)
- func (h *Handle) HandleBackup(ctx context.Context, meta txn.TxnMeta, req *cmd_util.Checkpoint, ...) (cb func(), err error)
- func (h *Handle) HandleClose(ctx context.Context) (err error)
- func (h *Handle) HandleCommit(ctx context.Context, meta txn.TxnMeta, response *txn.TxnResponse, ...) (cts timestamp.Timestamp, err error)
- func (h *Handle) HandleCommitMerge(ctx context.Context, meta txn.TxnMeta, req *api.MergeCommitEntry, ...) (err error)
- func (h *Handle) HandleCommitting(ctx context.Context, meta txn.TxnMeta) (err error)
- func (h *Handle) HandleCreateDatabase(ctx context.Context, txn txnif.AsyncTxn, req *pkgcatalog.CreateDatabaseReq) (err error)
- func (h *Handle) HandleCreateRelation(ctx context.Context, txn txnif.AsyncTxn, req *pkgcatalog.CreateTableReq) error
- func (h *Handle) HandleDestroy(ctx context.Context) (err error)
- func (h *Handle) HandleDiskCleaner(ctx context.Context, meta txn.TxnMeta, req *cmd_util.DiskCleaner, ...) (cb func(), err error)
- func (h *Handle) HandleDropDatabase(ctx context.Context, txn txnif.AsyncTxn, req *pkgcatalog.DropDatabaseReq) (err error)
- func (h *Handle) HandleDropRelation(ctx context.Context, txn txnif.AsyncTxn, req *pkgcatalog.DropTableReq) error
- func (h *Handle) HandleFaultInject(ctx context.Context, meta txn.TxnMeta, req *cmd_util.FaultInjectReq, ...) (cb func(), err error)
- func (h *Handle) HandleFlushTable(ctx context.Context, meta txn.TxnMeta, req *cmd_util.FlushTable, ...) (cb func(), err error)
- func (h *Handle) HandleForceCheckpoint(ctx context.Context, meta txn.TxnMeta, req *cmd_util.Checkpoint, ...) (cb func(), err error)
- func (h *Handle) HandleForceGlobalCheckpoint(ctx context.Context, meta txn.TxnMeta, req *cmd_util.Checkpoint, ...) (cb func(), err error)
- func (h *Handle) HandleGetChangedTableList(ctx context.Context, meta txn.TxnMeta, req *cmd_util.GetChangedTableListReq, ...) (func(), error)
- func (h *Handle) HandleGetLatestCheckpoint(_ context.Context, _ txn.TxnMeta, _ *cmd_util.Checkpoint, ...) (cb func(), err error)
- func (h *Handle) HandleGetLogTail(ctx context.Context, meta txn.TxnMeta, req *api.SyncLogTailReq, ...) (closeCB func(), err error)
- func (h *Handle) HandleInspectTN(ctx context.Context, meta txn.TxnMeta, req *cmd_util.InspectTN, ...) (cb func(), err error)
- func (h *Handle) HandleInterceptCommit(ctx context.Context, meta txn.TxnMeta, req *cmd_util.InterceptCommit, ...) (cb func(), err error)
- func (h *Handle) HandlePreCommitWrite(ctx context.Context, meta txn.TxnMeta, req *api.PrecommitWriteCmd, ...) (err error)
- func (h *Handle) HandlePrepare(ctx context.Context, meta txn.TxnMeta) (pts timestamp.Timestamp, err error)
- func (h *Handle) HandleRollback(ctx context.Context, meta txn.TxnMeta) (err error)
- func (h *Handle) HandleSnapshotRead(ctx context.Context, meta txn.TxnMeta, req *cmd_util.SnapshotReadReq, ...) (func(), error)
- func (h *Handle) HandleSoftDeleteObject(ctx context.Context, txn txnif.AsyncTxn, req *cmd_util.WriteReq) error
- func (h *Handle) HandleStartRecovery(ctx context.Context, ch chan txn.TxnMeta)
- func (h *Handle) HandleStorageUsage(ctx context.Context, meta txn.TxnMeta, req *cmd_util.StorageUsageReq, ...) (func(), error)
- func (h *Handle) HandleTraceSpan(ctx context.Context, meta txn.TxnMeta, req *cmd_util.TraceSpan, ...) (func(), error)
- func (h *Handle) HandleWrite(ctx context.Context, txn txnif.AsyncTxn, req *cmd_util.WriteReq) (inMemoryInsertRows int, persistedMemoryInsertRows int, ...)
- func (h *Handle) IsInterceptTable(name string) bool
- func (h *Handle) UpdateInterceptMatchRegexp(name string)
- type InspectCmd
- type Manifest
- type ManifestColumn
- type ManifestObject
- type ManifestStats
- type MoInspectArg
- type ObjArg
- type ObjectJson
- type PolicyStatus
- type TableArg
- type TableIds
Constants ¶
const ( DumpTableObjectList = "object_list" DumpTableSchema = "schema" DumpTableTable = "table" )
const ( ObjectListAttr_ObjectType = "object_type" ObjectListAttr_ID = "id" ObjectListAttr_CreateTS = "create_ts" ObjectListAttr_DeleteTS = "delete_ts" ObjectListAttr_IsPersisted = "is_persisted" )
const ( ObjectListAttr_ObjectType_Idx = iota ObjectListAttr_ID_Idx ObjectListAttr_CreateTS_Idx ObjectListAttr_DeleteTS_Idx ObjectListAttr_IsPersisted_Idx )
const ( MAX_ALLOWED_TXN_LATENCY = time.Millisecond * 300 MAX_TXN_COMMIT_LATENCY = time.Minute * 2 )
const AllowPruneDuration = 24 * time.Hour
const (
DefaultTimeout = time.Minute * 3 / 2
)
const (
DumpTableDir = "dumpTable"
)
const (
DumpTableFileTTL = time.Hour * 24 * 30
)
Variables ¶
var MaxBlks = regexp.MustCompile(`blks:(\d+)`)
var MaxRows = regexp.MustCompile(`rows:(\d+)`)
var ObjectListAttrs = []string{ ObjectListAttr_ObjectType, ObjectListAttr_ID, ObjectListAttr_CreateTS, ObjectListAttr_DeleteTS, ObjectListAttr_IsPersisted, }
var ObjectListSeqnums = []uint16{0, 1, 2, 3, 4}
var ObjectListTypes = []types.Type{ types.T_int8.ToType(), types.T_varchar.ToType(), types.T_TS.ToType(), types.T_TS.ToType(), types.T_bool.ToType(), }
var PrettyJson = jsoniter.ConfigCompatibleWithStandardLibrary
var TaskCache = &objsPruneTask{ memos: make(map[int]pruneTask), }
Functions ¶
func AppendDataToTable ¶ added in v0.8.0
func CreateRelation ¶ added in v0.8.0
func DecodeDumpTableDir ¶
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 GetHideKeysOfTable ¶ added in v0.8.0
func MockInspectContext ¶
func NewObjectListBatch ¶
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 ¶
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
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 ¶
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 Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
func NewTAEHandle ¶
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 (*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) 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 (*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) 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 (*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 (*Handle) HandleRollback ¶
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 (*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 (*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 (*Handle) UpdateInterceptMatchRegexp ¶ added in v1.2.0
type InspectCmd ¶ added in v1.0.0
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 ManifestObject ¶
type ManifestStats ¶
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 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