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