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.client.Connection; 022import org.apache.hadoop.hbase.TableName; 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, 029 * internal class so we cannot pass it here). To install, set 030 * <code>hbase.replication.sink.walentryfilter</code> to the name of the implementing 031 * class. Implementing class must have a no-param Constructor. 032 * <p>This filter is of limited use. It is better to filter on the replication source rather than 033 * here after the edits have been shipped on the replication sink. That said, applications such 034 * as the hbase-indexer want to filter out any edits that were made before replication was enabled. 035 * @see org.apache.hadoop.hbase.replication.WALEntryFilter for filtering on the replication 036 * source-side. 037 */ 038@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) 039public interface WALEntrySinkFilter { 040 /** 041 * Name of configuration to set with name of implementing WALEntrySinkFilter class. 042 */ 043 public static final String WAL_ENTRY_FILTER_KEY = "hbase.replication.sink.walentrysinkfilter"; 044 045 /** 046 * Called after Construction. 047 * 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}