-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-23309: Adding the flexibility to ChainWalEntryFilter to filter the whole entry if all cells get filtered #837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
7e627ff
9faebc9
ce10dc1
1b16c3a
ffb78d3
02fdfec
cd3f767
fec27df
5b28db9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /** | ||
| * 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 | ||
| * <p> | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * 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.hadoop.hbase.replication; | ||
|
|
||
| import org.apache.hadoop.hbase.HBaseInterfaceAudience; | ||
| import org.apache.hadoop.hbase.wal.WAL; | ||
| import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /** | ||
| * A {@link ChainWALEntryFilter} for providing more flexible options | ||
| */ | ||
| @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) | ||
| public class CustomChainWALEntryFilter extends ChainWALEntryFilter { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wchevreuil I addressed your comments. Can you please review it again? |
||
|
|
||
| private boolean filterEmptyEntry = false; | ||
|
|
||
| public CustomChainWALEntryFilter(final WALEntryFilter... filters) { | ||
| super(filters); | ||
| } | ||
|
|
||
| public CustomChainWALEntryFilter(final List<WALEntryFilter> filters) { | ||
| super(filters); | ||
| } | ||
|
|
||
| @Override | ||
| public WAL.Entry filter(WAL.Entry entry) { | ||
| filterEntry(entry); | ||
| if (entry == null) { | ||
| return null; | ||
| } | ||
|
|
||
| filterCells(entry); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we could user super method for this block?
|
||
| if (filterEmptyEntry && entry != null && entry.getEdit().isEmpty()) { | ||
| return null; | ||
| } | ||
| return entry; | ||
| } | ||
|
|
||
| /** | ||
| * To allow the empty entries to get filtered, we want to set this optional flag to decide | ||
| * if we want to filter the entries which have no cells or all cells got filtered | ||
| * though {@link WALCellFilter}. | ||
| * | ||
| * @param filterEmptyEntry flag | ||
| */ | ||
| @VisibleForTesting | ||
| public void setFilterEmptyEntry(final boolean filterEmptyEntry) { | ||
| this.filterEmptyEntry = filterEmptyEntry; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.