[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-09 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16247068#comment-16247068
 ] 

Hudson commented on HBASE-19199:


FAILURE: Integrated in Jenkins build HBase-2.0 #828 (See 
[https://builds.apache.org/job/HBase-2.0/828/])
HBASE-19199 RatioBasedCompactionPolicy#shouldPerformMajorCompaction() (tedyu: 
rev b6b4cd40cd3b81147fd164ab5337587c91954174)
* (edit) 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/RatioBasedCompactionPolicy.java


> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Fix For: 2.0.0-beta-1
>
> Attachments: HBASE-19199.patch, HBASE-19199.patch, HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-09 Thread Guangxu Cheng (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16246905#comment-16246905
 ] 

Guangxu Cheng commented on HBASE-19199:
---

Thanks [~yuzhih...@gmail.com] for reviewing and commiting.:)
And branch-1 branch-1.3 branch-1.4 have the same problem. Should we commit the 
patch for them?

> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Fix For: 2.0.0-beta-1
>
> Attachments: HBASE-19199.patch, HBASE-19199.patch, HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-09 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16246427#comment-16246427
 ] 

Hudson commented on HBASE-19199:


FAILURE: Integrated in Jenkins build HBase-Trunk_matrix #4026 (See 
[https://builds.apache.org/job/HBase-Trunk_matrix/4026/])
HBASE-19199 RatioBasedCompactionPolicy#shouldPerformMajorCompaction() (tedyu: 
rev ec59b0008ccb3ff86496372285c17ddc6f916011)
* (edit) 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/RatioBasedCompactionPolicy.java


> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Attachments: HBASE-19199.patch, HBASE-19199.patch, HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-09 Thread Ted Yu (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16245644#comment-16245644
 ] 

Ted Yu commented on HBASE-19199:


lgtm

> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Attachments: HBASE-19199.patch, HBASE-19199.patch, HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-09 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16245536#comment-16245536
 ] 

Hadoop QA commented on HBASE-19199:
---

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue}  0m  
8s{color} | {color:blue} Docker mode activated. {color} |
|| || || || {color:brown} Prechecks {color} ||
| {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue}  0m  
0s{color} | {color:blue} Findbugs executables are not available. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green}  0m  
0s{color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green}  0m  
0s{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:red}-1{color} | {color:red} test4tests {color} | {color:red}  0m  
0s{color} | {color:red} The patch doesn't appear to include any new or modified 
tests. Please justify why no new tests are needed for this patch. Also please 
list what manual steps were performed to verify this patch. {color} |
|| || || || {color:brown} master Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  4m 
32s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
46s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
 8s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
56s{color} | {color:green} branch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
32s{color} | {color:green} master passed {color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  4m 
55s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
48s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  0m 
48s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
 5s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green}  0m 
 0s{color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
20s{color} | {color:green} patch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
82m 24s{color} | {color:green} Patch does not cause any errors with Hadoop 
2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 2.7.4 or 3.0.0-alpha4. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
27s{color} | {color:green} the patch passed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:green}+1{color} | {color:green} unit {color} | {color:green} 93m 
42s{color} | {color:green} hbase-server in the patch passed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green}  0m 
14s{color} | {color:green} The patch does not generate ASF License warnings. 
{color} |
| {color:black}{color} | {color:black} {color} | {color:black}195m 42s{color} | 
{color:black} {color} |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | Client=17.05.0-ce Server=17.05.0-ce Image:yetus/hbase:eee3b01 |
| JIRA Issue | HBASE-19199 |
| JIRA Patch URL | 
https://issues.apache.org/jira/secure/attachment/12896824/HBASE-19199.patch |
| Optional Tests |  asflicense  javac  javadoc  unit  findbugs  shadedjars  
hadoopcheck  hbaseanti  checkstyle  compile  |
| uname | Linux 092b99b0a262 3.13.0-133-generic #182-Ubuntu SMP Tue Sep 19 
15:49:21 UTC 2017 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | 
/home/jenkins/jenkins-slave/workspace/PreCommit-HBASE-Build/component/dev-support/hbase-personality.sh
 |
| git revision | master / cffbe4bef7 |
| maven | version: Apache Maven 3.5.2 
(138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z) |
| Default Java | 1.8.0_151 |
|  Test Results | 
https://builds.apache.org/job/PreCommit-HBASE-Build/9707/testReport/ |
| modules | C: hbase-server U: hbase-server |
| Console output | 
https://builds.apache.org/job/PreCommit-HBASE-Build/9707/console |
| Powered by | Apache Yetus 0.6.0   http://yetus.apache.org |


This message was automatically generated.



> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() 

[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-09 Thread Guangxu Cheng (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16245384#comment-16245384
 ] 

Guangxu Cheng commented on HBASE-19199:
---

bq.The test failed 3 times. It was likely related to the patch.
[~yuzhih...@gmail.com] Ran TestHStore  thru QA which passed and all tests pass 
locally too.
Depending feedback, rerun the tests thru QA.

> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Attachments: HBASE-19199.patch, HBASE-19199.patch, HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-08 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16245222#comment-16245222
 ] 

Hadoop QA commented on HBASE-19199:
---

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue}  3m 
49s{color} | {color:blue} Docker mode activated. {color} |
|| || || || {color:brown} Prechecks {color} ||
| {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue}  0m  
0s{color} | {color:blue} Findbugs executables are not available. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green}  0m  
0s{color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green}  0m  
0s{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:red}-1{color} | {color:red} test4tests {color} | {color:red}  0m  
0s{color} | {color:red} The patch doesn't appear to include any new or modified 
tests. Please justify why no new tests are needed for this patch. Also please 
list what manual steps were performed to verify this patch. {color} |
|| || || || {color:brown} master Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  5m 
28s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
41s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
 1s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
47s{color} | {color:green} branch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
28s{color} | {color:green} master passed {color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  4m 
58s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
51s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  0m 
51s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
 9s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green}  0m 
 0s{color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
 0s{color} | {color:green} patch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
52m 54s{color} | {color:green} Patch does not cause any errors with Hadoop 
2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 2.7.4 or 3.0.0-alpha4. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
28s{color} | {color:green} the patch passed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:red}-1{color} | {color:red} unit {color} | {color:red}129m 47s{color} 
| {color:red} hbase-server in the patch failed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green}  0m 
24s{color} | {color:green} The patch does not generate ASF License warnings. 
{color} |
| {color:black}{color} | {color:black} {color} | {color:black}207m  0s{color} | 
{color:black} {color} |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | Client=17.05.0-ce Server=17.05.0-ce Image:yetus/hbase:eee3b01 |
| JIRA Issue | HBASE-19199 |
| JIRA Patch URL | 
https://issues.apache.org/jira/secure/attachment/12896786/HBASE-19199.patch |
| Optional Tests |  asflicense  javac  javadoc  unit  findbugs  shadedjars  
hadoopcheck  hbaseanti  checkstyle  compile  |
| uname | Linux c33d6e5d4814 3.13.0-123-generic #172-Ubuntu SMP Mon Jun 26 
18:04:35 UTC 2017 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | 
/home/jenkins/jenkins-slave/workspace/PreCommit-HBASE-Build/component/dev-support/hbase-personality.sh
 |
| git revision | master / cffbe4bef7 |
| maven | version: Apache Maven 3.5.2 
(138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z) |
| Default Java | 1.8.0_151 |
| unit | 
https://builds.apache.org/job/PreCommit-HBASE-Build/9700/artifact/patchprocess/patch-unit-hbase-server.txt
 |
|  Test Results | 
https://builds.apache.org/job/PreCommit-HBASE-Build/9700/testReport/ |
| modules | C: hbase-server U: hbase-server |
| Console output | 
https://builds.apache.org/job/PreCommit-HBASE-Build/9700/console |
| Powered by | Apache Yetus 0.6.0   http://yetus.apache.org 

