Re: A tweak to our checkstyle configuration
There are a handful of anti patterns to avoid, like dangling if-elses. (Always use braces around code blocks!) Otherwise we have been following the Java basic guidelines with modifications for indent width and maximum line length and I see no pressing reason why this needs to change. Happy with the status quo. That said I see no reason to reject Nicks’s small proposed changes. We definitely don’t need to adopt a totally different style guide in response to a modest proposal. This seems out of proportion to the ask. If we are going to change checkstyle rules it would be necessary for the proposer to provide a linter for the rest of us to use as well as a Yetus precommit phase that implements the checks. Otherwise it would be a half completed proposal and worse than making no changes. Please also provide HOWTOs for configuring the IDEA and Eclipse IDEs. > On Jan 15, 2022, at 1:07 AM, 张铎 wrote: > > What about just switching to use google java style? > > Nick Dimiduk 于2022年1月13日周四 03:22写道: > >> Hey all. >> >> Discussion on the PR has resulted in an impasse of opinion, but also >> renewed interest in improvements to static analysis in general >> (HBASE-26617). >> >> I think that this kind of code hygiene is very important for the long-term >> maintenance of a large project like ours and especially one that accepts >> contributions from a broad audience. I would really appreciate it if some >> more folks would chime into these discussions on PRs, or bring your >> concerns back up to this thread. I'm game to help see the work done, but we >> need more voices to participate in defining what is required by the >> community. >> >> Thanks in advance, >> Nick >> >>> On Thu, Dec 9, 2021 at 3:58 PM Nick Dimiduk wrote: >>> >>> Heya, >>> >>> I have posted a small change to our checkstyle configuration on >>> HBASE-26536. This change will relax the whitespace rules regarding the >>> left-curly-bracket ('{') character. Specifically, I intend this change to >>> allow short expressions that include a nested scope that fits entirely on >>> one line. The example I provide is: >>> >>> if (foo == null) { return null; } >>> >>> This whitespace style is already present (though I think not in popular >>> usage) within the codebase. Please take a look and let me know if you >> have >>> any concerns about making this change. >>> >>> Thanks, >>> Nick >>> >>> https://issues.apache.org/jira/browse/HBASE-26536 >>> https://github.com/apache/hbase/pull/3913 >>> >>
Re: A tweak to our checkstyle configuration
I don't feel strongly about the specific proposal that started this thread. I could see why someone might find it easier to skim the code; I don't feel it impacts my reading personally. If there are folks with differing opinions over it; my preference would be that we stick with whatever style is already more prevalent in the codebase. I do feel strongly that we need _some_ consistently enforced standards. I also think we've been paying a sort of tax as a community for a long time because our existing code base does not currently follow our stated standards, so it's confusing. Our section on code conventions[1] doesn't really give any background beyond "common feedback" as to how we came to our current formatting rules, but it does tell folks that the relevant starting point is the sun java conventions[2]. IIRC our current style guidelines grew out of our time in the Apache Hadoop project which also follows the sun java conventions except with 2 spaces per indent level instead of 4[3]. It's been modified a bit over time as things didn't work for us. the biggest difference that comes to mind is our longer max line length. and maybe the import ordering? I don't think we should adopt some alternate coding standard all at once without a good summary of how it compares to our current formatting standards. I would be in favor of paying the one-time cost of bringing our active release lines into compliance with our stated code format standards. This could be done, for example, by module to break up the reviewing. [1]: https://hbase.apache.org/book.html#common.patch.feedback [2]: https://www.oracle.com/java/technologies/javase/codeconventions-contents.html [3]: https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute#HowToContribute-MakingChanges On Sat, Jan 15, 2022 at 3:07 AM 张铎(Duo Zhang) wrote: > What about just switching to use google java style? > > Nick Dimiduk 于2022年1月13日周四 03:22写道: > > > Hey all. > > > > Discussion on the PR has resulted in an impasse of opinion, but also > > renewed interest in improvements to static analysis in general > > (HBASE-26617). > > > > I think that this kind of code hygiene is very important for the > long-term > > maintenance of a large project like ours and especially one that accepts > > contributions from a broad audience. I would really appreciate it if some > > more folks would chime into these discussions on PRs, or bring your > > concerns back up to this thread. I'm game to help see the work done, but > we > > need more voices to participate in defining what is required by the > > community. > > > > Thanks in advance, > > Nick > > > > On Thu, Dec 9, 2021 at 3:58 PM Nick Dimiduk wrote: > > > > > Heya, > > > > > > I have posted a small change to our checkstyle configuration on > > > HBASE-26536. This change will relax the whitespace rules regarding the > > > left-curly-bracket ('{') character. Specifically, I intend this change > to > > > allow short expressions that include a nested scope that fits entirely > on > > > one line. The example I provide is: > > > > > > if (foo == null) { return null; } > > > > > > This whitespace style is already present (though I think not in popular > > > usage) within the codebase. Please take a look and let me know if you > > have > > > any concerns about making this change. > > > > > > Thanks, > > > Nick > > > > > > https://issues.apache.org/jira/browse/HBASE-26536 > > > https://github.com/apache/hbase/pull/3913 > > > > > >
[jira] [Created] (HBASE-26674) TestWriteHeavyIncrementObserver is flaky
Duo Zhang created HBASE-26674: - Summary: TestWriteHeavyIncrementObserver is flaky Key: HBASE-26674 URL: https://issues.apache.org/jira/browse/HBASE-26674 Project: HBase Issue Type: Bug Reporter: Duo Zhang The stacktrace {noformat} java.lang.IllegalArgumentException at org.apache.hbase.thirdparty.com.google.common.base.Preconditions.checkArgument(Preconditions.java:131) at org.apache.hadoop.hbase.regionserver.compactions.SortedCompactionPolicy.getCurrentEligibleFiles(SortedCompactionPolicy.java:173) at org.apache.hadoop.hbase.regionserver.compactions.SortedCompactionPolicy.preSelectCompactionForCoprocessor(SortedCompactionPolicy.java:44) at org.apache.hadoop.hbase.regionserver.DefaultStoreEngine$DefaultCompactionContext.preSelect(DefaultStoreEngine.java:130) at org.apache.hadoop.hbase.regionserver.HStore.requestCompaction(HStore.java:1438) at org.apache.hadoop.hbase.regionserver.HStore.requestCompaction(HStore.java:1419) at org.apache.hadoop.hbase.regionserver.HRegion.compact(HRegion.java:2238) at org.apache.hadoop.hbase.coprocessor.example.TestWriteHeavyIncrementObserver.test(TestWriteHeavyIncrementObserver.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.apache.hadoop.hbase.SystemExitRule$1.evaluate(SystemExitRule.java:38) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.lang.Thread.run(Thread.java:748) {noformat} Haven't seen it flaky before. And this is a runtime exception in our non test code base, which seems critical. Not sure if it has the same root cause with HBASE-26644. Need to dig more. -- This message was sent by Atlassian Jira (v8.20.1#820001)
Re: A tweak to our checkstyle configuration
What about just switching to use google java style? Nick Dimiduk 于2022年1月13日周四 03:22写道: > Hey all. > > Discussion on the PR has resulted in an impasse of opinion, but also > renewed interest in improvements to static analysis in general > (HBASE-26617). > > I think that this kind of code hygiene is very important for the long-term > maintenance of a large project like ours and especially one that accepts > contributions from a broad audience. I would really appreciate it if some > more folks would chime into these discussions on PRs, or bring your > concerns back up to this thread. I'm game to help see the work done, but we > need more voices to participate in defining what is required by the > community. > > Thanks in advance, > Nick > > On Thu, Dec 9, 2021 at 3:58 PM Nick Dimiduk wrote: > > > Heya, > > > > I have posted a small change to our checkstyle configuration on > > HBASE-26536. This change will relax the whitespace rules regarding the > > left-curly-bracket ('{') character. Specifically, I intend this change to > > allow short expressions that include a nested scope that fits entirely on > > one line. The example I provide is: > > > > if (foo == null) { return null; } > > > > This whitespace style is already present (though I think not in popular > > usage) within the codebase. Please take a look and let me know if you > have > > any concerns about making this change. > > > > Thanks, > > Nick > > > > https://issues.apache.org/jira/browse/HBASE-26536 > > https://github.com/apache/hbase/pull/3913 > > >