[NO ISSUE][OTH] Use IntOpenHashSet for datasets ids
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Use IntOpenHashSet rather than Set<Integer> in StorageCleanupRequestMessage.
Change-Id: Ic7aea42f9a0fe9741d52ead7b6b13a85e2f65417
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10823
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/StorageCleanupRequestMessage.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/StorageCleanupRequestMessage.java
index 85269a1..5e52517 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/StorageCleanupRequestMessage.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/message/StorageCleanupRequestMessage.java
@@ -21,7 +21,6 @@
import static org.apache.hyracks.util.ExitUtil.EC_NC_FAILED_TO_NOTIFY_TASKS_COMPLETED;
import java.util.Map;
-import java.util.Set;
import org.apache.asterix.common.api.IDatasetLifecycleManager;
import org.apache.asterix.common.api.INcApplicationContext;
@@ -38,14 +37,16 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
+
public class StorageCleanupRequestMessage extends CcIdentifiedMessage implements INcAddressedMessage {
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = LogManager.getLogger();
- private final Set<Integer> validDatasetIds;
+ private final IntOpenHashSet validDatasetIds;
private final long reqId;
- public StorageCleanupRequestMessage(long reqId, Set<Integer> validDatasetIds) {
+ public StorageCleanupRequestMessage(long reqId, IntOpenHashSet validDatasetIds) {
this.validDatasetIds = validDatasetIds;
this.reqId = reqId;
}
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
index cf2af95..ae50880 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
@@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -56,6 +55,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
+
public class GlobalRecoveryManager implements IGlobalRecoveryManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -134,11 +135,11 @@
protected void performGlobalStorageCleanup(MetadataTransactionContext mdTxnCtx, int storageGlobalCleanupTimeoutSecs)
throws Exception {
List<Dataverse> dataverses = MetadataManager.INSTANCE.getDataverses(mdTxnCtx);
- Set<Integer> validDatasetIds = new HashSet<>();
+ IntOpenHashSet validDatasetIds = new IntOpenHashSet();
for (Dataverse dataverse : dataverses) {
List<Dataset> dataverseDatasets =
MetadataManager.INSTANCE.getDataverseDatasets(mdTxnCtx, dataverse.getDataverseName());
- dataverseDatasets.stream().map(Dataset::getDatasetId).forEach(validDatasetIds::add);
+ dataverseDatasets.stream().mapToInt(Dataset::getDatasetId).forEach(validDatasetIds::add);
}
ICcApplicationContext ccAppCtx = (ICcApplicationContext) serviceCtx.getApplicationContext();
final List<String> ncs = new ArrayList<>(ccAppCtx.getClusterStateManager().getParticipantNodes());