@@ -91,22 +91,36 @@ public static Subspace indexBuildTypeSubspace(@Nonnull FDBRecordStoreBase<?> sto
91
91
* @return subspace
92
92
*/
93
93
@ Nonnull
94
- public static Subspace indexScrubRecordsRangeSubspaceZero (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
94
+ private static Subspace indexScrubRecordsRangeSubspaceZero (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
95
95
// Backward compatible subspace for range-id zero
96
96
return indexBuildSubspace (store , index , INDEX_SCRUBBED_RECORDS_RANGES_ZERO );
97
97
}
98
98
99
99
/**
100
- * Subspace that stores scrubbed records ranges. This subspace is expected to be followed by a range-id.
100
+ * Subspace that stores scrubbed records ranges.
101
101
* @param store store
102
102
* @param index index
103
103
* @return subspace
104
104
*/
105
105
@ Nonnull
106
- public static Subspace indexScrubRecordsRangeSubspace (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
106
+ private static Subspace indexScrubRecordsRangeSubspaceRoot (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
107
107
return indexBuildSubspace (store , index , INDEX_SCRUBBED_RECORDS_RANGES );
108
108
}
109
109
110
+ /**
111
+ * Subspace that stores scrubbed records ranges.
112
+ * @param store store
113
+ * @param index index
114
+ * @return subspace
115
+ */
116
+ @ Nonnull
117
+ public static Subspace indexScrubRecordsRangeSubspace (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index , int rangeId ) {
118
+ return rangeId == 0 ?
119
+ // Backward compatible
120
+ IndexingSubspaces .indexScrubRecordsRangeSubspaceZero (store , index ) :
121
+ IndexingSubspaces .indexScrubRecordsRangeSubspaceRoot (store , index ).subspace (Tuple .from (rangeId ));
122
+ }
123
+
110
124
/**
111
125
* Subspace that stores scrubbed index entries ranges of the zero range-id. This subspace is backward compatible
112
126
* to index entries ranges scrubbed before range-id was introduced.
@@ -115,7 +129,7 @@ public static Subspace indexScrubRecordsRangeSubspace(@Nonnull FDBRecordStoreBas
115
129
* @return subspace
116
130
*/
117
131
@ Nonnull
118
- public static Subspace indexScrubIndexRangeSubspaceLegacy (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
132
+ private static Subspace indexScrubIndexRangeSubspaceZero (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
119
133
// Backward compatible subspace for range-id zero
120
134
return indexBuildSubspace (store , index , INDEX_SCRUBBED_INDEX_RANGES_ZERO );
121
135
}
@@ -127,21 +141,36 @@ public static Subspace indexScrubIndexRangeSubspaceLegacy(@Nonnull FDBRecordStor
127
141
* @return subspace
128
142
*/
129
143
@ Nonnull
130
- public static Subspace indexScrubIndexRangeSubspace (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
144
+ private static Subspace indexScrubIndexRangeSubspaceRoot (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index ) {
131
145
return indexBuildSubspace (store , index , INDEX_SCRUBBED_INDEX_RANGES );
132
146
}
133
147
148
+ /**
149
+ * Subspace that stores scrubbed index entries ranges.
150
+ * @param store store
151
+ * @param index index
152
+ * @param rangeId used by the caller to distinct different scrubbing sessions.
153
+ * @return subspace
154
+ */
155
+ @ Nonnull
156
+ public static Subspace indexScrubIndexRangeSubspace (@ Nonnull FDBRecordStoreBase <?> store , @ Nonnull Index index , int rangeId ) {
157
+ return rangeId == 0 ?
158
+ // Backward compatible
159
+ IndexingSubspaces .indexScrubIndexRangeSubspaceZero (store , index ) :
160
+ IndexingSubspaces .indexScrubIndexRangeSubspaceRoot (store , index ).subspace (Tuple .from (rangeId ));
161
+ }
162
+
134
163
/**
135
164
* Erasing all the scrubbing ranges data. After calling this function, there would be no memory of scrubbed ranges.
136
165
* @param context user context - the operation will run within this context
137
166
* @param store store
138
167
* @param index index
139
168
*/
140
169
public static void eraseAllIndexingScrubbingData (@ Nonnull FDBRecordContext context , @ Nonnull FDBRecordStore store , @ Nonnull Index index ) {
141
- context .clear (Range .startsWith (indexScrubIndexRangeSubspaceLegacy (store , index ).pack ()));
142
- context .clear (Range .startsWith (indexScrubIndexRangeSubspace (store , index ).pack ()));
170
+ context .clear (Range .startsWith (indexScrubIndexRangeSubspaceZero (store , index ).pack ()));
171
+ context .clear (Range .startsWith (indexScrubIndexRangeSubspaceRoot (store , index ).pack ()));
143
172
context .clear (Range .startsWith (indexScrubRecordsRangeSubspaceZero (store , index ).pack ()));
144
- context .clear (Range .startsWith (indexScrubRecordsRangeSubspace (store , index ).pack ()));
173
+ context .clear (Range .startsWith (indexScrubRecordsRangeSubspaceRoot (store , index ).pack ()));
145
174
}
146
175
147
176
/**
0 commit comments