Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A75E2200C41 for ; Thu, 9 Mar 2017 20:43:11 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A61D9160B8E; Thu, 9 Mar 2017 19:43:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CFB00160B87 for ; Thu, 9 Mar 2017 20:43:10 +0100 (CET) Received: (qmail 72918 invoked by uid 500); 9 Mar 2017 19:43:09 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 71783 invoked by uid 99); 9 Mar 2017 19:43:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Mar 2017 19:43:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A7419F3211; Thu, 9 Mar 2017 19:43:08 +0000 (UTC) From: joshelser To: dev@accumulo.apache.org Reply-To: dev@accumulo.apache.org References: In-Reply-To: Subject: [GitHub] accumulo pull request #224: ACCUMULO-4500 ACCUMULO-96 Added summarization Content-Type: text/plain Message-Id: <20170309194308.A7419F3211@git1-us-west.apache.org> Date: Thu, 9 Mar 2017 19:43:08 +0000 (UTC) archived-at: Thu, 09 Mar 2017 19:43:11 -0000 Github user joshelser commented on a diff in the pull request: https://github.com/apache/accumulo/pull/224#discussion_r105247239 --- Diff: server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/strategies/TooManyDeletesCompactionStrategy.java --- @@ -0,0 +1,173 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.accumulo.tserver.compaction.strategies; + +import static org.apache.accumulo.core.client.summary.summarizers.DeletesSummarizer.DELETES_STAT; +import static org.apache.accumulo.core.client.summary.summarizers.DeletesSummarizer.TOTAL_STAT; + +import java.io.IOException; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Predicate; + +import org.apache.accumulo.core.client.mapred.AccumuloFileOutputFormat; +import org.apache.accumulo.core.client.rfile.RFile.WriterOptions; +import org.apache.accumulo.core.client.summary.SummarizerConfiguration; +import org.apache.accumulo.core.client.summary.Summary; +import org.apache.accumulo.core.client.summary.summarizers.DeletesSummarizer; +import org.apache.accumulo.core.metadata.schema.DataFileValue; +import org.apache.accumulo.server.fs.FileRef; +import org.apache.accumulo.tserver.compaction.CompactionPlan; +import org.apache.accumulo.tserver.compaction.DefaultCompactionStrategy; +import org.apache.accumulo.tserver.compaction.MajorCompactionRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This compaction strategy works in concert with the {@link DeletesSummarizer}. Using the statistics from DeleteSummarizer this strategy will compact all files + * in a table when the number of deletes/non-deletes exceeds a threshold. + * + *

+ * This strategy has two options. First the {@value #THRESHOLD_OPT} option allows setting the point at which a compaction will be triggered. This options + * defaults to {@value #THRESHOLD_OPT_DEFAULT} and must be in the range (0.0, 1.0]. The second option is {@value #PROCEED_ZERO_NO_SUMMARY_OPT} which determines + * if the strategy should proceed when a bulk imported file has no summary information. + * + *

+ * If the delete summarizer was configured on a table that already had files, then those files will have not summary information. This strategy can still + * proceed in this situation. It will fall back to using Accumulo's estimated entires per file in this case. For the files without summary information the + * estimated number of deletes will be zero. This fall back method will underestimate deletes which will not lead to false positives, except for the case of + * bulk imported files. Accumulo estimates that bulk imported files have zero entires. The second option {@value #PROCEED_ZERO_NO_SUMMARY_OPT} determines if + * this strategy should proceed when it sees bulk imported files that do not have summary data. This option defaults to + * {@value #PROCEED_ZERO_NO_SUMMARY_OPT_DEFAULT}. + * + *

+ * Bulk files can be generated with summary information by calling + * {@link AccumuloFileOutputFormat#setSummarizers(org.apache.hadoop.mapred.JobConf, SummarizerConfiguration...)} or + * {@link WriterOptions#withSummarizers(SummarizerConfiguration...)} + * + *

+ * When this strategy does not decide to compact based on the number of deletes, then it will defer the decision to the {@link DefaultCompactionStrategy}. + * + *

+ * Configuring this compaction strategy for a table will cause it to always queue compactions, even though it may not decide to compact. These queued + * compactions may show up on the Accumulo monitor page. This is because summary data can not be read until after compaction is queued and dequeued. When the + * compaction is dequeued it can then decide not to compact. See ACCUMULO-4573 + * + * @since 2.0.0 + */ +public class TooManyDeletesCompactionStrategy extends DefaultCompactionStrategy { --- End diff -- I can't adequately express how cool I think this is. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---