Documentation
¶
Index ¶
- func DetectBlockedTransactions(db *bun.DB) []string
- type Block
- type BlockedTransaction
- type DeadlockInfo
- type File
- type IndexInfo
- type LockInfo
- type LockReportFormatter
- type LongTransaction
- type Model
- type ObjectConflict
- type Parameter
- type Project
- type ReportData
- type ReportSummary
- type RowLockInfo
- type TestDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectBlockedTransactions ¶
DetectBlockedTransactions detects blocked transactions in real-time
Types ¶
type BlockedTransaction ¶
BlockedTransaction contains information about a blocked transaction
type DeadlockInfo ¶
type DeadlockInfo struct {
Transaction1 LockInfo
Transaction2 LockInfo
ConflictType string
Recommendation string
}
DeadlockInfo contains information about a potential deadlock
type LockInfo ¶
type LockInfo struct {
PID int
Mode string
Granted bool
ObjectType string
ObjectName string
Page string
Tuple string
VirtualXID string
TransactionID string
WaitTime time.Duration
Query string
Type string
Object string
}
LockInfo contains detailed information about a lock
type LockReportFormatter ¶
type LockReportFormatter interface {
Format(data *ReportData, output io.Writer) error
GetFileExtension() string
}
LockReportFormatter defines the interface for report formatters
type LongTransaction ¶
LongTransaction contains information about a long transaction
type ObjectConflict ¶
ObjectConflict contains information about an object conflict
type Parameter ¶
type Parameter struct {
bun.BaseModel `bun:"table:parameters"`
ID string `bun:",pk,type:uuid,default:gen_random_uuid()"`
BlockID string `bun:",type:uuid,notnull,on_delete:CASCADE"`
Block *Block `bun:"rel:belongs-to,join:block_id=id"`
Key string `bun:",column:key"`
FileID string `bun:",type:uuid,notnull,on_delete:CASCADE"`
File *File `bun:"rel:belongs-to,join:file_id=id"`
}
type ReportData ¶
type ReportData struct {
Timestamp time.Time
Locks []LockInfo
RowLocks []RowLockInfo
Deadlocks []DeadlockInfo
BlockedTxns []BlockedTransaction
LongTxns []LongTransaction
ObjectConflicts []ObjectConflict
IndexAnalysis []IndexInfo
Suggestions []string
Summary ReportSummary
}
ReportData contains all data needed to generate a report
func GenerateLocksReport ¶
func GenerateLocksReport(db *bun.DB) (*ReportData, error)
GenerateLocksReport generates a complete locks report and returns the data
type ReportSummary ¶
type ReportSummary struct {
TotalLocks int
BlockedTxns int
LongTxns int
Deadlocks int
ObjectConflicts int
CriticalIssues int
Warnings int
Recommendations int
}
ReportSummary contains a summary of detected issues
type RowLockInfo ¶
RowLockInfo contains information about row locks