Skip to content

Commit f2b1447

Browse files
committed
Merge remote-tracking branch 'origin/main' into K8SPXC-1214
2 parents ff96f03 + 3e65dba commit f2b1447

File tree

116 files changed

+1550
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1550
-201
lines changed

Jenkinsfile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,17 @@ void markPassedTests() {
130130
echo "Marking passed tests in the tests map!"
131131

132132
withCredentials([aws(credentialsId: 'AMI/OVF', accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY')]) {
133-
def existingArtifacts = sh(
134-
script: """
135-
aws s3 ls s3://percona-jenkins-artifactory/\$JOB_NAME/${env.GIT_SHORT_COMMIT}/ 2>/dev/null | awk '{print \$4}' || echo ''
136-
""",
137-
returnStdout: true
138-
).trim()
139-
140-
def artifactSet = existingArtifacts.split('\n').findAll { it }.toSet()
133+
sh """
134+
aws s3 ls "s3://percona-jenkins-artifactory/${JOB_NAME}/${env.GIT_SHORT_COMMIT}/" || :
135+
"""
141136

142-
for (int i = 0; i < tests.size(); i++) {
137+
for (int i=0; i<tests.size(); i++) {
143138
def testNameWithMysqlVersion = tests[i]["name"] +"-"+ tests[i]["mysql_ver"].replace(".", "-")
144-
def file = "${env.GIT_BRANCH}-${env.GIT_SHORT_COMMIT}-$testNameWithMysqlVersion"
139+
def file="${env.GIT_BRANCH}-${env.GIT_SHORT_COMMIT}-$testNameWithMysqlVersion"
140+
def retFileExists = sh(script: "aws s3api head-object --bucket percona-jenkins-artifactory --key ${JOB_NAME}/${env.GIT_SHORT_COMMIT}/${file} >/dev/null 2>&1", returnStatus: true)
145141

146-
if (artifactSet.contains(file)) {
147-
tests[i]['result'] = 'passed'
142+
if (retFileExists == 0) {
143+
tests[i]["result"] = "passed"
148144
}
149145
}
150146
}

build/proxysql-entrypoint.sh

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,42 @@ fi
124124

125125
test -e /opt/percona/hookscript/hook.sh && source /opt/percona/hookscript/hook.sh
126126

127-
exec "$@"
127+
# Start zombie reaper to clean up processes spawned by sidecars
128+
# This is needed because proxysql (PID 1) may not properly reap all child processes
129+
# The reaper runs as a background process and continuously reaps zombies
130+
(
131+
while true; do
132+
sleep 0.5
133+
# Reap any zombie processes that are children of PID 1
134+
while wait -n 2>/dev/null; do :; done
135+
done
136+
) &
137+
REAPER_PID=$!
138+
139+
# Cleanup function
140+
cleanup() {
141+
kill $REAPER_PID 2>/dev/null || true
142+
wait $REAPER_PID 2>/dev/null || true
143+
}
144+
trap cleanup EXIT TERM INT
145+
146+
# Run proxysql in foreground (not exec) so reaper can continue running
147+
# This allows the reaper to clean up zombies spawned by sidecar processes
148+
"$@" &
149+
PROXYSQL_PID=$!
150+
151+
# Forward signals to proxysql
152+
forward_signal() {
153+
kill -"$1" "$PROXYSQL_PID" 2>/dev/null || true
154+
}
155+
trap 'forward_signal TERM' TERM
156+
trap 'forward_signal INT' INT
157+
158+
# Wait for proxysql and forward its exit code
159+
wait $PROXYSQL_PID
160+
EXIT_CODE=$?
161+
162+
# Clean up reaper
163+
cleanup
164+
165+
exit $EXIT_CODE

build/proxysql.cnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ mysql_variables=
4949
ssl_p2s_cert=""
5050
ssl_p2s_key=""
5151
ssl_p2s_cipher="ECDHE-RSA-AES128-GCM-SHA256"
52+
default_authentication_plugin="caching_sha2_password"
5253
}

cmd/pitr/collector/collector.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,16 +621,30 @@ func mergeErrors(a, b error) error {
621621
return b
622622
}
623623

624+
func extractIncrementalNumber(binlogName string) (string, error) {
625+
parts := strings.Split(binlogName, ".")
626+
if len(parts) < 2 {
627+
return "", fmt.Errorf("invalid binlog name format: %s", binlogName)
628+
}
629+
return parts[len(parts)-1], nil
630+
}
631+
624632
func (c *Collector) manageBinlog(ctx context.Context, binlog pxc.Binlog) (err error) {
625633
binlogTmstmp, err := c.db.GetBinLogFirstTimestamp(ctx, binlog.Name)
626634
if err != nil {
627635
return errors.Wrapf(err, "get first timestamp for %s", binlog.Name)
628636
}
629637

630-
binlogName := fmt.Sprintf("binlog_%s_%x", binlogTmstmp, md5.Sum([]byte(binlog.GTIDSet.Raw())))
638+
incrementalNum, err := extractIncrementalNumber(binlog.Name) // extracts e.g. "000011"
639+
if err != nil {
640+
return errors.Wrapf(err, "extract incremental number from %s", binlog.Name)
641+
}
642+
643+
// Construct internal storage filename with timestamp, incremental number, and GTID md5 hash
644+
binlogName := fmt.Sprintf("binlog_%s_%s_%x", binlogTmstmp, incrementalNum, md5.Sum([]byte(binlog.GTIDSet.Raw())))
631645

632646
var setBuffer bytes.Buffer
633-
// no error handling because WriteString() always return nil error
647+
// no error handling because WriteString() always returns nil error
634648
// nolint:errcheck
635649
setBuffer.WriteString(binlog.GTIDSet.Raw())
636650

@@ -641,6 +655,7 @@ func (c *Collector) manageBinlog(ctx context.Context, binlog pxc.Binlog) (err er
641655
return errors.Wrap(err, "remove temp file")
642656
}
643657

658+
// Create named pipe with original binlog.Name
644659
err = syscall.Mkfifo(tmpDir+binlog.Name, 0o666)
645660
if err != nil {
646661
return errors.Wrap(err, "make named pipe file error")
@@ -686,6 +701,7 @@ func (c *Collector) manageBinlog(ctx context.Context, binlog pxc.Binlog) (err er
686701

687702
go readBinlog(ctx, file, pw, errBuf, binlog.Name)
688703

704+
// Use constructed binlogName for storage keys
689705
err = c.storage.PutObject(ctx, binlogName, pr, -1)
690706
if err != nil {
691707
return errors.Wrapf(err, "put %s object", binlog.Name)
@@ -703,7 +719,7 @@ func (c *Collector) manageBinlog(ctx context.Context, binlog pxc.Binlog) (err er
703719
return errors.Wrap(err, "put gtid-set object")
704720
}
705721
for _, gtidSet := range binlog.GTIDSet.List() {
706-
// no error handling because WriteString() always return nil error
722+
// no error handling because WriteString() always returns nil error
707723
// nolint:errcheck
708724
setBuffer.WriteString(binlog.GTIDSet.Raw())
709725

config/crd/bases/pxc.percona.com_perconaxtradbclusterbackups.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ spec:
163163
type: object
164164
pxcCluster:
165165
type: string
166+
runningDeadlineSeconds:
167+
format: int64
168+
type: integer
166169
startingDeadlineSeconds:
167170
format: int64
168171
type: integer

config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ spec:
124124
timeoutSeconds:
125125
type: number
126126
type: object
127+
runningDeadlineSeconds:
128+
default: 300
129+
format: int64
130+
type: integer
127131
schedule:
128132
items:
129133
properties:
@@ -1748,6 +1752,21 @@ spec:
17481752
gracePeriod:
17491753
format: int64
17501754
type: integer
1755+
healthCheck:
1756+
properties:
1757+
fall:
1758+
format: int32
1759+
minimum: 1
1760+
type: integer
1761+
interval:
1762+
format: int32
1763+
minimum: 1000
1764+
type: integer
1765+
rise:
1766+
format: int32
1767+
minimum: 1
1768+
type: integer
1769+
type: object
17511770
hookScript:
17521771
type: string
17531772
image:
@@ -4439,7 +4458,7 @@ spec:
44394458
- symbols
44404459
type: object
44414460
x-kubernetes-validations:
4442-
- rule: self.maxLength > self.minLength
4461+
- rule: self.maxLength >= self.minLength
44434462
pause:
44444463
type: boolean
44454464
platform:
@@ -8551,6 +8570,11 @@ spec:
85518570
items:
85528571
type: string
85538572
type: array
8573+
mysqlAllocator:
8574+
enum:
8575+
- jemalloc
8576+
- tcmalloc
8577+
type: string
85548578
nodeSelector:
85558579
additionalProperties:
85568580
type: string

deploy/backup/backup.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ spec:
1010
# activeDeadlineSeconds: 3600
1111
# startingDeadlineSeconds: 300
1212
# suspendedDeadlineSeconds: 1200
13+
# runningDeadlineSeconds: 300
1314
# containerOptions:
1415
# env:
1516
# - name: VERIFY_TLS

deploy/bundle.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ spec:
167167
type: object
168168
pxcCluster:
169169
type: string
170+
runningDeadlineSeconds:
171+
format: int64
172+
type: integer
170173
startingDeadlineSeconds:
171174
format: int64
172175
type: integer
@@ -1164,6 +1167,10 @@ spec:
11641167
timeoutSeconds:
11651168
type: number
11661169
type: object
1170+
runningDeadlineSeconds:
1171+
default: 300
1172+
format: int64
1173+
type: integer
11671174
schedule:
11681175
items:
11691176
properties:
@@ -2788,6 +2795,21 @@ spec:
27882795
gracePeriod:
27892796
format: int64
27902797
type: integer
2798+
healthCheck:
2799+
properties:
2800+
fall:
2801+
format: int32
2802+
minimum: 1
2803+
type: integer
2804+
interval:
2805+
format: int32
2806+
minimum: 1000
2807+
type: integer
2808+
rise:
2809+
format: int32
2810+
minimum: 1
2811+
type: integer
2812+
type: object
27912813
hookScript:
27922814
type: string
27932815
image:
@@ -5479,7 +5501,7 @@ spec:
54795501
- symbols
54805502
type: object
54815503
x-kubernetes-validations:
5482-
- rule: self.maxLength > self.minLength
5504+
- rule: self.maxLength >= self.minLength
54835505
pause:
54845506
type: boolean
54855507
platform:
@@ -9591,6 +9613,11 @@ spec:
95919613
items:
95929614
type: string
95939615
type: array
9616+
mysqlAllocator:
9617+
enum:
9618+
- jemalloc
9619+
- tcmalloc
9620+
type: string
95949621
nodeSelector:
95959622
additionalProperties:
95969623
type: string

deploy/cr.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ spec:
6363
size: 3
6464
image: perconalab/percona-xtradb-cluster-operator:main-pxc8.0
6565
autoRecovery: true
66+
# mysqlAllocator: jemalloc
6667
# expose:
6768
# enabled: true
6869
# type: LoadBalancer
@@ -304,6 +305,10 @@ spec:
304305
# rack: rack-22
305306
# loadBalancerSourceRanges:
306307
# - 10.0.0.0/8
308+
# healthCheck:
309+
# interval: 10000
310+
# rise: 1
311+
# fall: 2
307312
# runtimeClassName: image-rc
308313
# sidecars:
309314
# - image: busybox
@@ -617,6 +622,7 @@ spec:
617622
# backoffLimit: 6
618623
# activeDeadlineSeconds: 3600
619624
# startingDeadlineSeconds: 300
625+
# runningDeadlineSeconds: 300
620626
# suspendedDeadlineSeconds: 1200
621627
# serviceAccountName: percona-xtradb-cluster-operator
622628
# imagePullSecrets:

deploy/crd.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ spec:
167167
type: object
168168
pxcCluster:
169169
type: string
170+
runningDeadlineSeconds:
171+
format: int64
172+
type: integer
170173
startingDeadlineSeconds:
171174
format: int64
172175
type: integer
@@ -1164,6 +1167,10 @@ spec:
11641167
timeoutSeconds:
11651168
type: number
11661169
type: object
1170+
runningDeadlineSeconds:
1171+
default: 300
1172+
format: int64
1173+
type: integer
11671174
schedule:
11681175
items:
11691176
properties:
@@ -2788,6 +2795,21 @@ spec:
27882795
gracePeriod:
27892796
format: int64
27902797
type: integer
2798+
healthCheck:
2799+
properties:
2800+
fall:
2801+
format: int32
2802+
minimum: 1
2803+
type: integer
2804+
interval:
2805+
format: int32
2806+
minimum: 1000
2807+
type: integer
2808+
rise:
2809+
format: int32
2810+
minimum: 1
2811+
type: integer
2812+
type: object
27912813
hookScript:
27922814
type: string
27932815
image:
@@ -5479,7 +5501,7 @@ spec:
54795501
- symbols
54805502
type: object
54815503
x-kubernetes-validations:
5482-
- rule: self.maxLength > self.minLength
5504+
- rule: self.maxLength >= self.minLength
54835505
pause:
54845506
type: boolean
54855507
platform:
@@ -9591,6 +9613,11 @@ spec:
95919613
items:
95929614
type: string
95939615
type: array
9616+
mysqlAllocator:
9617+
enum:
9618+
- jemalloc
9619+
- tcmalloc
9620+
type: string
95949621
nodeSelector:
95959622
additionalProperties:
95969623
type: string

0 commit comments

Comments
 (0)