public void removeBadQueryHistory(String project) throws IOException { getStore().deleteResource(getResourcePathForProject(project)); }
public BadQueryHistory getBadQueriesForProject(String project) throws IOException { BadQueryHistory badQueryHistory = getStore().getResource(getResourcePathForProject(project), BAD_QUERY_INSTANCE_SERIALIZER); if (badQueryHistory == null) { badQueryHistory = new BadQueryHistory(project); } logger.debug("Loaded " + badQueryHistory.getEntries().size() + " Bad Query(s)"); return badQueryHistory; }
public BadQueryHistory upsertEntryToProject(BadQueryEntry badQueryEntry, String project) throws IOException { if (StringUtils.isEmpty(project) || badQueryEntry.getAdj() == null || badQueryEntry.getSql() == null) throw new IllegalArgumentException(); BadQueryHistory badQueryHistory = getBadQueriesForProject(project); NavigableSet<BadQueryEntry> entries = badQueryHistory.getEntries(); entries.remove(badQueryEntry); // in case the entry already exists and this call means to update entries.add(badQueryEntry); int maxSize = kylinConfig.getBadQueryHistoryNum(); if (entries.size() > maxSize) { entries.pollFirst(); } getStore().checkAndPutResource(badQueryHistory.getResourcePath(), badQueryHistory, BAD_QUERY_INSTANCE_SERIALIZER); return badQueryHistory; }
public void removeBadQueryHistory(String project) throws IOException { getStore().deleteResource(getResourcePathForProject(project)); }
public BadQueryHistory getBadQueriesForProject(String project) throws IOException { BadQueryHistory badQueryHistory = getStore().getResource(getResourcePathForProject(project), BAD_QUERY_INSTANCE_SERIALIZER); if (badQueryHistory == null) { badQueryHistory = new BadQueryHistory(project); } logger.debug("Loaded " + badQueryHistory.getEntries().size() + " Bad Query(s)"); return badQueryHistory; }
public BadQueryHistory upsertEntryToProject(BadQueryEntry badQueryEntry, String project) throws IOException { if (StringUtils.isEmpty(project) || badQueryEntry.getAdj() == null || badQueryEntry.getSql() == null) throw new IllegalArgumentException(); BadQueryHistory badQueryHistory = getBadQueriesForProject(project); NavigableSet<BadQueryEntry> entries = badQueryHistory.getEntries(); entries.remove(badQueryEntry); // in case the entry already exists and this call means to update entries.add(badQueryEntry); int maxSize = kylinConfig.getBadQueryHistoryNum(); if (entries.size() > maxSize) { entries.pollFirst(); } getStore().checkAndPutResource(badQueryHistory.getResourcePath(), badQueryHistory, BAD_QUERY_INSTANCE_SERIALIZER); return badQueryHistory; }