Revert "HBASE-18116 fix replication source in-memory calculation by excluding bulk load file"

This reverts commit 050fae501a.
This commit is contained in:
Andrew Purtell 2018-05-31 15:28:37 -07:00
parent 050fae501a
commit b22409d51d
1 changed files with 5 additions and 17 deletions

View File

@ -36,7 +36,6 @@ import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.wal.WAL.Entry; import org.apache.hadoop.hbase.wal.WAL.Entry;
import org.apache.hadoop.hbase.wal.WALEdit; import org.apache.hadoop.hbase.wal.WALEdit;
import org.apache.hadoop.hbase.wal.WALKey;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability; import org.apache.yetus.audience.InterfaceStability;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -169,12 +168,10 @@ class ReplicationSourceWALReader extends Thread {
if (edit == null || edit.isEmpty()) { if (edit == null || edit.isEmpty()) {
return false; return false;
} }
long entrySize = getEntrySizeIncludeBulkLoad(entry); long entrySize = getEntrySize(entry);
long entrySizeExlucdeBulkLoad = getEntrySizeExcludeBulkLoad(entry);
batch.addEntry(entry); batch.addEntry(entry);
updateBatchStats(batch, entry, entrySize); updateBatchStats(batch, entry, entrySize);
boolean totalBufferTooLarge = acquireBufferQuota(entrySizeExlucdeBulkLoad); boolean totalBufferTooLarge = acquireBufferQuota(entrySize);
// Stop if too many entries or too big // Stop if too many entries or too big
return totalBufferTooLarge || batch.getHeapSize() >= replicationBatchSizeCapacity || return totalBufferTooLarge || batch.getHeapSize() >= replicationBatchSizeCapacity ||
batch.getNbEntries() >= replicationBatchCountCapacity; batch.getNbEntries() >= replicationBatchCountCapacity;
@ -299,20 +296,11 @@ class ReplicationSourceWALReader extends Thread {
return entryBatchQueue.take(); return entryBatchQueue.take();
} }
private long getEntrySizeIncludeBulkLoad(Entry entry) { private long getEntrySize(Entry entry) {
WALEdit edit = entry.getEdit(); WALEdit edit = entry.getEdit();
WALKey key = entry.getKey(); return edit.heapSize() + calculateTotalSizeOfStoreFiles(edit);
return edit.heapSize() + sizeOfStoreFilesIncludeBulkLoad(edit) +
key.estimatedSerializedSizeOf();
} }
private long getEntrySizeExcludeBulkLoad(Entry entry) {
WALEdit edit = entry.getEdit();
WALKey key = entry.getKey();
return edit.heapSize() + key.estimatedSerializedSizeOf();
}
private void updateBatchStats(WALEntryBatch batch, Entry entry, long entrySize) { private void updateBatchStats(WALEntryBatch batch, Entry entry, long entrySize) {
WALEdit edit = entry.getEdit(); WALEdit edit = entry.getEdit();
batch.incrementHeapSize(entrySize); batch.incrementHeapSize(entrySize);
@ -365,7 +353,7 @@ class ReplicationSourceWALReader extends Thread {
* @param edit edit to count row keys from * @param edit edit to count row keys from
* @return the total size of the store files * @return the total size of the store files
*/ */
private int sizeOfStoreFilesIncludeBulkLoad(WALEdit edit) { private int calculateTotalSizeOfStoreFiles(WALEdit edit) {
List<Cell> cells = edit.getCells(); List<Cell> cells = edit.getCells();
int totalStoreFilesSize = 0; int totalStoreFilesSize = 0;