Skip to content

Commit e1e82ef

Browse files
authored
Remove GC logging configuration (#801)
1 parent d65a844 commit e1e82ef

File tree

9 files changed

+13
-218
lines changed

9 files changed

+13
-218
lines changed

api/v1/coherence_types.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,12 +1691,6 @@ type JvmGarbageCollectorSpec struct {
16911691
// +listType=atomic
16921692
// +optional
16931693
Args []string `json:"args,omitempty"`
1694-
// Enable the following GC logging args -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
1695-
// -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime
1696-
// -XX:+PrintGCApplicationConcurrentTime
1697-
// Default is true
1698-
// +optional
1699-
Logging *bool `json:"logging,omitempty"`
17001694
}
17011695

17021696
// CreateEnvVars creates the GC environment variables for the Coherence container.
@@ -1714,13 +1708,6 @@ func (in *JvmGarbageCollectorSpec) CreateEnvVars() []corev1.EnvVar {
17141708
envVars = append(envVars, corev1.EnvVar{Name: EnvVarJvmGcCollector, Value: *in.Collector})
17151709
}
17161710

1717-
// Enable or disable GC logging
1718-
if in != nil && in.Logging != nil {
1719-
envVars = append(envVars, corev1.EnvVar{Name: EnvVarJvmGcLogging, Value: BoolPtrToString(in.Logging)})
1720-
} else {
1721-
envVars = append(envVars, corev1.EnvVar{Name: EnvVarJvmGcLogging, Value: "false"})
1722-
}
1723-
17241711
return envVars
17251712
}
17261713

