@Override public void log(Level level, String message) { deployLogger.log(level, message); }
void checkName(String hostname) { // Give a warning if the host does not exist try { Object address = java.net.InetAddress.getByName(hostname); } catch (UnknownHostException e) { deployLogger.log(Level.WARNING, "Unable to lookup IP address of host: " + hostname); } if (! hostname.contains(".")) { deployLogger.log(Level.WARNING, "Host named '" + hostname + "' may not receive any config " + "since it is not a canonical hostname"); } }
static int readPort(Element spec, boolean isHosted, DeployLogger deployLogger) { String portString = spec.getAttribute("port"); int port = Integer.parseInt(portString); if (port < 0) throw new IllegalArgumentException(String.format("Invalid port %d.", port)); int legalPortInHostedVespa = Container.BASEPORT; if (isHosted && port != legalPortInHostedVespa) { deployLogger.log(LogLevel.WARNING, String.format("Trying to set port to %d for http server with id %s. You cannot set port to anything else than %s", port, spec.getAttribute("id"), legalPortInHostedVespa)); } return port; } }
protected void warn(String searchName, String fieldName, String msg) { String fullMsg = formatError(searchName, fieldName, msg); deployLogger.log(Level.WARNING, fullMsg); }
private void validateWarn(Exception e, DeployLogger deployLogger) { String msg = "Unable to execute 'vespa-verify-ranksetup', validation of rank expressions will only take place when you start Vespa: " + Exceptions.toMessageString(e); deployLogger.log(LogLevel.WARNING, msg); }
/** * This rule consumes a body statement of a field element. * * @param field The field to modify. */ final public void body(SDField field) throws ParseException { jj_consume_token(BODY); deployLogger.log(Level.WARNING, field + ": 'header/body' is deprecated and has no effect."); }
/** * This rule consumes a header statement of a field element. * * @param field The field to modify. */ final public void header(SDField field) throws ParseException { jj_consume_token(HEADER); deployLogger.log(Level.WARNING, field + ": 'header/body' is deprecated and has no effect."); }
public void warning(SAXParseException e) { deployLogger.log(Level.WARNING, message(e)); }
private void checkCommand(String command) { for (SDField field : fields) { if (!field.hasQueryCommand(command)) { if (harmonizedCommands.contains(command)) { deployLogger.log(Level.WARNING, command + " must be added to all fields going to the same index (" + indexName + ")" + ", adding to field " + field.getName()); field.addQueryCommand(command); } else { deployLogger.log(Level.WARNING, "All fields going to the same index should have the same query-commands. Field \'" + field.getName() + "\' doesn't contain command \'" + command+"\'"); } } } } }
@Override public void process(boolean validate, boolean documentsOnly) { if ( ! validate) return; if (documentsOnly) return; for (RankProfile rp : rankProfileRegistry.all()) { for (String functionName : rp.getFunctions().keySet()) { if (reservedNames.contains(functionName)) { deployLogger.log(Level.WARNING, "Function '" + functionName + "' " + "in rank profile '" + rp.getName() + "' " + "has a reserved name. This might mean that the function shadows " + "the built-in function with the same name." ); } } } }
private void addField(String name, DataType type, SummaryTransform transform) { if (fields.containsKey(name)) { SummaryClassField sf = fields.get(name); if (!SummaryClassField.convertDataType(type, transform).equals(sf.getType())) { deployLogger.log(Level.WARNING, "Conflicting definition of field " + name + ". " + "Declared as type " + sf.getType() + " and " + type); } } else { fields.put(name, new SummaryClassField(name, type, transform)); } }
public StorageGroup buildRootGroup(DeployState deployState) { Optional<ModelElement> group = Optional.ofNullable(clusterElement.getChild("group")); Optional<ModelElement> nodes = getNodes(clusterElement); if (group.isPresent() && nodes.isPresent()) throw new IllegalStateException("Both group and nodes exists, only one of these tags is legal"); if (group.isPresent() && (group.get().getStringAttribute("name") != null || group.get().getIntegerAttribute("distribution-key") != null)) deployState.getDeployLogger().log(LogLevel.INFO, "'distribution-key' attribute on a content cluster's root group is ignored"); GroupBuilder groupBuilder = collectGroup(group, nodes, null, null); if (owner.isHostedVespa()) { return groupBuilder.buildHosted(deployState, owner, Optional.empty()); } else { return groupBuilder.buildNonHosted(deployState, owner, Optional.empty()); } }
private static void warnStreamingAttribute(SearchCluster sc, SDField sd, DeployLogger logger) { // If the field is numeric, we can't print this, because we may have converted the field to // attribute indexing ourselves (IntegerIndex2Attribute) if (sd.getDataType() instanceof NumericDataType) return; logger.log(Level.WARNING, "For streaming search cluster '" + sc.getClusterName() + "', SD field '" + sd.getName() + "': 'attribute' has same match semantics as 'index'."); }
/** * This rule consumes part of a rank-degradation statement of a rank profile. */ final public void rankDegradationBinLow() throws ParseException {int n; jj_consume_token(RPBINLOW); jj_consume_token(COLON); n = integer(); deployLogger.log(Level.WARNING, "Specifying 'min-fullrank-docs' in 'rank-degradation' is deprecated and has no effect."); }
private boolean canUseWantedPort(DeployLogger deployLogger, AbstractService service, int wantedPort, int serviceBasePort) { for (int i = 0; i < service.getPortCount(); i++) { int port = wantedPort + i; if (portDB.containsKey(port)) { AbstractService s = (AbstractService)portDB.get(port); deployLogger.log(Level.WARNING, service.getServiceName() +" cannot reserve port " + port + " on " + this + ": Already reserved for " + s.getServiceName() + ". Using default port range from " + serviceBasePort); return false; } if (!service.requiresConsecutivePorts()) break; } return true; }
/** * This rule consumes part of a rank-degradation statement of a rank profile. */ final public void rankDegradationPosbinSize() throws ParseException {double avgOcc; jj_consume_token(RPPOSBINSIZE); jj_consume_token(COLON); avgOcc = consumeFloat(); deployLogger.log(Level.WARNING, "Specifying 'occurrences-per-doc' in 'rank-degradation' is deprecated and has no effect."); }
/** * This rule consumes part of a rank-degradation statement of a rank profile. */ final public void rankDegradationBinSize() throws ParseException {double freq; jj_consume_token(RPBINSIZE); jj_consume_token(COLON); freq = consumeFloat(); deployLogger.log(Level.WARNING, "Specifying 'doc-frequency' in 'rank-degradation' is deprecated and has no effect."); }
private void findFilterFields(Search search, RankProfile profile, Set<String> filterFields) { for (Iterator<RankProfile.RankSetting> itr = profile.declaredRankSettingIterator(); itr.hasNext(); ) { RankProfile.RankSetting setting = itr.next(); if (setting.getType().equals(RankProfile.RankSetting.Type.PREFERBITVECTOR) && ((Boolean)setting.getValue())) { String fieldName = setting.getFieldName(); if (search.getConcreteField(fieldName) != null) { if ( ! profile.filterFields().contains(fieldName)) { filterFields.add(fieldName); } } else { deployLogger.log(Level.WARNING, "For rank profile '" + profile.getName() + "': Cannot apply rank filter setting to unexisting field '" + fieldName + "'"); } } } }
private void assignLogserver(DeployState deployState, NodesSpecification nodesSpecification, Admin admin) { if (nodesSpecification.count() > 1) throw new IllegalArgumentException("You can only request a single log server"); if (nodesSpecification.isDedicated()) { Collection<HostResource> hosts = allocateHosts(admin.getHostSystem(), "logserver", nodesSpecification); if (hosts.isEmpty()) return; // No log server can be created (and none is needed) Logserver logserver = createLogserver(deployState.getDeployLogger(), admin, hosts); createAdditionalContainerOnLogserverHost(deployState, admin, logserver.getHostResource()); } else if (containerModels.iterator().hasNext()) { List<HostResource> hosts = sortedContainerHostsFrom(containerModels.iterator().next(), nodesSpecification.count(), false); if (hosts.isEmpty()) return; // No log server can be created (and none is needed) createLogserver(deployState.getDeployLogger(), admin, hosts); } else { context.getDeployLogger().log(LogLevel.INFO, "No container host available to use for running logserver"); } }
private static void warnStreamingGramMatching(SearchCluster sc, DeployLogger logger) { if (sc.getSdConfig() != null) { for (SDField sd : sc.getSdConfig().getSearch().allConcreteFields()) { if (sd.getMatching().getType().equals(Matching.Type.GRAM)) { logger.log(Level.WARNING, "For streaming search cluster '" + sc.getClusterName() + "', SD field '" + sd.getName() + "': n-gram matching is not supported for streaming search."); } } } }