From 8f481a8c5a0d6757f296ac1ab203dff86ccacee3 Mon Sep 17 00:00:00 2001 From: Arnob Kumar Saha Date: Tue, 17 Dec 2024 18:46:56 +0600 Subject: [PATCH] Re-design WalStats field; Remove WalSegment (#142) Signed-off-by: Arnob kumar saha Signed-off-by: souravbiswassanto Signed-off-by: Anisur Rahman Co-authored-by: souravbiswassanto Co-authored-by: Anisur Rahman --- apis/storage/v1alpha1/snapshot_types.go | 34 ++++-- .../storage/v1alpha1/zz_generated.deepcopy.go | 102 +++++++++++++----- crds/storage.kubestash.com_snapshots.yaml | 48 +++++++-- 3 files changed, 136 insertions(+), 48 deletions(-) diff --git a/apis/storage/v1alpha1/snapshot_types.go b/apis/storage/v1alpha1/snapshot_types.go index 65ff51ac..c4bc5864 100644 --- a/apis/storage/v1alpha1/snapshot_types.go +++ b/apis/storage/v1alpha1/snapshot_types.go @@ -205,8 +205,32 @@ type Component struct { // VolumeSnapshotterStats specifies the "VolumeSnapshotter" driver specific information // +optional VolumeSnapshotterStats []VolumeSnapshotterStats `json:"volumeSnapshotterStats,omitempty"` - // WalSegments specifies a list of wall segment for individual component - WalSegments []WalSegment `json:"walSegments,omitempty"` + + LogStats *LogStats `json:"logStats,omitempty"` +} + +type LogStats struct { + // Start represents the start time of the first log, that exists in the repository + // TODO: Need to update this start time, once the log-retention gets implemented + Start *string `json:"start,omitempty"` + // End represents the last end time of the log push + // Start & End together holds the full time-range. Not individual log. + End *string `json:"end,omitempty"` + // Lsn for PostgreSQL only + // +optional + Lsn *string `json:"lsn,omitempty"` + + TotalFailedCount int64 `json:"totalFailedCount,omitempty"` + LastFailedStats []Log `json:"lastFailedStats,omitempty"` + + TotalSucceededCount int64 `json:"totalSucceededCount,omitempty"` + LastSucceededStats []Log `json:"lastSucceededStats,omitempty"` +} + +type Log struct { + Start *string `json:"start,omitempty"` + End *string `json:"end,omitempty"` + Error string `json:"error,omitempty"` } // ComponentPhase represents the backup phase of the individual component. @@ -283,12 +307,6 @@ type WalGStats struct { StopTime *metav1.Time `json:"stopTime,omitempty"` } -// WalSegment specifies the "WalG" driver specific information -type WalSegment struct { - Start *metav1.Time `json:"start,omitempty"` - End *metav1.Time `json:"end,omitempty"` -} - const ( TypeSnapshotMetadataUploaded = "SnapshotMetadataUploaded" ReasonFailedToUploadSnapshotMetadata = "FailedToUploadSnapshotMetadata" diff --git a/apis/storage/v1alpha1/zz_generated.deepcopy.go b/apis/storage/v1alpha1/zz_generated.deepcopy.go index 66fe44da..ff661e0a 100644 --- a/apis/storage/v1alpha1/zz_generated.deepcopy.go +++ b/apis/storage/v1alpha1/zz_generated.deepcopy.go @@ -213,12 +213,10 @@ func (in *Component) DeepCopyInto(out *Component) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.WalSegments != nil { - in, out := &in.WalSegments, &out.WalSegments - *out = make([]WalSegment, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + if in.LogStats != nil { + in, out := &in.LogStats, &out.LogStats + *out = new(LogStats) + (*in).DeepCopyInto(*out) } } @@ -298,6 +296,75 @@ func (in *LocalSpec) DeepCopy() *LocalSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Log) DeepCopyInto(out *Log) { + *out = *in + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = new(string) + **out = **in + } + if in.End != nil { + in, out := &in.End, &out.End + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Log. +func (in *Log) DeepCopy() *Log { + if in == nil { + return nil + } + out := new(Log) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LogStats) DeepCopyInto(out *LogStats) { + *out = *in + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = new(string) + **out = **in + } + if in.End != nil { + in, out := &in.End, &out.End + *out = new(string) + **out = **in + } + if in.Lsn != nil { + in, out := &in.Lsn, &out.Lsn + *out = new(string) + **out = **in + } + if in.LastFailedStats != nil { + in, out := &in.LastFailedStats, &out.LastFailedStats + *out = make([]Log, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastSucceededStats != nil { + in, out := &in.LastSucceededStats, &out.LastSucceededStats + *out = make([]Log, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogStats. +func (in *LogStats) DeepCopy() *LogStats { + if in == nil { + return nil + } + out := new(LogStats) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Repository) DeepCopyInto(out *Repository) { *out = *in @@ -805,26 +872,3 @@ func (in *WalGStats) DeepCopy() *WalGStats { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WalSegment) DeepCopyInto(out *WalSegment) { - *out = *in - if in.Start != nil { - in, out := &in.Start, &out.Start - *out = (*in).DeepCopy() - } - if in.End != nil { - in, out := &in.End, &out.End - *out = (*in).DeepCopy() - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WalSegment. -func (in *WalSegment) DeepCopy() *WalSegment { - if in == nil { - return nil - } - out := new(WalSegment) - in.DeepCopyInto(out) - return out -} diff --git a/crds/storage.kubestash.com_snapshots.yaml b/crds/storage.kubestash.com_snapshots.yaml index 1658b021..37849135 100644 --- a/crds/storage.kubestash.com_snapshots.yaml +++ b/crds/storage.kubestash.com_snapshots.yaml @@ -99,6 +99,43 @@ spec: type: string integrity: type: boolean + logStats: + properties: + end: + type: string + lastFailedStats: + items: + properties: + end: + type: string + error: + type: string + start: + type: string + type: object + type: array + lastSucceededStats: + items: + properties: + end: + type: string + error: + type: string + start: + type: string + type: object + type: array + lsn: + type: string + start: + type: string + totalFailedCount: + format: int64 + type: integer + totalSucceededCount: + format: int64 + type: integer + type: object path: type: string phase: @@ -158,17 +195,6 @@ spec: format: date-time type: string type: object - walSegments: - items: - properties: - end: - format: date-time - type: string - start: - format: date-time - type: string - type: object - type: array type: object type: object x-kubernetes-map-type: granular