001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.replication.regionserver; 019 020import org.apache.hadoop.hbase.HBaseInterfaceAudience; 021import org.apache.hadoop.hbase.TableName; 022import org.apache.hadoop.hbase.client.Connection; 023import org.apache.yetus.audience.InterfaceAudience; 024 025/** 026 * Implementations are installed on a Replication Sink called from inside 027 * ReplicationSink#replicateEntries to filter replicated WALEntries based off WALEntry attributes. 028 * Currently only table name and replication write time are exposed (WALEntry is a private, internal 029 * class so we cannot pass it here). To install, set 030 * <code>hbase.replication.sink.walentryfilter</code> to the name of the implementing class. 031 * Implementing class must have a no-param Constructor. 032 * <p> 033 * This filter is of limited use. It is better to filter on the replication source rather than here 034 * after the edits have been shipped on the replication sink. That said, applications such as the 035 * hbase-indexer want to filter out any edits that were made before replication was enabled. 036 * @see org.apache.hadoop.hbase.replication.WALEntryFilter for filtering on the replication 037 * source-side. 038 */ 039@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) 040public interface WALEntrySinkFilter { 041 /** 042 * Name of configuration to set with name of implementing WALEntrySinkFilter class. 043 */ 044 public static final String WAL_ENTRY_FILTER_KEY = "hbase.replication.sink.walentrysinkfilter"; 045 046 /** 047 * Called after Construction. Use passed Connection to keep any context the filter might need. 048 */ 049 void init(Connection connection); 050 051 /** 052 * @param table Table edit is destined for. 053 * @param writeTime Time at which the edit was created on the source. 054 * @return True if we are to filter out the edit. 055 */ 056 boolean filter(TableName table, long writeTime); 057}