@@ -29,7 +29,11 @@ public final class ConsolidationPolicy {
29
29
30
30
private ConsolidationType type ;
31
31
private Double threshold ;
32
- private Long segmentThreshold ;
32
+ private Long segmentsMin ;
33
+ private Long segmentsMax ;
34
+ private Long segmentsBytesMax ;
35
+ private Long segmentsBytesFloor ;
36
+
33
37
34
38
public ConsolidationPolicy () {
35
39
}
@@ -44,48 +48,93 @@ public ConsolidationPolicy type(final ConsolidationType type) {
44
48
}
45
49
46
50
/**
47
- * @param threshold Select a given segment for "consolidation" if and only if the formula based on type (as
48
- * defined above)
49
- * evaluates to true, valid value range [0.0, 1.0] (default: 0.85)
51
+ * @param threshold Select a given segment for "consolidation" if and only if the formula based on type (as defined
52
+ * above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)
53
+ * @param threshold Defines threshold value of [0.0, 1.0] possible range. Consolidation is performed on segments
54
+ * which accumulated size in bytes is less than all segments’ byte size multiplied by the
55
+ * threshold; i.e. the following formula is applied for each segment: {threshold} > (segment_bytes
56
+ * + sum_of_merge_candidate_segment_bytes) / all_segment_bytes. (default: 0.1)
50
57
* @return policy
58
+ * @return this
51
59
*/
52
60
public ConsolidationPolicy threshold (final Double threshold ) {
53
61
this .threshold = threshold ;
54
62
return this ;
55
63
}
56
64
65
+ public ConsolidationType getType () {
66
+ return type ;
67
+ }
68
+
69
+ public Double getThreshold () {
70
+ return threshold ;
71
+ }
72
+
73
+ public Long getSegmentsMin () {
74
+ return segmentsMin ;
75
+ }
76
+
57
77
/**
58
- * @param segmentThreshold Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} <
59
- * number_of_segments
60
- * @return policy
78
+ * @param segmentsMin The minimum number of segments that will be evaluated as candidates for consolidation.
79
+ * (default: 1)
80
+ * @return this
61
81
*/
62
- public ConsolidationPolicy segmentThreshold (final Long segmentThreshold ) {
63
- this .segmentThreshold = segmentThreshold ;
82
+ public ConsolidationPolicy segmentsMin (final Long segmentsMin ) {
83
+ this .segmentsMin = segmentsMin ;
64
84
return this ;
65
85
}
66
86
67
- public ConsolidationType getType () {
68
- return type ;
87
+ public Long getSegmentsMax () {
88
+ return segmentsMax ;
69
89
}
70
90
71
- public Double getThreshold () {
72
- return threshold ;
91
+ /**
92
+ * @param segmentsMax The maximum number of segments that will be evaluated as candidates for consolidation.
93
+ * (default: 10)
94
+ * @return this
95
+ */
96
+ public ConsolidationPolicy segmentsMax (final Long segmentsMax ) {
97
+ this .segmentsMax = segmentsMax ;
98
+ return this ;
99
+ }
100
+
101
+ public Long getSegmentsBytesMax () {
102
+ return segmentsBytesMax ;
73
103
}
74
104
75
- public Long getSegmentThreshold () {
76
- return segmentThreshold ;
105
+ /**
106
+ * @param segmentsBytesMax Maximum allowed size of all consolidated segments in bytes. (default: 5368709120)
107
+ * @return this
108
+ */
109
+ public ConsolidationPolicy segmentsBytesMax (final Long segmentsBytesMax ) {
110
+ this .segmentsBytesMax = segmentsBytesMax ;
111
+ return this ;
112
+ }
113
+
114
+ public Long getSegmentsBytesFloor () {
115
+ return segmentsBytesFloor ;
116
+ }
117
+
118
+ /**
119
+ * @param segmentsBytesFloor Defines the value (in bytes) to treat all smaller segments as equal for consolidation
120
+ * selection. (default: 2097152)
121
+ * @return this
122
+ */
123
+ public ConsolidationPolicy segmentsBytesFloor (final Long segmentsBytesFloor ) {
124
+ this .segmentsBytesFloor = segmentsBytesFloor ;
125
+ return this ;
77
126
}
78
127
79
128
@ Override
80
129
public boolean equals (Object o ) {
81
130
if (this == o ) return true ;
82
131
if (o == null || getClass () != o .getClass ()) return false ;
83
132
ConsolidationPolicy that = (ConsolidationPolicy ) o ;
84
- return type == that .type && Objects .equals (threshold , that .threshold ) && Objects .equals (segmentThreshold , that .segmentThreshold );
133
+ return type == that .type && Objects .equals (threshold , that .threshold ) && Objects .equals (segmentsMin , that .segmentsMin ) && Objects . equals ( segmentsMax , that . segmentsMax ) && Objects . equals ( segmentsBytesMax , that . segmentsBytesMax ) && Objects . equals ( segmentsBytesFloor , that . segmentsBytesFloor );
85
134
}
86
135
87
136
@ Override
88
137
public int hashCode () {
89
- return Objects .hash (type , threshold , segmentThreshold );
138
+ return Objects .hash (type , threshold , segmentsMin , segmentsMax , segmentsBytesMax , segmentsBytesFloor );
90
139
}
91
140
}
0 commit comments