[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-08 Thread Ted Yu (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16244277#comment-16244277
 ] 

Ted Yu commented on HBASE-19199:


{code}
[ERROR] 
org.apache.hadoop.hbase.regionserver.TestHStore.testRunDoubleMemStoreCompactors(org.apache.hadoop.hbase.regionserver.TestHStore)
[ERROR]   Run 1: TestHStore.testRunDoubleMemStoreCompactors:1500 expected:<2> 
but was:<3>
[ERROR]   Run 2: TestHStore.testRunDoubleMemStoreCompactors:1481 expected:<1> 
but was:<4>
[ERROR]   Run 3: TestHStore.testRunDoubleMemStoreCompactors:1481 expected:<1> 
but was:<5>
{code}
The test failed 3 times. It was likely related to the patch.

> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Attachments: HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-07 Thread Guangxu Cheng (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16243284#comment-16243284
 ] 

Guangxu Cheng commented on HBASE-19199:
---

All tests pass locally. The failed test is unrelated to this jira.Thanks

> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Attachments: HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-07 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16241976#comment-16241976
 ] 

Hadoop QA commented on HBASE-19199:
---

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue}  0m  
8s{color} | {color:blue} Docker mode activated. {color} |
|| || || || {color:brown} Prechecks {color} ||
| {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue}  0m  
0s{color} | {color:blue} Findbugs executables are not available. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green}  0m  
0s{color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green}  0m  
0s{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:red}-1{color} | {color:red} test4tests {color} | {color:red}  0m  
0s{color} | {color:red} The patch doesn't appear to include any new or modified 
tests. Please justify why no new tests are needed for this patch. Also please 
list what manual steps were performed to verify this patch. {color} |
|| || || || {color:brown} master Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  4m 
29s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
40s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
 3s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
38s{color} | {color:green} branch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
27s{color} | {color:green} master passed {color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  4m 
26s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
42s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  0m 
42s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
 3s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green}  0m 
 0s{color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  4m 
34s{color} | {color:green} patch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
46m 53s{color} | {color:green} Patch does not cause any errors with Hadoop 
2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 or 3.0.0-alpha4. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
28s{color} | {color:green} the patch passed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:red}-1{color} | {color:red} unit {color} | {color:red} 90m 37s{color} 
| {color:red} hbase-server in the patch failed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green}  0m 
18s{color} | {color:green} The patch does not generate ASF License warnings. 
{color} |
| {color:black}{color} | {color:black} {color} | {color:black}156m  3s{color} | 
{color:black} {color} |
\\
\\
|| Reason || Tests ||
| Failed junit tests | hadoop.hbase.regionserver.TestHStore |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | Client=17.05.0-ce Server=17.05.0-ce Image:yetus/hbase:eee3b01 |
| JIRA Issue | HBASE-19199 |
| JIRA Patch URL | 
https://issues.apache.org/jira/secure/attachment/12896381/HBASE-19199.patch |
| Optional Tests |  asflicense  javac  javadoc  unit  findbugs  shadedjars  
hadoopcheck  hbaseanti  checkstyle  compile  |
| uname | Linux aa11159e0d92 3.13.0-129-generic #178-Ubuntu SMP Fri Aug 11 
12:48:20 UTC 2017 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | 
/home/jenkins/jenkins-slave/workspace/PreCommit-HBASE-Build/component/dev-support/hbase-personality.sh
 |
| git revision | master / 29fd1dead2 |
| maven | version: Apache Maven 3.5.2 
(138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z) |
| Default Java | 1.8.0_151 |
| unit | 
https://builds.apache.org/job/PreCommit-HBASE-Build/9655/artifact/patchprocess/patch-unit-hbase-server.txt
 |
|  Test Results | 
https://builds.apache.org/job/PreCommit-HBASE-Build/9655/testReport/ |
| modules | C: hbase-server U: hbase-server |
| Console output | 

