@Test public void unknownTargetCoreToFixInParams() { String invalidCoreName = "thisIsAnInvalidOrAtLeastUnknownCoreName"; params.set(CORE, invalidCoreName); NamedList<Object> actionResponse = admin.actionFIX(params); assertEquals( 1, actionResponse.size()); assertEquals(UNKNOWN_CORE_MESSAGE + invalidCoreName, actionResponse.get(ACTION_ERROR_MESSAGE_LABEL)); }
NamedList<Object> actionFIX(SolrParams params) throws JSONException { String requestedCoreName = coreName(params); var wrapper = new Object() { final NamedList<Object> response = new SimpleOrderedMap<>(); }; if (isNullOrEmpty(requestedCoreName)) { return wrapper.response; } if (!coreNames().contains(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNKNOWN_CORE_MESSAGE + requestedCoreName); return wrapper.response; } if (!isMasterOrStandalone(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNPROCESSABLE_REQUEST_ON_SLAVE_NODES); return wrapper.response; } Long fromTxCommitTime = params.getLong(FROM_TX_COMMIT_TIME_PARAMETER_NAME); Long toTxCommitTime = params.getLong(TO_TX_COMMIT_TIME_PARAMETER_NAME); boolean dryRun = params.getBool(DRY_RUN_PARAMETER_NAME, true); int maxTransactionsToSchedule = getMaxTransactionToSchedule(params); MetadataTracker metadataTracker = trackerRegistry.getTrackerForCore(requestedCoreName, MetadataTracker.class); AclTracker aclTracker = trackerRegistry.getTrackerForCore(requestedCoreName, AclTracker.class); final boolean actualDryRun = dryRun | (metadataTracker == null || metadataTracker.isDisabled()) || (aclTracker == null || aclTracker.isDisabled()); LOGGER.debug("FIX Admin request on core {}, parameters: " + FROM_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + TO_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + DRY_RUN_PARAMETER_NAME + " = {}, " + "actualDryRun = {} " + MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME + " = {}", requestedCoreName, ofNullable(fromTxCommitTime).map(Object::toString).orElse("N.A."), ofNullable(toTxCommitTime).map(Object::toString).orElse("N.A."), dryRun, actualDryRun, maxTransactionsToSchedule); coreNames().stream() .filter(coreName -> coreName.equals(requestedCoreName)) .filter(this::isMasterOrStandalone) .forEach(coreName -> wrapper.response.add( coreName, fixOnSpecificCore(coreName, fromTxCommitTime, toTxCommitTime, actualDryRun, maxTransactionsToSchedule))); if (wrapper.response.size() > 0) { wrapper.response.add(DRY_RUN_PARAMETER_NAME, dryRun); ofNullable(fromTxCommitTime).ifPresent(value -> wrapper.response.add(FROM_TX_COMMIT_TIME_PARAMETER_NAME, value)); ofNullable(toTxCommitTime).ifPresent(value -> wrapper.response.add(TO_TX_COMMIT_TIME_PARAMETER_NAME, value)); wrapper.response.add(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME, maxTransactionsToSchedule); wrapper.response.add(ACTION_STATUS_LABEL, actualDryRun ? ACTION_STATUS_NOT_SCHEDULED : ACTION_STATUS_SCHEDULED); if (!dryRun && actualDryRun) { wrapper.response.add(ADDITIONAL_INFO, "Trackers are disabled: a (dryRun = true) has been forced. As consequence of that nothing has been scheduled."); } } return wrapper.response; }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> actionFIX(SolrParams params) throws JSONException { String requestedCoreName = coreName(params); var wrapper = new Object() { final NamedList<Object> response = new SimpleOrderedMap<>(); }; if (isNullOrEmpty(requestedCoreName)) { return wrapper.response; } if (!coreNames().contains(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNKNOWN_CORE_MESSAGE + requestedCoreName); return wrapper.response; } if (!isMasterOrStandalone(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNPROCESSABLE_REQUEST_ON_SLAVE_NODES); return wrapper.response; } Long fromTxCommitTime = params.getLong(FROM_TX_COMMIT_TIME_PARAMETER_NAME); Long toTxCommitTime = params.getLong(TO_TX_COMMIT_TIME_PARAMETER_NAME); boolean dryRun = params.getBool(DRY_RUN_PARAMETER_NAME, true); int maxTransactionsToSchedule = getMaxTransactionToSchedule(params); MetadataTracker metadataTracker = trackerRegistry.getTrackerForCore(requestedCoreName, MetadataTracker.class); AclTracker aclTracker = trackerRegistry.getTrackerForCore(requestedCoreName, AclTracker.class); final boolean actualDryRun = dryRun | (metadataTracker == null || metadataTracker.isDisabled()) || (aclTracker == null || aclTracker.isDisabled()); LOGGER.debug("FIX Admin request on core {}, parameters: " + FROM_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + TO_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + DRY_RUN_PARAMETER_NAME + " = {}, " + "actualDryRun = {} " + MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME + " = {}", requestedCoreName, ofNullable(fromTxCommitTime).map(Object::toString).orElse("N.A."), ofNullable(toTxCommitTime).map(Object::toString).orElse("N.A."), dryRun, actualDryRun, maxTransactionsToSchedule); coreNames().stream() .filter(coreName -> coreName.equals(requestedCoreName)) .filter(this::isMasterOrStandalone) .forEach(coreName -> wrapper.response.add( coreName, fixOnSpecificCore(coreName, fromTxCommitTime, toTxCommitTime, actualDryRun, maxTransactionsToSchedule))); if (wrapper.response.size() > 0) { wrapper.response.add(DRY_RUN_PARAMETER_NAME, dryRun); ofNullable(fromTxCommitTime).ifPresent(value -> wrapper.response.add(FROM_TX_COMMIT_TIME_PARAMETER_NAME, value)); ofNullable(toTxCommitTime).ifPresent(value -> wrapper.response.add(TO_TX_COMMIT_TIME_PARAMETER_NAME, value)); wrapper.response.add(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME, maxTransactionsToSchedule); wrapper.response.add(ACTION_STATUS_LABEL, actualDryRun ? ACTION_STATUS_NOT_SCHEDULED : ACTION_STATUS_SCHEDULED); if (!dryRun && actualDryRun) { wrapper.response.add(ADDITIONAL_INFO, "Trackers are disabled: a (dryRun = true) has been forced. As consequence of that nothing has been scheduled."); } } return wrapper.response; } }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> actionFIX(SolrParams params) throws JSONException { String requestedCoreName = coreName(params); var wrapper = new Object() { final NamedList<Object> response = new SimpleOrderedMap<>(); }; if (isNullOrEmpty(requestedCoreName)) { return wrapper.response; } if (!coreNames().contains(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNKNOWN_CORE_MESSAGE + requestedCoreName); return wrapper.response; } if (!isMasterOrStandalone(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNPROCESSABLE_REQUEST_ON_SLAVE_NODES); return wrapper.response; } Long fromTxCommitTime = params.getLong(FROM_TX_COMMIT_TIME_PARAMETER_NAME); Long toTxCommitTime = params.getLong(TO_TX_COMMIT_TIME_PARAMETER_NAME); boolean dryRun = params.getBool(DRY_RUN_PARAMETER_NAME, true); int maxTransactionsToSchedule = getMaxTransactionToSchedule(params); MetadataTracker metadataTracker = trackerRegistry.getTrackerForCore(requestedCoreName, MetadataTracker.class); AclTracker aclTracker = trackerRegistry.getTrackerForCore(requestedCoreName, AclTracker.class); final boolean actualDryRun = dryRun | (metadataTracker == null || metadataTracker.isDisabled()) || (aclTracker == null || aclTracker.isDisabled()); LOGGER.debug("FIX Admin request on core {}, parameters: " + FROM_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + TO_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + DRY_RUN_PARAMETER_NAME + " = {}, " + "actualDryRun = {} " + MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME + " = {}", requestedCoreName, ofNullable(fromTxCommitTime).map(Object::toString).orElse("N.A."), ofNullable(toTxCommitTime).map(Object::toString).orElse("N.A."), dryRun, actualDryRun, maxTransactionsToSchedule); coreNames().stream() .filter(coreName -> coreName.equals(requestedCoreName)) .filter(this::isMasterOrStandalone) .forEach(coreName -> wrapper.response.add( coreName, fixOnSpecificCore(coreName, fromTxCommitTime, toTxCommitTime, actualDryRun, maxTransactionsToSchedule))); if (wrapper.response.size() > 0) { wrapper.response.add(DRY_RUN_PARAMETER_NAME, dryRun); ofNullable(fromTxCommitTime).ifPresent(value -> wrapper.response.add(FROM_TX_COMMIT_TIME_PARAMETER_NAME, value)); ofNullable(toTxCommitTime).ifPresent(value -> wrapper.response.add(TO_TX_COMMIT_TIME_PARAMETER_NAME, value)); wrapper.response.add(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME, maxTransactionsToSchedule); wrapper.response.add(ACTION_STATUS_LABEL, actualDryRun ? ACTION_STATUS_NOT_SCHEDULED : ACTION_STATUS_SCHEDULED); if (!dryRun && actualDryRun) { wrapper.response.add(ADDITIONAL_INFO, "Trackers are disabled: a (dryRun = true) has been forced. As consequence of that nothing has been scheduled."); } } return wrapper.response; } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> actionFIX(SolrParams params) throws JSONException { String requestedCoreName = coreName(params); var wrapper = new Object() { final NamedList<Object> response = new SimpleOrderedMap<>(); }; if (isNullOrEmpty(requestedCoreName)) { return wrapper.response; } if (!coreNames().contains(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNKNOWN_CORE_MESSAGE + requestedCoreName); return wrapper.response; } if (!isMasterOrStandalone(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNPROCESSABLE_REQUEST_ON_SLAVE_NODES); return wrapper.response; } Long fromTxCommitTime = params.getLong(FROM_TX_COMMIT_TIME_PARAMETER_NAME); Long toTxCommitTime = params.getLong(TO_TX_COMMIT_TIME_PARAMETER_NAME); boolean dryRun = params.getBool(DRY_RUN_PARAMETER_NAME, true); int maxTransactionsToSchedule = getMaxTransactionToSchedule(params); MetadataTracker metadataTracker = trackerRegistry.getTrackerForCore(requestedCoreName, MetadataTracker.class); AclTracker aclTracker = trackerRegistry.getTrackerForCore(requestedCoreName, AclTracker.class); final boolean actualDryRun = dryRun | (metadataTracker == null || metadataTracker.isDisabled()) || (aclTracker == null || aclTracker.isDisabled()); LOGGER.debug("FIX Admin request on core {}, parameters: " + FROM_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + TO_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + DRY_RUN_PARAMETER_NAME + " = {}, " + "actualDryRun = {} " + MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME + " = {}", requestedCoreName, ofNullable(fromTxCommitTime).map(Object::toString).orElse("N.A."), ofNullable(toTxCommitTime).map(Object::toString).orElse("N.A."), dryRun, actualDryRun, maxTransactionsToSchedule); coreNames().stream() .filter(coreName -> coreName.equals(requestedCoreName)) .filter(this::isMasterOrStandalone) .forEach(coreName -> wrapper.response.add( coreName, fixOnSpecificCore(coreName, fromTxCommitTime, toTxCommitTime, actualDryRun, maxTransactionsToSchedule))); if (wrapper.response.size() > 0) { wrapper.response.add(DRY_RUN_PARAMETER_NAME, dryRun); ofNullable(fromTxCommitTime).ifPresent(value -> wrapper.response.add(FROM_TX_COMMIT_TIME_PARAMETER_NAME, value)); ofNullable(toTxCommitTime).ifPresent(value -> wrapper.response.add(TO_TX_COMMIT_TIME_PARAMETER_NAME, value)); wrapper.response.add(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME, maxTransactionsToSchedule); wrapper.response.add(ACTION_STATUS_LABEL, actualDryRun ? ACTION_STATUS_NOT_SCHEDULED : ACTION_STATUS_SCHEDULED); if (!dryRun && actualDryRun) { wrapper.response.add(ADDITIONAL_INFO, "Trackers are disabled: a (dryRun = true) has been forced. As consequence of that nothing has been scheduled."); } } return wrapper.response; } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); }
AlfrescoCoreAdminHandler extends CoreAdminHandler { NamedList<Object> actionFIX(SolrParams params) throws JSONException { String requestedCoreName = coreName(params); var wrapper = new Object() { final NamedList<Object> response = new SimpleOrderedMap<>(); }; if (isNullOrEmpty(requestedCoreName)) { return wrapper.response; } if (!coreNames().contains(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNKNOWN_CORE_MESSAGE + requestedCoreName); return wrapper.response; } if (!isMasterOrStandalone(requestedCoreName)) { wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNPROCESSABLE_REQUEST_ON_SLAVE_NODES); return wrapper.response; } Long fromTxCommitTime = params.getLong(FROM_TX_COMMIT_TIME_PARAMETER_NAME); Long toTxCommitTime = params.getLong(TO_TX_COMMIT_TIME_PARAMETER_NAME); boolean dryRun = params.getBool(DRY_RUN_PARAMETER_NAME, true); int maxTransactionsToSchedule = getMaxTransactionToSchedule(params); MetadataTracker metadataTracker = trackerRegistry.getTrackerForCore(requestedCoreName, MetadataTracker.class); AclTracker aclTracker = trackerRegistry.getTrackerForCore(requestedCoreName, AclTracker.class); final boolean actualDryRun = dryRun | (metadataTracker == null || metadataTracker.isDisabled()) || (aclTracker == null || aclTracker.isDisabled()); LOGGER.debug("FIX Admin request on core {}, parameters: " + FROM_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + TO_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " + DRY_RUN_PARAMETER_NAME + " = {}, " + "actualDryRun = {} " + MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME + " = {}", requestedCoreName, ofNullable(fromTxCommitTime).map(Object::toString).orElse("N.A."), ofNullable(toTxCommitTime).map(Object::toString).orElse("N.A."), dryRun, actualDryRun, maxTransactionsToSchedule); coreNames().stream() .filter(coreName -> coreName.equals(requestedCoreName)) .filter(this::isMasterOrStandalone) .forEach(coreName -> wrapper.response.add( coreName, fixOnSpecificCore(coreName, fromTxCommitTime, toTxCommitTime, actualDryRun, maxTransactionsToSchedule))); if (wrapper.response.size() > 0) { wrapper.response.add(DRY_RUN_PARAMETER_NAME, dryRun); ofNullable(fromTxCommitTime).ifPresent(value -> wrapper.response.add(FROM_TX_COMMIT_TIME_PARAMETER_NAME, value)); ofNullable(toTxCommitTime).ifPresent(value -> wrapper.response.add(TO_TX_COMMIT_TIME_PARAMETER_NAME, value)); wrapper.response.add(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME, maxTransactionsToSchedule); wrapper.response.add(ACTION_STATUS_LABEL, actualDryRun ? ACTION_STATUS_NOT_SCHEDULED : ACTION_STATUS_SCHEDULED); if (!dryRun && actualDryRun) { wrapper.response.add(ADDITIONAL_INFO, "Trackers are disabled: a (dryRun = true) has been forced. As consequence of that nothing has been scheduled."); } } return wrapper.response; } AlfrescoCoreAdminHandler();  AlfrescoCoreAdminHandler(CoreContainer coreContainer); @Override void shutdown(); ConcurrentHashMap<String, InformationServer> getInformationServers(); TrackerRegistry getTrackerRegistry(); SolrTrackerScheduler getScheduler(); static final String ALFRESCO_DEFAULTS; }