Skip to content
Permalink
Browse files
[NO ISSUE][MTD] Return Nodegroup nodes in a sorted ordered
- user model changes: no
- storage format changes: no
- interface changes: no

Details:

- Return nodegroups list of nodes in a sorted order. This
  ensures that datasets created on the same set of nodes
  will have the same location constraints order.
- Improve logging when an index is not found.

Change-Id: I9878aac19d64e57c473428f86e8858c06104712c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/8364
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Tested-by: Murtadha Hubail <mhubail@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
  • Loading branch information
mhubail committed Oct 13, 2020
1 parent a10f414 commit 7f8041832f169a393f60ab2794158a79dff86de7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
@@ -19,7 +19,11 @@

package org.apache.asterix.metadata.entities;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import org.apache.asterix.metadata.MetadataCache;
import org.apache.asterix.metadata.api.IMetadataEntity;
@@ -29,23 +33,27 @@
*/
public class NodeGroup implements IMetadataEntity<NodeGroup> {

private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 2L;

// Enforced to be unique within an Asterix cluster.
private final String groupName;
private final List<String> nodeNames;
private final Set<String> nodeNames;

public NodeGroup(String groupName, List<String> nodeNames) {
this.groupName = groupName;
this.nodeNames = nodeNames;
if (nodeNames != null) {
this.nodeNames = new TreeSet<>(nodeNames);
} else {
this.nodeNames = Collections.emptySet();
}
}

public String getNodeGroupName() {
return this.groupName;
}

public List<String> getNodeNames() {
return this.nodeNames;
return Collections.unmodifiableList(new ArrayList<>(nodeNames));
}

@Override
@@ -73,6 +73,7 @@ private LocalResource readIndex() throws HyracksDataException {
// Get local resource
LocalResource lr = getResource();
if (lr == null) {
LOGGER.error("index {} does not exist", resourceRef.getRelativePath());
throw HyracksDataException.create(ErrorCode.INDEX_DOES_NOT_EXIST);
}
IResource resource = lr.getResource();

0 comments on commit 7f80418

Please sign in to comment.