[NO ISSUE][REP] Do not fail create/drop resource on replica failure
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- When creating/dropping a resource, do not fail the operation
on the master node if it fails to send the opreation to the
replica. When the replica node is recovered, it will be
re-synced and will pick up all the changes.
Change-Id: I8313569cfda4b7e4fbeb23d4fdb998b3805367e1
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12985
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>
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
index 2494893..3b192aa 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
@@ -212,7 +212,11 @@
resourceCache.put(resource.getPath(), resource);
//if replication enabled, send resource metadata info to remote nodes
if (isReplicationEnabled) {
- createReplicationJob(ReplicationOperation.REPLICATE, resourceFile);
+ try {
+ createReplicationJob(ReplicationOperation.REPLICATE, resourceFile);
+ } catch (Exception e) {
+ LOGGER.error("failed to send resource file {} to replicas", resourceFile);
+ }
}
}
@@ -233,8 +237,10 @@
FileReference resourceFile = getLocalResourceFileByName(ioManager, relativePath);
try {
if (resourceFile.getFile().exists()) {
- if (isReplicationEnabled) {
+ try {
createReplicationJob(ReplicationOperation.DELETE, resourceFile);
+ } catch (Exception e) {
+ LOGGER.error("failed to delete resource file {} from replicas", resourceFile);
}
final LocalResource localResource = readLocalResource(resourceFile.getFile());
IoUtil.delete(resourceFile);