[jira] [Commented] (HBASE-19199) RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true when only one file needs to compact

2017-11-07 Thread Guangxu Cheng (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-19199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16241811#comment-16241811
 ] 

Guangxu Cheng commented on HBASE-19199:
---

A simple patch.Thanks

> RatioBasedCompactionPolicy#shouldPerformMajorCompaction() always return true 
> when only one file needs to compact
> 
>
> Key: HBASE-19199
> URL: https://issues.apache.org/jira/browse/HBASE-19199
> Project: HBase
>  Issue Type: Bug
>Affects Versions: 3.0.0, 1.3.1, 1.4.1, 1.5.0, 2.0.0-beta-1
>Reporter: Guangxu Cheng
>Assignee: Guangxu Cheng
> Attachments: HBASE-19199.patch
>
>
> {code:title=RatioBasedCompactionPolicy.java|borderStyle=solid}
>   public boolean shouldPerformMajorCompaction(Collection 
> filesToCompact)
> throws IOException {
> boolean result = false;
> long mcTime = getNextMajorCompactTime(filesToCompact);
> if (filesToCompact == null || filesToCompact.isEmpty() || mcTime == 0) {
>   return result;
> }
> // TODO: Use better method for determining stamp of last major 
> (HBASE-2990)
> long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
> long now = EnvironmentEdgeManager.currentTime();
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)) {
>   String regionInfo;
>   if (this.storeConfigInfo != null && this.storeConfigInfo instanceof 
> HStore) {
> regionInfo = 
> ((HStore)this.storeConfigInfo).getRegionInfo().getRegionNameAsString();
>   } else {
> regionInfo = this.toString();
>   }
>   // Major compaction time has elapsed.
>   long cfTTL = HConstants.FOREVER;
>   if (this.storeConfigInfo != null) {
>  cfTTL = this.storeConfigInfo.getStoreFileTtl();
>   }
>   if (filesToCompact.size() == 1) {
> // Single file
> HStoreFile sf = filesToCompact.iterator().next();
> OptionalLong minTimestamp = sf.getMinimumTimestamp();
> long oldest = minTimestamp.isPresent() ? now - 
> minTimestamp.getAsLong() : Long.MIN_VALUE;
> if (sf.isMajorCompactionResult() && (cfTTL == Long.MAX_VALUE || 
> oldest < cfTTL)) {
>   float blockLocalityIndex =
> sf.getHDFSBlockDistribution().getBlockLocalityIndex(
> RSRpcServices.getHostname(comConf.conf, false));
>   if (blockLocalityIndex < comConf.getMinLocalityToForceCompact()) {
> LOG.debug("Major compaction triggered on only store " + regionInfo
>   + "; to make hdfs blocks local, current blockLocalityIndex is "
>   + blockLocalityIndex + " (min " + 
> comConf.getMinLocalityToForceCompact() + ")");
> result = true;
>   } else {
> LOG.debug("Skipping major compaction of " + regionInfo
>   + " because one (major) compacted file only, oldestTime " + 
> oldest
>   + "ms is < TTL=" + cfTTL + " and blockLocalityIndex is " + 
> blockLocalityIndex
>   + " (min " + comConf.getMinLocalityToForceCompact() + ")");
>   }
> } else if (cfTTL != HConstants.FOREVER && oldest > cfTTL) {
>   LOG.debug("Major compaction triggered on store " + regionInfo
> + ", because keyvalues outdated; time since last major compaction 
> "
> + (now - lowTimestamp) + "ms");
>   result = true;
> }
>   } else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> }
> return result;
>   }
> {code}
> {code}  
>} else {
> LOG.debug("Major compaction triggered on store " + regionInfo
>   + "; time since last major compaction " + (now - lowTimestamp) + 
> "ms");
>   }
>   result = true;
> {code}
> if (lowTimestamp > 0L && lowTimestamp < (now - mcTime)), the result always 
> equal true.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)