-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7e627ff
Fixing the ChainWalEntryFilter to filter the whole entry if all cells…
9faebc9
Adding tests for WALCellFilter to cover all the scenarios
ce10dc1
Merge branch 'master' of github.com:apache/hbase into HBASE-23309
1b16c3a
Adding the filter empty entry into peer configuration
ffb78d3
Removing the set filter empty entry from the replication peer config …
02fdfec
nit fix
cd3f767
Adding an InterfaceAudience
fec27df
Addressing comments and fixing style checking
5b28db9
fixing check style
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ChainWALEmptyEntryFilter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /** | ||
| * 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 java.util.List; | ||
| import org.apache.hadoop.hbase.HBaseInterfaceAudience; | ||
| import org.apache.hadoop.hbase.wal.WAL; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
| import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting; | ||
|
|
||
| /** | ||
| * A {@link ChainWALEntryFilter} for providing more flexible options | ||
| */ | ||
| @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) | ||
| public class ChainWALEmptyEntryFilter extends ChainWALEntryFilter { | ||
|
|
||
| private boolean filterEmptyEntry = false; | ||
|
|
||
| public ChainWALEmptyEntryFilter(final WALEntryFilter... filters) { | ||
| super(filters); | ||
| } | ||
|
|
||
| public ChainWALEmptyEntryFilter(final List<WALEntryFilter> filters) { | ||
| super(filters); | ||
| } | ||
|
|
||
| @Override | ||
| public WAL.Entry filter(WAL.Entry entry) { | ||
| entry = super.filter(entry); | ||
| 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; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.