Getting 503 error while restoring repository 25/6325/1
authorSumit Kaushik <sk00613223@TechMahindra.com>
Thu, 23 Jan 2020 14:40:32 +0000 (20:10 +0530)
committerSumit Kaushik <sk00613223@TechMahindra.com>
Thu, 23 Jan 2020 14:48:28 +0000 (20:18 +0530)
ISSUE-ID : ACUMOS-3918

Getting 503 error while restoring repo but repo is restored

Change-Id: Idab2fd22dcbfa3a786c0b831d06aacd899a1e312
Signed-off-by: Sumit Kaushik <sk00613223@TechMahindra.com>
elk-client/src/main/java/org/acumos/elk/client/service/SnapshotRepositoryServiceImpl.java
elk-client/src/main/java/org/acumos/elk/client/utils/ElkServiceUtils.java

index 81c9983..1b6e665 100644 (file)
@@ -100,10 +100,12 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                        return "false | RepositoryName empty is not allowed";
                }
                ElkGetRepositoriesResponse response = getAllElkRepository();
+               logger.debug("elkCreateRepositoriesRequest.getRepositoryName():{}" + elkCreateRepositoriesRequest.getRepositoryName());
                List<ELkRepositoryMetaData> elkRepositoryMetaDataList = response.getRepositories();
                Set<String> repositoryNameSet = new HashSet<>();
                for (ELkRepositoryMetaData eLkRepositoryMetaData : elkRepositoryMetaDataList) {
                        repositoryNameSet.add(eLkRepositoryMetaData.getName());
+                       logger.debug("eLkRepositoryMetaData.getName():{}" + eLkRepositoryMetaData.getName());
                }
                boolean acknowledged = false;
                if (repositoryNameSet.contains(elkCreateRepositoriesRequest.getRepositoryName())) {
@@ -216,7 +218,10 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
        public ElkArchiveResponse archiveElkRepository(ElkArchiveRequest archiveRequest) throws Exception {
                logger.debug("Inside archiveElkRepository");
                String action = archiveRequest.getAction();
+               logger.debug("action: {} ", action);
+               logger.debug("archiveRequest: {} ", archiveRequest);
                ElkArchiveResponse elkArchiveResponse = archiveOperation(archiveRequest, action);
+               logger.debug("elkArchiveResponse: {} ", elkArchiveResponse);
                return elkArchiveResponse;
        }
 
@@ -241,6 +246,7 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                                result = ElkServiceUtils.executeScript(action, "NA");
                        
                                logger.debug("result INFO: {} ", result);
+                               logger.debug("resultList.size(): {}", resultList.size());
                                resultList.add(result.trim());
                        } catch (Exception ex) {
                                logger.debug("Exception:", ex);
@@ -272,6 +278,7 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                                        archiveInfoList.add(f.apply(archiveInfo));
                                }
                        }
+                       logger.debug("archiveInfoList.size(): {}", archiveInfoList.size());
                        elkArchiveResponse.setMsg("Action:" + action + " done");
                        elkArchiveResponse.setStatus(ElkClientConstants.SUCCESS);
                        elkArchiveResponse.setArchiveInfo(archiveInfoList);
@@ -280,7 +287,9 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                                for (ArchiveInfo archiveInfo : archiveInfoList) {
                                        ElkRepositoriesRequest elkCreateRepositoriesRequest = new ElkRepositoriesRequest();
                                        elkCreateRepositoriesRequest.setRepositoryName(archiveInfo.getRepositoryName());
+                                       logger.debug("archiveInfo.getRepositoryName():{}" + archiveInfo.getRepositoryName());
                                        elkCreateRepositoriesRequest.setNodeTimeout(ElkClientConstants.TIME_ONE_MINT_OUT);
+                                       logger.debug("elkCreateRepositoriesRequest:{}" + elkCreateRepositoriesRequest);
                                        createElkRepository(elkCreateRepositoriesRequest);
                                }
                        }
@@ -337,6 +346,9 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                String locationKey = FsRepository.LOCATION_SETTING.getKey();
                String locationValue = elkCreateRepositoriesRequest.getRepositoryName().trim();
                String compressKey = FsRepository.COMPRESS_SETTING.getKey();
+               logger.debug("locationKey:{}" + locationKey);
+               logger.debug("locationValue:{}" + locationValue);
+               logger.debug("compressKey:{}" + compressKey);
                boolean compressValue = true;
                if (repoType == ElkClientConstants.ARCHIVE_ES_DATA) {
                        request.name(
@@ -347,11 +359,14 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                        request.name(elkCreateRepositoriesRequest.getRepositoryName().trim());
                }
                Settings settings = Settings.builder().put(locationKey, locationValue).put(compressKey, compressValue).build();
+               logger.debug("settings.size():{}" + settings.size());
+               logger.debug("settings.toString():{}" + settings.toString());
                request.settings(settings);
                request.type(FsRepository.TYPE);
                if (StringUtils.isEmpty(elkCreateRepositoriesRequest.getNodeTimeout())) {
                        request.masterNodeTimeout(ElkClientConstants.TIME_ONE_MINT_OUT);
                } else {
+                       logger.debug("elkCreateRepositoriesRequest.getNodeTimeout():{}" + elkCreateRepositoriesRequest.getNodeTimeout());
                        request.masterNodeTimeout(elkCreateRepositoriesRequest.getNodeTimeout());
                }
                request.verify(true);
@@ -360,6 +375,7 @@ public class SnapshotRepositoryServiceImpl extends AbstractELKClientConnection i
                try {
                        acknowledgedResponse = client.snapshot().createRepository(request, RequestOptions.DEFAULT);
                        acknowledged = acknowledgedResponse.isAcknowledged();
+                       logger.debug("acknowledged:{}" + acknowledged);
                        client.close();
                } catch (IOException ex) {
                        logger.debug("Exception:", ex);
index 0a76aac..4b3faeb 100644 (file)
@@ -40,7 +40,9 @@ public class ElkServiceUtils {
                BufferedReader reader = null;
                StringBuilder result = new StringBuilder();
                try {
-
+                       logger.debug("scriptFileName: {}", scriptFileName);
+                       logger.debug("action: {}", action);
+                       logger.debug("repoName: {}", repoName);
                        String[] cmd = { "bash", scriptFileName, action, repoName };
                        processBuilder = new ProcessBuilder(cmd);
                        if (processBuilder != null) {