File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
main/java/org/apache/iotdb/db/engine/storagegroup/virtualSg
test/java/org/apache/iotdb/db/utils Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 2020
2121import org .apache .iotdb .db .conf .IoTDBDescriptor ;
2222import org .apache .iotdb .db .metadata .path .PartialPath ;
23+ import org .apache .iotdb .db .utils .TestOnly ;
2324
2425public class HashVirtualPartitioner implements VirtualPartitioner {
2526
2627 /** total number of virtual storage groups */
27- public static int STORAGE_GROUP_NUM =
28+ private static int STORAGE_GROUP_NUM =
2829 IoTDBDescriptor .getInstance ().getConfig ().getVirtualStorageGroupNum ();
2930
3031 private HashVirtualPartitioner () {}
@@ -47,6 +48,11 @@ private int toStorageGroupId(PartialPath deviceId) {
4748 return Math .abs (deviceId .hashCode () % STORAGE_GROUP_NUM );
4849 }
4950
51+ @ TestOnly
52+ public void reset () {
53+ STORAGE_GROUP_NUM = IoTDBDescriptor .getInstance ().getConfig ().getVirtualStorageGroupNum ();
54+ }
55+
5056 private static class HashVirtualPartitionerHolder {
5157
5258 private static final HashVirtualPartitioner INSTANCE = new HashVirtualPartitioner ();
Original file line number Diff line number Diff line change 3131import org .apache .iotdb .db .engine .cache .TimeSeriesMetadataCache ;
3232import org .apache .iotdb .db .engine .compaction .CompactionTaskManager ;
3333import org .apache .iotdb .db .engine .cq .ContinuousQueryService ;
34+ import org .apache .iotdb .db .engine .storagegroup .virtualSg .HashVirtualPartitioner ;
3435import org .apache .iotdb .db .engine .trigger .service .TriggerRegistrationService ;
3536import org .apache .iotdb .db .exception .ContinuousQueryException ;
3637import org .apache .iotdb .db .exception .StorageEngineException ;
@@ -283,6 +284,9 @@ public static void envSetUp() {
283284 // reset id method
284285 DeviceIDFactory .getInstance ().reset ();
285286
287+ // reset HashVirtualPartitioner
288+ HashVirtualPartitioner .getInstance ().reset ();
289+
286290 TEST_QUERY_JOB_ID = QueryResourceManager .getInstance ().assignQueryId (true );
287291 TEST_QUERY_CONTEXT = new QueryContext (TEST_QUERY_JOB_ID );
288292 }
You can’t perform that action at this time.
0 commit comments