Skip to content
Permalink
Browse files
[ASTERIXDB-2756][REP] Skip Replication of Dropped Indexes
- user model changes: no
- storage format changes: no
- interface changes: no

Details:

- When attempting to asynchronously replicate an LSM
  component whose index was dropped, skip replication.

Change-Id: Ifdbf61cdfb6099af43ba2d9353dde9e8e31a4701
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7623
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: Ali Alsuliman <ali.al.solaiman@gmail.com>
Reviewed-by: Luo Chen <cluo8@uci.edu>
  • Loading branch information
mhubail committed Aug 20, 2020
1 parent 37d339e commit 406b304d8f837062bd88dc7e27e4304a6cafb3ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
@@ -19,6 +19,7 @@
package org.apache.asterix.common.storage;

import java.nio.file.Paths;
import java.util.Objects;

import org.apache.asterix.common.dataflow.DatasetLocalResource;
import org.apache.asterix.common.utils.StorageConstants;
@@ -35,6 +36,7 @@ private DatasetResourceReference() {
}

public static DatasetResourceReference of(LocalResource localResource) {
Objects.requireNonNull(localResource);
return parse(localResource);
}

@@ -131,9 +131,14 @@ private void process(IReplicationJob job) {

private boolean skip(IReplicationJob job) {
try {
final DatasetResourceReference indexFileRef =
resourceRepository.getLocalResourceReference(job.getAnyFile());
return !replicationStrategy.isMatch(indexFileRef.getDatasetId());
final String fileToReplicate = job.getAnyFile();
final Optional<DatasetResourceReference> indexFileRefOpt =
resourceRepository.getLocalResourceReference(fileToReplicate);
if (!indexFileRefOpt.isPresent()) {
LOGGER.warn("skipping replication of {} due to missing dataset resource reference", fileToReplicate);
return true;
}
return !replicationStrategy.isMatch(indexFileRefOpt.get().getDatasetId());
} catch (HyracksDataException e) {
throw new IllegalStateException("Couldn't find resource for " + job.getAnyFile(), e);
}
@@ -346,10 +346,11 @@ public Set<Integer> getAllPartitions() throws HyracksDataException {
.collect(Collectors.toSet());
}

public DatasetResourceReference getLocalResourceReference(String absoluteFilePath) throws HyracksDataException {
public Optional<DatasetResourceReference> getLocalResourceReference(String absoluteFilePath)
throws HyracksDataException {
final String localResourcePath = StoragePathUtil.getIndexFileRelativePath(absoluteFilePath);
final LocalResource lr = get(localResourcePath);
return DatasetResourceReference.of(lr);
return lr != null ? Optional.of(DatasetResourceReference.of(lr)) : Optional.empty();
}

/**

0 comments on commit 406b304

Please sign in to comment.