Documentation ¶
Index ¶
- Constants
- func Merge(metadata LogMetadata) [][]string
- func RunLogReplication(ctx context.Context, dbdClient dbdpb.DatabaseDaemonClient, dest string, ...) error
- func RunLogRetention(ctx context.Context, retentionDays int, metadataStore *SimpleStore, ...) error
- func RunMetadataUpdate(ctx context.Context, dbdClient dbdpb.DatabaseDaemonClient, ...) error
- func SetArchiveLag(ctx context.Context, dbdClient dbdpb.DatabaseDaemonClient) error
- func StageLogs(ctx context.Context, destDir string, include func(entry LogMetadataEntry) bool, ...) error
- type LogHashEntry
- type LogMetadata
- type LogMetadataEntry
- type SimpleStore
Constants ¶
const (
// MetadataStorePath is the path to log metadata catalog.
MetadataStorePath = "catalog"
)
Variables ¶
This section is empty.
Functions ¶
func Merge ¶
func Merge(metadata LogMetadata) [][]string
Merge reads all metadata and merge time ranges covered by replicated redo logs.
func RunLogReplication ¶
func RunLogReplication(ctx context.Context, dbdClient dbdpb.DatabaseDaemonClient, dest string, hashStore *SimpleStore) error
RunLogReplication starts redo logs replication. It runs below steps repeatedly Read archived redo logs location with dbdClient at very beginning or after a success sync., sync redo logs to dest specified location.
func RunLogRetention ¶
func RunLogRetention(ctx context.Context, retentionDays int, metadataStore *SimpleStore, hashStore *SimpleStore) error
RunLogRetention starts redo logs cleanup.
func RunMetadataUpdate ¶
func RunMetadataUpdate(ctx context.Context, dbdClient dbdpb.DatabaseDaemonClient, hashStore *SimpleStore, metadataStore *SimpleStore) error
RunMetadataUpdate starts metadata update. It runs below steps repeatedly Read archived redo logs view with dbdClient, cumulatively update log metadata into metaStore.
func SetArchiveLag ¶
func SetArchiveLag(ctx context.Context, dbdClient dbdpb.DatabaseDaemonClient) error
SetArchiveLag sets archive lag target parameter in the database if the value is 0.
Types ¶
type LogHashEntry ¶
type LogHashEntry struct { // Crc32cHash stores the crc32c hash of a redo log. Crc32cHash string // ReplicaPath stores the path of a replicated redo log. ReplicaPath string // ModTime stores the mod time of a redo log after replication. ModTime time.Time }
LogHashEntry stores hash information for a redo log.
type LogMetadata ¶
type LogMetadata struct { // KeyToLogEntry stores redo logs information in a map. // key is used for deduplicate KeyToLogEntry map[string]LogMetadataEntry }
LogMetadata stores metadata information for redo logs.
type LogMetadataEntry ¶
type LogMetadataEntry struct { // LogHashEntry stores hash information for a redo log. LogHashEntry // SrcPath stores the path of a redo log in original environment. SrcPath string // FirstChange stores the first SCN(inclusive) of a redo log. FirstChange string // SCN inclusive // NextChange stores the next SCN(exclusive) of a redo log. NextChange string // FirstChange stores the first timestamp (inclusive) of a redo log. // we used TO_CHAR(DATE, 'YYYY-MM-DD"T"HH24:MI:SS"Z"') FirstTime time.Time // NextTime stores the next timestamp (inclusive) of a redo log. // we used TO_CHAR(DATE, 'YYYY-MM-DD"T"HH24:MI:SS"Z"') NextTime time.Time // CompletionTime stores the timestamp when a redo log was archived. CompletionTime string // Sequence stores the sequence of a archived redo log. Sequence string // Incarnation stores the Incarnation of a archived redo log. Incarnation string // Thread stores the redo thread number Thread string }
LogMetadataEntry stores metadata information for a redo log.
type SimpleStore ¶
SimpleStore implements a simple data store to read and write golang objects.
func NewSimpleStore ¶
func NewSimpleStore(ctx context.Context, dataDir string) (*SimpleStore, error)
NewSimpleStore returns a SimpleStore, SimpleStore will store data under the specified dataDir. '/' will be appended to the dataDir if it does not end with '/'
func (*SimpleStore) Close ¶
func (s *SimpleStore) Close(ctx context.Context) error
Close closes the storage client of the store.
func (*SimpleStore) Read ¶
func (s *SimpleStore) Read(ctx context.Context, path string, data interface{}) (retErr error)
Read retrieves a golang object from this SimpleStore and decode it into data. This method is unsafe for concurrent use. It's caller's responsibility to call SimpleStore.Lock()/SimpleStore.UnLock() for synchronization between goroutines.