api/v1/common_test.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ package v1_test
99
import (
1010
"encoding/json"
1111
"fmt"
12+
"os"
13+
"sort"
14+
"strings"
15+
"testing"
16+
1217
"github.com/go-test/deep"
1318
. "github.com/onsi/gomega"
1419
coh "github.com/oracle/coherence-operator/api/v1"
@@ -20,10 +25,6 @@ import (
2025
corev1 "k8s.io/api/core/v1"
2126
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2227
"k8s.io/utils/ptr"
23-
"os"
24-
"sort"
25-
"strings"
26-
"testing"
2728
)
2829

2930
const (
@@ -344,10 +345,6 @@ func createMinimalExpectedPodSpec(deployment coh.CoherenceResource) corev1.PodTe
344345
Name: "COHERENCE_WKA",
345346
Value: deployment.GetWKA(),
346347
},
347-
{
348-
Name: "JVM_GC_LOGGING",
349-
Value: "false",
350-
},
351348
{
352349
Name: "JVM_USE_CONTAINER_LIMITS",
353350
Value: "true",

api/v1/constants.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ const (
291291
EnvVarJvmDebugAttach = "JVM_DEBUG_ATTACH"
292292
EnvVarJvmGcArgs = "JVM_GC_ARGS"
293293
EnvVarJvmGcCollector = "JVM_GC_COLLECTOR"
294-
EnvVarJvmGcLogging = "JVM_GC_LOGGING"
295294
EnvVarJvmMemoryHeap = "JVM_HEAP_SIZE"
296295
EnvVarJvmMemoryInitialHeap = "JVM_INITIAL_HEAP_SIZE"
297296
EnvVarJvmMemoryMaxHeap = "JVM_MAX_HEAP_SIZE"

api/v1/create_job_jvmspec_test.go

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
package v1_test
88

99
import (
10+
"testing"
11+
1012
coh "github.com/oracle/coherence-operator/api/v1"
1113
corev1 "k8s.io/api/core/v1"
12-
"testing"
1314
)
1415

1516
func TestCreateJobWithEmptyJvmSpec(t *testing.T) {
@@ -241,8 +242,7 @@ func TestCreateJobWithJvmSpecWithGarbageCollectorArgs(t *testing.T) {
241242
spec := coh.CoherenceResourceSpec{
242243
JVM: &coh.JVMSpec{
243244
Gc: &coh.JvmGarbageCollectorSpec{
244-
Args: []string{"-XX:GC-ArgOne", "-XX:GC-ArgTwo"},
245-
Logging: nil,
245+
Args: []string{"-XX:GC-ArgOne", "-XX:GC-ArgTwo"},
246246
},
247247
},
248248
}
@@ -257,46 +257,6 @@ func TestCreateJobWithJvmSpecWithGarbageCollectorArgs(t *testing.T) {
257257
assertJobCreation(t, deployment, jobExpected)
258258
}
259259

260-
func TestCreateJobWithJvmSpecWithGarbageCollectorLoggingFalse(t *testing.T) {
261-
262-
spec := coh.CoherenceResourceSpec{
263-
JVM: &coh.JVMSpec{
264-
Gc: &coh.JvmGarbageCollectorSpec{
265-
Logging: boolPtr(false),
266-
},
267-
},
268-
}
269-
270-
// Create the test deployment
271-
deployment := createTestCoherenceJob(spec)
272-
// Create expected Job
273-
jobExpected := createMinimalExpectedJob(deployment)
274-
addEnvVarsToAllJobContainers(jobExpected, corev1.EnvVar{Name: "JVM_GC_LOGGING", Value: "false"})
275-
276-
// assert that the Job is as expected
277-
assertJobCreation(t, deployment, jobExpected)
278-
}
279-
280-
func TestCreateJobWithJvmSpecWithGarbageCollectorLoggingTrue(t *testing.T) {
281-
282-
spec := coh.CoherenceResourceSpec{
283-
JVM: &coh.JVMSpec{
284-
Gc: &coh.JvmGarbageCollectorSpec{
285-
Logging: boolPtr(true),
286-
},
287-
},
288-
}
289-
290-
// Create the test deployment
291-
deployment := createTestCoherenceJob(spec)
292-
// Create expected Job
293-
jobExpected := createMinimalExpectedJob(deployment)
294-
addEnvVarsToAllJobContainers(jobExpected, corev1.EnvVar{Name: "JVM_GC_LOGGING", Value: "true"})
295-
296-
// assert that the Job is as expected
297-
assertJobCreation(t, deployment, jobExpected)
298-
}
299-
300260
func TestCreateJobWithJvmSpecWithDiagnosticsVolume(t *testing.T) {
301261

302262
hostPath := &corev1.HostPathVolumeSource{Path: "/home/root/debug"}

api/v1/create_statefulset_jvmspec_test.go

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
package v1_test
88

99
import (
10+
"testing"
11+
1012
coh "github.com/oracle/coherence-operator/api/v1"
1113
corev1 "k8s.io/api/core/v1"
12-
"testing"
1314
)
1415

1516
func TestCreateStatefulSetWithEmptyJvmSpec(t *testing.T) {
@@ -236,67 +237,6 @@ func TestCreateStatefulSetWithJvmSpecWithGarbageCollector(t *testing.T) {
236237
assertStatefulSetCreation(t, deployment, stsExpected)
237238
}
238239

239-
func TestCreateStatefulSetWithJvmSpecWithGarbageCollectorArgs(t *testing.T) {
240-
241-
spec := coh.CoherenceResourceSpec{
242-
JVM: &coh.JVMSpec{
243-
Gc: &coh.JvmGarbageCollectorSpec{
244-
Args: []string{"-XX:GC-ArgOne", "-XX:GC-ArgTwo"},
245-
Logging: nil,
246-
},
247-
},
248-
}
249-
250-
// Create the test deployment
251-
deployment := createTestDeployment(spec)
252-
// Create expected StatefulSet
253-
stsExpected := createMinimalExpectedStatefulSet(deployment)
254-
addEnvVarsToAll(stsExpected, corev1.EnvVar{Name: "JVM_GC_ARGS", Value: "-XX:GC-ArgOne -XX:GC-ArgTwo"})
255-
256-
// assert that the StatefulSet is as expected
257-
assertStatefulSetCreation(t, deployment, stsExpected)
258-
}
259-
260-
func TestCreateStatefulSetWithJvmSpecWithGarbageCollectorLoggingFalse(t *testing.T) {
261-
262-
spec := coh.CoherenceResourceSpec{
263-
JVM: &coh.JVMSpec{
264-
Gc: &coh.JvmGarbageCollectorSpec{
265-
Logging: boolPtr(false),
266-
},
267-
},
268-
}
269-
270-
// Create the test deployment
271-
deployment := createTestDeployment(spec)
272-
// Create expected StatefulSet
273-
stsExpected := createMinimalExpectedStatefulSet(deployment)
274-
addEnvVarsToAll(stsExpected, corev1.EnvVar{Name: "JVM_GC_LOGGING", Value: "false"})
275-
276-
// assert that the StatefulSet is as expected
277-
assertStatefulSetCreation(t, deployment, stsExpected)
278-
}
279-
280-
func TestCreateStatefulSetWithJvmSpecWithGarbageCollectorLoggingTrue(t *testing.T) {
281-
282-
spec := coh.CoherenceResourceSpec{
283-
JVM: &coh.JVMSpec{
284-
Gc: &coh.JvmGarbageCollectorSpec{
285-
Logging: boolPtr(true),
286-
},
287-
},
288-
}
289-
290-
// Create the test deployment
291-
deployment := createTestDeployment(spec)
292-
// Create expected StatefulSet
293-
stsExpected := createMinimalExpectedStatefulSet(deployment)
294-
addEnvVarsToAll(stsExpected, corev1.EnvVar{Name: "JVM_GC_LOGGING", Value: "true"})
295-
296-
// assert that the StatefulSet is as expected
297-
assertStatefulSetCreation(t, deployment, stsExpected)
298-
}
299-
300240
func TestCreateStatefulSetWithJvmSpecWithDiagnosticsVolume(t *testing.T) {
301241

302242
hostPath := &corev1.HostPathVolumeSource{Path: "/home/root/debug"}

docs/about/04_coherence_spec.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,6 @@ JvmGarbageCollectorSpec is options for managing the JVM garbage collector.
604604
| Field | Description | Type | Required
605605
m| collector | The name of the JVM garbage collector to use. G1 - adds the -XX:+UseG1GC option CMS - adds the -XX:+UseConcMarkSweepGC option Parallel - adds the -XX:+UseParallelGC Default - use the JVMs default collector The field value is case insensitive If not set G1 is used. If set to a value other than those above then the default collector for the JVM will be used. m| *string | false
606606
m| args | Args specifies the GC options to pass to the JVM. m| []string | false
607-
m| logging | Enable the following GC logging args -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime Default is true m| *bool | false
608607
|===
609608
610609
<<Table of Contents,Back to TOC>>

docs/jvm/040_gc.adoc

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
== Garbage Collector Settings
1414
1515
The `Coherence` CRD has fields in the `jvm.gc` section to allow certain garbage collection parameters to be set.
16-
These include GC logging, setting the collector to use and arbitrary GC arguments.
16+
These setting the collector to use and arbitrary GC arguments.
1717
1818
[IMPORTANT]
1919
====
@@ -26,36 +26,6 @@ added in the Coherence resource spec.
2626
Alternatively specify a different garbage collector, ideally on a version of Java this old, use CMS.
2727
====
2828
29-
=== Enable GC Logging
30-
31-
To enable GC logging set the `jvm.gc.logging` field to `true`.
32-
For example:
33-
[source,yaml]
34-
----
35-
apiVersion: coherence.oracle.com/v1
36-
kind: Coherence
37-
metadata:
38-
name: storage
39-
spec:
40-
jvm:
41-
gc:
42-
logging: true
43-
----
44-
45-
Setting the field to true adds the following JVM arguments to the JVM in the `coherence` container:
46-
----
47-
-verbose:gc
48-
-XX:+PrintGCDetails
49-
-XX:+PrintGCTimeStamps
50-
-XX:+PrintHeapAtGC
51-
-XX:+PrintTenuringDistribution
52-
-XX:+PrintGCApplicationStoppedTime
53-
-XX:+PrintGCApplicationConcurrentTime
54-
----
55-
56-
If different GC logging arguments are required then the relevant JVM arguments can be added to either the
57-
`jvm.args` field or the `jvm.gc.args` field.
58-
5929
=== Set the Garbage Collector
6030
6131
The garbage collector to use can be set using the `jvm.gc.collector` field.

pkg/runner/cmd_config.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -415,15 +415,4 @@ func populateServerDetails(details *run_details.RunDetails) {
415415
details.AddDiagnosticOption("-XX:+PrintCommandLineFlags")
416416
details.AddDiagnosticOption("-XX:+PrintFlagsFinal")
417417
}
418-
419-
// Add GC logging parameters if required
420-
if details.IsEnvTrue(v1.EnvVarJvmGcLogging) {
421-
details.AddMemoryOption("-verbose:gc")
422-
details.AddMemoryOption("-XX:+PrintGCDetails")
423-
details.AddMemoryOption("-XX:+PrintGCTimeStamps")
424-
details.AddMemoryOption("-XX:+PrintHeapAtGC")
425-
details.AddMemoryOption("-XX:+PrintTenuringDistribution")
426-
details.AddMemoryOption("-XX:+PrintGCApplicationStoppedTime")
427-
details.AddMemoryOption("-XX:+PrintGCApplicationConcurrentTime")
428-
}
429418
}

pkg/runner/runner_jvm_test.go

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
package runner
88

99
import (
10+
"testing"
11+
1012
. "github.com/onsi/gomega"
1113
coh "github.com/oracle/coherence-operator/api/v1"
1214
corev1 "k8s.io/api/core/v1"
1315
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1416
"k8s.io/utils/ptr"
15-
"testing"
1617
)
1718

1819
func TestJvmArgsEmpty(t *testing.T) {
@@ -331,53 +332,6 @@ func TestJvmGarbageCollectorZGC(t *testing.T) {
331332
g.Expect(e.OsCmd.Args).To(ConsistOf(expected))
332333
}
333334

334-
func TestJvmGarbageCollectorLoggingTrue(t *testing.T) {
335-
g := NewGomegaWithT(t)
336-
337-
d := &coh.Coherence{
338-
ObjectMeta: metav1.ObjectMeta{Name: "test"},
339-
Spec: coh.CoherenceStatefulSetResourceSpec{
340-
CoherenceResourceSpec: coh.CoherenceResourceSpec{
341-
JVM: &coh.JVMSpec{
342-
Gc: &coh.JvmGarbageCollectorSpec{
343-
Logging: ptr.To(true),
344-
},
345-
},
346-
},
347-
},
348-
}
349-
350-
expectedArgs := append(GetExpectedArgsFileContent(),
351-
"-verbose:gc",
352-
"-XX:+PrintGCDetails",
353-
"-XX:+PrintGCTimeStamps",
354-
"-XX:+PrintHeapAtGC",
355-
"-XX:+PrintTenuringDistribution",
356-
"-XX:+PrintGCApplicationStoppedTime",
357-
"-XX:+PrintGCApplicationConcurrentTime")
358-
359-
verifyConfigFilesWithArgs(t, d, expectedArgs)
360-
361-
args := []string{"server", "--dry-run"}
362-
env := EnvVarsFromDeployment(t, d)
363-
364-
e, err := ExecuteWithArgsAndNewViper(env, args)
365-
g.Expect(err).NotTo(HaveOccurred())
366-
g.Expect(e).NotTo(BeNil())
367-
g.Expect(e.OsCmd).NotTo(BeNil())
368-
369-
g.Expect(e.OsCmd.Dir).To(Equal(TestAppDir))
370-
g.Expect(e.OsCmd.Path).To(Equal(GetJavaCommand()))
371-
g.Expect(e.OsCmd.Args).To(ConsistOf(GetMinimalExpectedArgsWith(t,
372-
"-verbose:gc",
373-
"-XX:+PrintGCDetails",
374-
"-XX:+PrintGCTimeStamps",
375-
"-XX:+PrintHeapAtGC",
376-
"-XX:+PrintTenuringDistribution",
377-
"-XX:+PrintGCApplicationStoppedTime",
378-
"-XX:+PrintGCApplicationConcurrentTime")))
379-
}
380-
381335
func TestJvmGarbageCollectorArgsEmpty(t *testing.T) {
382336
g := NewGomegaWithT(t)
383337

0 commit comments

Comments
 (0)