Skip to content
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

HBASE-22890 Verify the file integrity in persistent IOEngine #633

Merged
merged 1 commit into from
Sep 20, 2019

Conversation

ZhaoBQ
Copy link
Contributor

@ZhaoBQ ZhaoBQ commented Sep 17, 2019

ois = new ObjectInputStream(fis);
ois = new ObjectInputStream(new FileInputStream(persistencePath));
// there are two situations that can cause verification to fail
if (!((FileIOEngine) ioEngine).verifyFileIntegrity(persistencePath, ois)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ioEngine can directly cast to FileIOEngine? It's already guarded by !ioEngine.isPersistent().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fault, it's should be PersistentIOEngine.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
💙 reexec 1m 29s Docker mode activated.
_ Prechecks _
💚 dupname 0m 0s No case conflicting files found.
💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
💚 @author 0m 0s The patch does not contain any @author tags.
💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ branch-1 Compile Tests _
💚 mvninstall 8m 7s branch-1 passed
💚 compile 1m 59s branch-1 passed with JDK v1.8.0_222
💔 compile 0m 21s hbase-server in branch-1 failed with JDK v1.7.0_232.
💚 checkstyle 1m 33s branch-1 passed
💚 shadedjars 2m 46s branch has no errors when building our shaded downstream artifacts.
💚 javadoc 0m 36s branch-1 passed with JDK v1.8.0_222
💚 javadoc 0m 39s branch-1 passed with JDK v1.7.0_232
💙 spotbugs 2m 47s Used deprecated FindBugs config; considering switching to SpotBugs.
💚 findbugs 2m 43s branch-1 passed
_ Patch Compile Tests _
💚 mvninstall 2m 1s the patch passed
💚 compile 1m 49s the patch passed with JDK v1.8.0_222
💚 javac 1m 49s the patch passed
💔 compile 0m 22s hbase-server in the patch failed with JDK v1.7.0_232.
💔 javac 0m 22s hbase-server in the patch failed with JDK v1.7.0_232.
💔 checkstyle 1m 32s hbase-server: The patch generated 4 new + 46 unchanged - 6 fixed = 50 total (was 52)
💚 whitespace 0m 0s The patch has no whitespace issues.
💚 shadedjars 2m 58s patch has no errors when building our shaded downstream artifacts.
💚 hadoopcheck 5m 15s Patch does not cause any errors with Hadoop 2.8.5 2.9.2.
💚 javadoc 0m 32s the patch passed with JDK v1.8.0_222
💚 javadoc 0m 43s the patch passed with JDK v1.7.0_232
💔 findbugs 3m 3s hbase-server generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
_ Other Tests _
💔 unit 34m 41s hbase-server in the patch failed.
💚 asflicense 0m 24s The patch does not generate ASF License warnings.
77m 26s
Reason Tests
FindBugs module:hbase-server
org.apache.hadoop.hbase.io.hfile.bucket.FileIOEngine.verifyFileIntegrity(String, ObjectInputStream) ignores result of java.io.ObjectInputStream.read(byte[]) At FileIOEngine.java:java.io.ObjectInputStream.read(byte[]) At FileIOEngine.java:[line 95]
Failed junit tests hadoop.hbase.io.hfile.bucket.TestBucketCache
Subsystem Report/Notes
Docker Client=19.03.2 Server=19.03.2 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/artifact/out/Dockerfile
GITHUB PR #633
Optional Tests dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 2a13dce83b51 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality /home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-633/out/precommit/personality/provided.sh
git revision branch-1 / 5c4d8e0
Default Java 1.7.0_232
Multi-JDK versions /usr/lib/jvm/zulu-8-amd64:1.8.0_222 /usr/lib/jvm/zulu-7-amd64:1.7.0_232
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/artifact/out/branch-compile-hbase-server-jdk1.7.0_232.txt
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
javac https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
checkstyle https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/artifact/out/diff-checkstyle-hbase-server.txt
findbugs https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/artifact/out/new-findbugs-hbase-server.html
unit https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/artifact/out/patch-unit-hbase-server.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/testReport/
Max. process+thread count 733 (vs. ulimit of 10000)
modules C: hbase-server U: hbase-server
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/1/console
versions git=1.9.1 maven=3.0.5 findbugs=3.0.1
Powered by Apache Yetus 0.11.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
💙 reexec 0m 50s Docker mode activated.
_ Prechecks _
💚 dupname 0m 0s No case conflicting files found.
💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
💚 @author 0m 0s The patch does not contain any @author tags.
💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ branch-1 Compile Tests _
💚 mvninstall 8m 10s branch-1 passed
💚 compile 1m 57s branch-1 passed with JDK v1.8.0_222
💔 compile 0m 22s hbase-server in branch-1 failed with JDK v1.7.0_232.
💚 checkstyle 1m 32s branch-1 passed
💚 shadedjars 2m 41s branch has no errors when building our shaded downstream artifacts.
💚 javadoc 0m 37s branch-1 passed with JDK v1.8.0_222
💚 javadoc 0m 41s branch-1 passed with JDK v1.7.0_232
💙 spotbugs 2m 48s Used deprecated FindBugs config; considering switching to SpotBugs.
💚 findbugs 2m 44s branch-1 passed
_ Patch Compile Tests _
💚 mvninstall 1m 59s the patch passed
💚 compile 1m 43s the patch passed with JDK v1.8.0_222
💚 javac 1m 43s the patch passed
💔 compile 0m 22s hbase-server in the patch failed with JDK v1.7.0_232.
💔 javac 0m 22s hbase-server in the patch failed with JDK v1.7.0_232.
💔 checkstyle 1m 31s hbase-server: The patch generated 2 new + 46 unchanged - 6 fixed = 48 total (was 52)
💚 whitespace 0m 0s The patch has no whitespace issues.
💚 shadedjars 2m 45s patch has no errors when building our shaded downstream artifacts.
💚 hadoopcheck 4m 59s Patch does not cause any errors with Hadoop 2.8.5 2.9.2.
💚 javadoc 0m 32s the patch passed with JDK v1.8.0_222
💚 javadoc 0m 42s the patch passed with JDK v1.7.0_232
💔 findbugs 2m 59s hbase-server generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
_ Other Tests _
💚 unit 118m 28s hbase-server in the patch passed.
💚 asflicense 0m 34s The patch does not generate ASF License warnings.
159m 49s
Reason Tests
FindBugs module:hbase-server
org.apache.hadoop.hbase.io.hfile.bucket.FileIOEngine.verifyFileIntegrity(String, ObjectInputStream) ignores result of java.io.ObjectInputStream.read(byte[]) At FileIOEngine.java:java.io.ObjectInputStream.read(byte[]) At FileIOEngine.java:[line 96]
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/artifact/out/Dockerfile
GITHUB PR #633
Optional Tests dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux b2834568b00c 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality /home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-633/out/precommit/personality/provided.sh
git revision branch-1 / 5c4d8e0
Default Java 1.7.0_232
Multi-JDK versions /usr/lib/jvm/zulu-8-amd64:1.8.0_222 /usr/lib/jvm/zulu-7-amd64:1.7.0_232
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/artifact/out/branch-compile-hbase-server-jdk1.7.0_232.txt
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
javac https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
checkstyle https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/artifact/out/diff-checkstyle-hbase-server.txt
findbugs https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/artifact/out/new-findbugs-hbase-server.html
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/testReport/
Max. process+thread count 4320 (vs. ulimit of 10000)
modules C: hbase-server U: hbase-server
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/2/console
versions git=1.9.1 maven=3.0.5 findbugs=3.0.1
Powered by Apache Yetus 0.11.0 https://yetus.apache.org

This message was automatically generated.

this.sizePerFile = capacity / filePaths.length;
this.capacity = this.sizePerFile * filePaths.length;
this.filePaths = filePaths;
this.fileChannels = new FileChannel[filePaths.length];
this.rafs = new RandomAccessFile[filePaths.length];
this.channelLocks = new ReentrantLock[filePaths.length];
this.algorithmName = algorithmName;
// not configure persistent path
if (persistentPath == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some thing new we are doing now. Previously this delete step was not there if the files exists, and no persistentPath been configured.
In fact am wondering why we need to pass the persistentPath and algo here now? We call the verify method and there pass the persistentPath and can pass algo or so also.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea, codes look cleaner.

* @return the IOEngine
* @throws IOException
*/
private IOEngine getIOEngineFromName(String ioEngineName, long capacity)
private IOEngine getIOEngineFromName()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below comment also. Actually there is no need to have any change here now. We do not need to pass any extra args to FileIOE constructor now. No need to even change the order of call to getIOEngineFromName() above right. Better keep only the req change IMHO.

* @return true if verify successfully
*/
@Override
public boolean verifyFileIntegrity(String persistentPath, ObjectInputStream ois)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah.. Can we pass the stored checksum only here? Actually the write of the checksum was done by BucketCache right? So expecting the FileIOE to know that looks bit ugly. I mean its like PBMagic and then an int for checkusm length and so on.

return true;
} else {
// if the persistent file is not start with PB_MAGIC, it's an old version file
oldVersion = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this oldVersion state here in FileIOE?

}

@Override
public boolean isOldVersion() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now this is been used. So my point was like read the checksum in BucketCache only. And let IT decide whether to do the checksum verify or not based on PBMagic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got your point.

@ZhaoBQ
Copy link
Contributor Author

ZhaoBQ commented Sep 18, 2019

Hi, @anoopsjohn, I have modified.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
💙 reexec 0m 42s Docker mode activated.
_ Prechecks _
💚 dupname 0m 0s No case conflicting files found.
💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
💚 @author 0m 0s The patch does not contain any @author tags.
💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ branch-1 Compile Tests _
💚 mvninstall 8m 4s branch-1 passed
💚 compile 1m 58s branch-1 passed with JDK v1.8.0_222
💔 compile 0m 22s hbase-server in branch-1 failed with JDK v1.7.0_232.
💚 checkstyle 1m 33s branch-1 passed
💚 shadedjars 2m 46s branch has no errors when building our shaded downstream artifacts.
💚 javadoc 0m 37s branch-1 passed with JDK v1.8.0_222
💚 javadoc 0m 42s branch-1 passed with JDK v1.7.0_232
💙 spotbugs 3m 11s Used deprecated FindBugs config; considering switching to SpotBugs.
💚 findbugs 3m 9s branch-1 passed
_ Patch Compile Tests _
💚 mvninstall 0m 56s the patch passed
💚 compile 1m 46s the patch passed with JDK v1.8.0_222
💚 javac 1m 46s the patch passed
💔 compile 0m 21s hbase-server in the patch failed with JDK v1.7.0_232.
💔 javac 0m 21s hbase-server in the patch failed with JDK v1.7.0_232.
💔 checkstyle 1m 29s hbase-server: The patch generated 2 new + 48 unchanged - 4 fixed = 50 total (was 52)
💚 whitespace 0m 0s The patch has no whitespace issues.
💚 shadedjars 2m 45s patch has no errors when building our shaded downstream artifacts.
💚 hadoopcheck 5m 3s Patch does not cause any errors with Hadoop 2.8.5 2.9.2.
💚 javadoc 0m 34s the patch passed with JDK v1.8.0_222
💚 javadoc 0m 41s the patch passed with JDK v1.7.0_232
💔 findbugs 3m 5s hbase-server generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
_ Other Tests _
💔 unit 32m 4s hbase-server in the patch failed.
💚 asflicense 0m 22s The patch does not generate ASF License warnings.
72m 27s
Reason Tests
FindBugs module:hbase-server
org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.retrieveFromFile(int[]) ignores result of java.io.ObjectInputStream.read(byte[]) At BucketCache.java: At BucketCache.java:[line 1084]
Failed junit tests hadoop.hbase.io.hfile.bucket.TestVerifyBucketCacheFile
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/artifact/out/Dockerfile
GITHUB PR #633
Optional Tests dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 3a9df52e28e5 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality /home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-633/out/precommit/personality/provided.sh
git revision branch-1 / 5c4d8e0
Default Java 1.7.0_232
Multi-JDK versions /usr/lib/jvm/zulu-8-amd64:1.8.0_222 /usr/lib/jvm/zulu-7-amd64:1.7.0_232
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/artifact/out/branch-compile-hbase-server-jdk1.7.0_232.txt
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
javac https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
checkstyle https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/artifact/out/diff-checkstyle-hbase-server.txt
findbugs https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/artifact/out/new-findbugs-hbase-server.html
unit https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/artifact/out/patch-unit-hbase-server.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/testReport/
Max. process+thread count 758 (vs. ulimit of 10000)
modules C: hbase-server U: hbase-server
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/3/console
versions git=1.9.1 maven=3.0.5 findbugs=3.0.1
Powered by Apache Yetus 0.11.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
💙 reexec 0m 46s Docker mode activated.
_ Prechecks _
💚 dupname 0m 0s No case conflicting files found.
💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
💚 @author 0m 0s The patch does not contain any @author tags.
💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ branch-1 Compile Tests _
💚 mvninstall 8m 9s branch-1 passed
💚 compile 1m 53s branch-1 passed with JDK v1.8.0_222
💔 compile 0m 21s hbase-server in branch-1 failed with JDK v1.7.0_232.
💚 checkstyle 1m 34s branch-1 passed
💚 shadedjars 2m 46s branch has no errors when building our shaded downstream artifacts.
💚 javadoc 0m 37s branch-1 passed with JDK v1.8.0_222
💚 javadoc 0m 41s branch-1 passed with JDK v1.7.0_232
💙 spotbugs 2m 52s Used deprecated FindBugs config; considering switching to SpotBugs.
💚 findbugs 2m 49s branch-1 passed
_ Patch Compile Tests _
💚 mvninstall 1m 55s the patch passed
💚 compile 1m 42s the patch passed with JDK v1.8.0_222
💚 javac 1m 42s the patch passed
💔 compile 0m 23s hbase-server in the patch failed with JDK v1.7.0_232.
💔 javac 0m 23s hbase-server in the patch failed with JDK v1.7.0_232.
💔 checkstyle 1m 31s hbase-server: The patch generated 2 new + 48 unchanged - 4 fixed = 50 total (was 52)
💚 whitespace 0m 0s The patch has no whitespace issues.
💚 shadedjars 2m 42s patch has no errors when building our shaded downstream artifacts.
💚 hadoopcheck 4m 52s Patch does not cause any errors with Hadoop 2.8.5 2.9.2.
💚 javadoc 0m 30s the patch passed with JDK v1.8.0_222
💚 javadoc 0m 43s the patch passed with JDK v1.7.0_232
💚 findbugs 2m 49s the patch passed
_ Other Tests _
💔 unit 31m 2s hbase-server in the patch failed.
💚 asflicense 0m 21s The patch does not generate ASF License warnings.
71m 38s
Reason Tests
Failed junit tests hadoop.hbase.io.hfile.bucket.TestVerifyBucketCacheFile
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/artifact/out/Dockerfile
GITHUB PR #633
Optional Tests dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 004a9f2bb8e2 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality /home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-633/out/precommit/personality/provided.sh
git revision branch-1 / 5c4d8e0
Default Java 1.7.0_232
Multi-JDK versions /usr/lib/jvm/zulu-8-amd64:1.8.0_222 /usr/lib/jvm/zulu-7-amd64:1.7.0_232
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/artifact/out/branch-compile-hbase-server-jdk1.7.0_232.txt
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
javac https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
checkstyle https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/artifact/out/diff-checkstyle-hbase-server.txt
unit https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/artifact/out/patch-unit-hbase-server.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/testReport/
Max. process+thread count 741 (vs. ulimit of 10000)
modules C: hbase-server U: hbase-server
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/4/console
versions git=1.9.1 maven=3.0.5 findbugs=3.0.1
Powered by Apache Yetus 0.11.0 https://yetus.apache.org

This message was automatically generated.

int readLen = ois.read(persistentChecksum);
if (readLen != length || !((PersistentIOEngine) ioEngine).verifyFileIntegrity(
persistentChecksum, algorithm)) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add an INFO log here? Or we have the log saying the verify fail in FileIOE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have log if verify fail in FileIOE.

if (persistencePath != null) {
retrieveFromFile(bucketSizes);
} else {
((PersistentIOEngine) ioEngine).deleteCacheDataFile();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we delete data file here not, there wont be any functional diff I believe. We were not doing it before. Any reason to do so now? Or we do this delete in master branch now? Not remembering exactly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not delete data file does not affect the function, but it will occupy storage space.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data file can be large, since it is out-of-date and can't be restore, i'm fine with the deletion. Being kept is also good to me, only a matter of overwrite again.

try {
byte[] calculateChecksum = calculateChecksum(algorithm);
if (!Bytes.equals(persistentChecksum, calculateChecksum)) {
throw new IOException("The persistent checksum is " + Bytes.toString(persistentChecksum) +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response from this method is in 2 ways for IOE or mismatch of checksum. In caller place we check for boolean return value basically. Can we just log the issue here and return boolean in any case?

return false;
} catch (NoSuchAlgorithmException nsae) {
LOG.error("No such algorithm " + algorithm, nsae);
throw new RuntimeException(nsae);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if we throw RTE here? The FileIOE create itself will get failed or even more? Retrieve from persistent cached fail need not be a reason for the FileIOE to be failed. But here we have configured this to be a persistent FileIOE. Later when we try persist during RS shutdown, we will get failure any way (?). Are u considering that here for this RTE? Am not really sure this throw RTE is correct here. Thoughts

return true;
} catch (IOException ioex) {
LOG.error("File verification failed because of ", ioex);
reinit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this reinit only in this case? In case of checksum mismatch no such thing happening no?

+ " total space under " + filePath + ", not enough for requested "
+ StringUtils.byteDesc(sizePerFile);
+ " total space under " + filePath + ", not enough for requested "
+ StringUtils.byteDesc(sizePerFile);
LOG.warn(msg);
}
rafs[i].setLength(sizePerFile);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setLength() can change the last modified time of the file, so the persistent checksum and calculate checksum are not equal and the unit test failed. But I don't know why my local test can pass...... Anyway, I will fix this.

int readLen = ois.read(persistentChecksum);
if (readLen != length || !((PersistentIOEngine) ioEngine).verifyFileIntegrity(
persistentChecksum, algorithm)) {
LOG.warn("Can't restore from file because of verification failed.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate the if branch? readLen != length doesn't mean Can't restore from file because of verification failed

File file = new File(filePath);
if (file.length() != sizePerFile) {
rafs[i].setLength(sizePerFile);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setLength() method will change file's last modified time. So if don't change this, the wrong time will be used to calculate checksum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment block // to clarify the purpose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya some fat comments here would be nice. Got why u have this check now.. I can think of a case though. Say we have a file based cache with one file and size was 10 GB. Now the restart of the RS happening. The cache is persisted also. Before restart the size is been increased to 20 GB. There is no truncate and ideally the cache get rebuilt. Only thing is after the restart the cache capacity is increased. But now as per the code, the length is changed here and so the last modified time and which will fail the verify phase. Is it some thing to be considered? Dont want much complex handling for this. Might not be a common case for persisted cache. Max what happening is we not able to retrieve persisted cache. But welcoming thinking/suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand you correctly, you mean change the bucket cache size before restart RS. Actually, in retrieveFromFile() method will check the bucket cache size:
if (capacitySize != cacheCapacity) throw new IOException("Mismatched cache capacity:" + StringUtils.byteDesc(capacitySize) + ", expected: " + StringUtils.byteDesc(cacheCapacity));
So change the bucket cache size will no longer retrieve from file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yaya that was my Q.. Oh great.. I did not read whole the code.. Then its perfect. Pls add enough comments around to know why this check and set length is so imp. Great.

* @throws IOException the IOException
*/
private void reinit() throws IOException {
LOG.info("Delete the cache data file and Reinitialize the FileIOEngine.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reinitialize lower case for R?

sb.append(getFileSize(filePath));
sb.append(file.lastModified());
} else {
throw new IOException("Cache file: " + filePath + " is not exists.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, after FileIOE inited, the file path must be exist anyway. I know's it's the complaining in code check, so can we just swallow this IOE in this method, instead of throw to upper caller?

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
💙 reexec 0m 41s Docker mode activated.
_ Prechecks _
💚 dupname 0m 0s No case conflicting files found.
💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
💚 @author 0m 0s The patch does not contain any @author tags.
💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ branch-1 Compile Tests _
💚 mvninstall 8m 0s branch-1 passed
💚 compile 1m 51s branch-1 passed with JDK v1.8.0_222
💔 compile 0m 22s hbase-server in branch-1 failed with JDK v1.7.0_232.
💚 checkstyle 1m 34s branch-1 passed
💚 shadedjars 3m 7s branch has no errors when building our shaded downstream artifacts.
💚 javadoc 0m 41s branch-1 passed with JDK v1.8.0_222
💚 javadoc 0m 45s branch-1 passed with JDK v1.7.0_232
💙 spotbugs 3m 5s Used deprecated FindBugs config; considering switching to SpotBugs.
💚 findbugs 3m 1s branch-1 passed
_ Patch Compile Tests _
💚 mvninstall 2m 8s the patch passed
💚 compile 1m 44s the patch passed with JDK v1.8.0_222
💚 javac 1m 44s the patch passed
💔 compile 0m 22s hbase-server in the patch failed with JDK v1.7.0_232.
💔 javac 0m 22s hbase-server in the patch failed with JDK v1.7.0_232.
💔 checkstyle 1m 29s hbase-server: The patch generated 1 new + 48 unchanged - 4 fixed = 49 total (was 52)
💚 whitespace 0m 0s The patch has no whitespace issues.
💚 shadedjars 2m 41s patch has no errors when building our shaded downstream artifacts.
💚 hadoopcheck 5m 11s Patch does not cause any errors with Hadoop 2.8.5 2.9.2.
💚 javadoc 0m 30s the patch passed with JDK v1.8.0_222
💚 javadoc 0m 40s the patch passed with JDK v1.7.0_232
💚 findbugs 2m 49s the patch passed
_ Other Tests _
💔 unit 118m 26s hbase-server in the patch failed.
💚 asflicense 0m 34s The patch does not generate ASF License warnings.
160m 17s
Reason Tests
Failed junit tests hadoop.hbase.replication.TestReplicationChangingPeerRegionservers
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/artifact/out/Dockerfile
GITHUB PR #633
Optional Tests dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 914bf8976aeb 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality /home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-633/out/precommit/personality/provided.sh
git revision branch-1 / 5c4d8e0
Default Java 1.7.0_232
Multi-JDK versions /usr/lib/jvm/zulu-8-amd64:1.8.0_222 /usr/lib/jvm/zulu-7-amd64:1.7.0_232
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/artifact/out/branch-compile-hbase-server-jdk1.7.0_232.txt
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
javac https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
checkstyle https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/artifact/out/diff-checkstyle-hbase-server.txt
unit https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/artifact/out/patch-unit-hbase-server.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/testReport/
Max. process+thread count 4236 (vs. ulimit of 10000)
modules C: hbase-server U: hbase-server
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/5/console
versions git=1.9.1 maven=3.0.5 findbugs=3.0.1
Powered by Apache Yetus 0.11.0 https://yetus.apache.org

This message was automatically generated.

@Reidddddd
Copy link
Contributor

Ping @anoopsjohn, when you have time. I think it cleaner than before.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
💙 reexec 0m 43s Docker mode activated.
_ Prechecks _
💚 dupname 0m 0s No case conflicting files found.
💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
💚 @author 0m 0s The patch does not contain any @author tags.
💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ branch-1 Compile Tests _
💚 mvninstall 8m 7s branch-1 passed
💚 compile 2m 7s branch-1 passed with JDK v1.8.0_222
💔 compile 0m 23s hbase-server in branch-1 failed with JDK v1.7.0_232.
💚 checkstyle 1m 35s branch-1 passed
💚 shadedjars 2m 51s branch has no errors when building our shaded downstream artifacts.
💚 javadoc 0m 36s branch-1 passed with JDK v1.8.0_222
💚 javadoc 0m 40s branch-1 passed with JDK v1.7.0_232
💙 spotbugs 2m 46s Used deprecated FindBugs config; considering switching to SpotBugs.
💚 findbugs 2m 43s branch-1 passed
_ Patch Compile Tests _
💚 mvninstall 1m 53s the patch passed
💚 compile 1m 42s the patch passed with JDK v1.8.0_222
💚 javac 1m 42s the patch passed
💔 compile 0m 23s hbase-server in the patch failed with JDK v1.7.0_232.
💔 javac 0m 23s hbase-server in the patch failed with JDK v1.7.0_232.
💔 checkstyle 1m 33s hbase-server: The patch generated 1 new + 48 unchanged - 4 fixed = 49 total (was 52)
💚 whitespace 0m 0s The patch has no whitespace issues.
💚 shadedjars 2m 46s patch has no errors when building our shaded downstream artifacts.
💚 hadoopcheck 4m 59s Patch does not cause any errors with Hadoop 2.8.5 2.9.2.
💚 javadoc 0m 31s the patch passed with JDK v1.8.0_222
💚 javadoc 0m 40s the patch passed with JDK v1.7.0_232
💚 findbugs 2m 50s the patch passed
_ Other Tests _
💚 unit 116m 56s hbase-server in the patch passed.
💚 asflicense 0m 35s The patch does not generate ASF License warnings.
158m 2s
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/6/artifact/out/Dockerfile
GITHUB PR #633
Optional Tests dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 07fdd55ccb3f 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality /home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-633/out/precommit/personality/provided.sh
git revision branch-1 / 5c4d8e0
Default Java 1.7.0_232
Multi-JDK versions /usr/lib/jvm/zulu-8-amd64:1.8.0_222 /usr/lib/jvm/zulu-7-amd64:1.7.0_232
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/6/artifact/out/branch-compile-hbase-server-jdk1.7.0_232.txt
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/6/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
javac https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/6/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
checkstyle https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/6/artifact/out/diff-checkstyle-hbase-server.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/6/testReport/
Max. process+thread count 4321 (vs. ulimit of 10000)
modules C: hbase-server U: hbase-server
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/6/console
versions git=1.9.1 maven=3.0.5 findbugs=3.0.1
Powered by Apache Yetus 0.11.0 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@anoopsjohn anoopsjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
Great work.. Thanks for the perseverance

@ZhaoBQ
Copy link
Contributor Author

ZhaoBQ commented Sep 20, 2019

@Reidddddd @anoopsjohn Thank you for your patience and advice!

@Reidddddd Reidddddd merged commit b5b871c into apache:branch-1 Sep 20, 2019
@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
💙 reexec 0m 44s Docker mode activated.
_ Prechecks _
💚 dupname 0m 0s No case conflicting files found.
💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
💚 @author 0m 0s The patch does not contain any @author tags.
💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ branch-1 Compile Tests _
💚 mvninstall 8m 22s branch-1 passed
💚 compile 2m 7s branch-1 passed with JDK v1.8.0_222
💔 compile 0m 21s hbase-server in branch-1 failed with JDK v1.7.0_232.
💚 checkstyle 1m 39s branch-1 passed
💚 shadedjars 2m 57s branch has no errors when building our shaded downstream artifacts.
💚 javadoc 0m 39s branch-1 passed with JDK v1.8.0_222
💚 javadoc 0m 44s branch-1 passed with JDK v1.7.0_232
💙 spotbugs 2m 58s Used deprecated FindBugs config; considering switching to SpotBugs.
💚 findbugs 2m 54s branch-1 passed
_ Patch Compile Tests _
💚 mvninstall 2m 2s the patch passed
💚 compile 1m 49s the patch passed with JDK v1.8.0_222
💚 javac 1m 49s the patch passed
💔 compile 0m 23s hbase-server in the patch failed with JDK v1.7.0_232.
💔 javac 0m 23s hbase-server in the patch failed with JDK v1.7.0_232.
💚 checkstyle 1m 34s hbase-server: The patch generated 0 new + 47 unchanged - 4 fixed = 47 total (was 51)
💚 whitespace 0m 0s The patch has no whitespace issues.
💚 shadedjars 2m 54s patch has no errors when building our shaded downstream artifacts.
💚 hadoopcheck 5m 14s Patch does not cause any errors with Hadoop 2.8.5 2.9.2.
💚 javadoc 0m 33s the patch passed with JDK v1.8.0_222
💚 javadoc 0m 44s the patch passed with JDK v1.7.0_232
💚 findbugs 3m 1s the patch passed
_ Other Tests _
💚 unit 128m 18s hbase-server in the patch passed.
💚 asflicense 0m 32s The patch does not generate ASF License warnings.
171m 25s
Subsystem Report/Notes
Docker Client=19.03.1 Server=19.03.1 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/7/artifact/out/Dockerfile
GITHUB PR #633
Optional Tests dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile
uname Linux 7acc4c60335c 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality /home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-633/out/precommit/personality/provided.sh
git revision branch-1 / 5c4d8e0
Default Java 1.7.0_232
Multi-JDK versions /usr/lib/jvm/zulu-8-amd64:1.8.0_222 /usr/lib/jvm/zulu-7-amd64:1.7.0_232
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/7/artifact/out/branch-compile-hbase-server-jdk1.7.0_232.txt
compile https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/7/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
javac https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/7/artifact/out/patch-compile-hbase-server-jdk1.7.0_232.txt
Test Results https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/7/testReport/
Max. process+thread count 4318 (vs. ulimit of 10000)
modules C: hbase-server U: hbase-server
Console output https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-633/7/console
versions git=1.9.1 maven=3.0.5 findbugs=3.0.1
Powered by Apache Yetus 0.11.0 https://yetus.apache.org

This message was automatically generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants