-
Notifications
You must be signed in to change notification settings - Fork 1
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
Testsmaller #9
base: master
Are you sure you want to change the base?
Testsmaller #9
Conversation
…urces block Author: lan <[email protected]> Reviewers: maoling <[email protected]>, Matteo Minardi <[email protected]> Closes apache#1565 from lanicc/ZOOKEEPER-4037
…in.md … Author: asutosh936 <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, HorizonNet, maoling <[email protected]> Closes apache#1263 from asutosh936/ZOOKEEPER-3730
…e start up of server improve the all logs with a necessary time unit at the start up of server , add ms in log Author: ZWShuai91 <[email protected]> Reviewers: Mate Szalay-Beko <[email protected]>, HorizonNet, maoling <[email protected]> Closes apache#1371 from ZWShuai91/ZOOKEEPER-3849
Author: zengchao1212 <[email protected]> Reviewers: maoling <[email protected]> Closes apache#1537 from zengchao1212/ZOOKEEPER-4001
…wers is empty" when not specifically run from the zookeeper-contrib/zookeeper-contrib-zooinspector directory ISSUE --- See https://issues.apache.org/jira/browse/ZOOKEEPER-4050 for details on the issue. This is a follow-on PR to issues identified in apache#1551. While that PR fixed some launch issues, currently ZooInspector still needs to be run from the root ZooInspector directory because it expects the `defaultConnectionSettings.cfg` and `defaultNodeViewers.cfg` to exist on the filesystem in a specific location. The previous PR ensured that these files are now bundled into the fat jar built by Maven, so this new PR makes the checks for these files fall back to checking the classpath (i.e. checking inside the jar) for these files if they can't be found on the filesystem first. This means that the `zooInspector.sh` and `zooInspector.cmd` scripts can now be run from anywhere once the project is built. TESTING --- I've tested cloning, building and running ZooInspector on Mac OS Catalina (10.15.7) on Java 8 with these fixes and invoking `zooInspector.sh` from different directories to ensure it runs properly and doesn't display the aforementioned error. I ran `mvn verify spotbugs:check checkstyle:check -Pfull-build -Dsurefire-forkcount=4` in the `zookeeper-contrib/zookeeper-contrib-zooinspector` directory (per https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute#HowToContribute-FinalChecksonPullRequest) and got these results: ``` [INFO] You have 0 Checkstyle violations. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 15.037 s [INFO] Finished at: 2021-02-01T20:30:04-08:00 [INFO] ------------------------------------------------------------------------ ``` Since all of my proposed changes are in the `zookeeper-contrib` subtree (and specifically only in `zookeeper-contrib-zooinspector`, I did not run the wider unit tests for the Zookeeper project as a whole. Author: brentwritescode <[email protected]> Author: Brent Nash <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Damien Diederen <[email protected]> Closes apache#1589 from brentwritescode/ZOOKEEPER-4050
Author: luoman <[email protected]> Reviewers: maoling <[email protected]> Closes apache#1597 from LuoManGit/ZOOKEEPER-4007
This reverts commit 4faf507.
I believe we don't need to add the git checkout to the "Steps" section. I cannot see it neither in owasp nor the PR jenkinsfiles. Also I see that master branch gets also checked out during our normal builds, so I hope this will fix it. Target branches: master, branch-3.7, branch-3.6, branch-3.5 Author: Andor Molnar <[email protected]> Reviewers: Enrico Olivelli <[email protected]> Closes apache#1600 from anmolnar/ZOOKEEPER-4207
Increase test stability by avoiding test failures due to port collisions by preventing tests from running concurrently in the GitHub Actions CI builds. Author: Christopher Tubbs <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Damien Diederen <[email protected]> Closes apache#1606 from ctubbsii/reduce-forkCount
Update Netty to 4.1.59.Final on to address the vulnerability described at https://snyk.io/vuln/SNYK-JAVA-IONETTY-1020439 Author: Frederiko Costa <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Damien Diederen <[email protected]> Closes apache#1605 from frederiko/netty-4.1.59-update
`WatcherCleanerTest` performs latency checks which fail when outside of a 20+Xms window. Before this patch, X was 5ms—whereas 30+ms is frequently seen on an i5 Mac Mini running macOS Catalina. This "dumb" patch just widens the window to 20ms, which makes it "work on my machine," but could obviously still fail in a loaded environment or VM. Author: Damien Diederen <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1592 from ztzg/ZOOKEEPER-4200-widen-latency-window
This patch works around the numerous deprecation notices added to the CyrusSASL library on macOS. It is a direct "port" of the solution to MESOS-3030, which hit exactly the same problem: https://issues.apache.org/jira/browse/MESOS-3030 https://reviews.apache.org/r/39230/diff/3/ The PR also includes a fix for the the `clockid_t` compilation issue mentioned in the ticket description, but the test suite as a whole remains broken on macOS as its linker does not support the `--wrap` option. Author: Damien Diederen <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1593 from ztzg/ZOOKEEPER-4201-catalina-c-client-fixes
`QuorumRequestPipelineTest` hosts parameterized tests which explicitly call `QuorumBase.setUp(boolean)`. This patch overrides the argument-less `QuorumBase.setUp()` with an empty body, as the former is annotated `BeforeEach`-otherwise causing the runtime to start a fresh 5-ensemble before each test. Without the override, one such extraneous ensemble is created and immediately leaked for each combination of test method + parameters. The test consequently requires 4000+ simultaneous threads to complete, and while Linux happily handles that load, macOS Catalina's per-process limit of 2048 threads effectively causes the JVM to "crash" or lock up. The solution is copied verbatim from another parameterized subclass of `QuorumBase`, `EagerACLFilterTest`. Author: Damien Diederen <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1591 from ztzg/ZOOKEEPER-4199-thread-leak-qrp-test
…e.maxbufer size Author: Mathieu Marie <[email protected]> Reviewers: Damien Diederen <[email protected]>, Mate Szalay-Beko <[email protected]> Closes apache#1614 from mariemat/ZOOKEEPER-4221
Without this patch, a multi() transaction such as the one implemented in ZooKeeperQuotaTest.testMultiCreateThenSetDataShouldWork fails with MarshallingError when 'enforceQuota' is enabled. This happens whenever the node has an associated quota, whether it was exceeded or not. This is due to the server encountering null while trying to access a database node by path--whereas that node only exists as a ChangeRecord in the server's 'outstandingChanges' list: java.lang.NullPointerException at org.apache.zookeeper.server.ZooKeeperServer.checkQuota(ZooKeeperServer.java:2048) at org.apache.zookeeper.server.PrepRequestProcessor.pRequest2Txn(PrepRequestProcessor.java:397) The patch adds an additional 'lastData' parameter to the quota checking function, and passes the data from the ChangeRecord during 'setData' operations. Author: Damien Diederen <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko <[email protected]>, Norbert Kalmar <[email protected]> Closes apache#1611 from ztzg/ZOOKEEPER-4219-quota-multi-setdata
The introduction of the oracle makes ZooKeeper fault-tolerant in two-node systems. The major changes are: 1. QuorumPeerConfig.java - The changes allow users to enable the oracle and provide essential information. - Create QuorumOracleMaj if configured. 2. FastLeaderElection.java - A re-check mechanism checks the current received votes once the timeout expires. - Add another case when receiving a LEADING notification for a node to locate the existed leader in two-node systems. 3. Leader.java - Add a re-validation of outstanding proposals mechanism after the only follower goes away - Add another handling case when the quorum is not maintainable. It queries the Oracle for maintaining the quorum along. 4. QuorumVerifier.java - Add methods for QuorumOracleMaj.java 5. QuorumOracleMaj.java (This is a new file.) - A sub-class of QuorumMaj - It default reads a file that contains a binary value to behave as an Oracle. Author: Ching-Chan Lee <[email protected]> Reviewers: Benjamin Reed <[email protected]>, Michael Han <[email protected]> Closes apache#1444 from chingchan1996/ZOOKEEPER-3922
…quare bracket same as LocalPeerBean …quare bracket same as LocalPeerBean Author: Mohammad Arshad <[email protected]> Reviewers: Enrico Olivelli <[email protected]> Closes apache#1493 from arshadmohammad/ZOOKEEPER-3877-master
…ty is true snapshot.trust.empty is an escape hatch for users upgrading from 3.4.x to later Zookeeper versions, allowing nodes to start with a non-empty transaction log but no snapshot. The intent is for this setting to be enabled for a short while during the upgrade, and then disabled again, as the check it disables is a safety feature. Prior to this PR, a node would only write a snapshot locally if it became leader, or if it had fallen so far behind the leader that the leader sent a SNAP message instead of a DIFF. This made the upgrade process inconvenient, as not all nodes would create a snapshot when snapshot.trust.empty was true, meaning that the safety check could not be flipped back on. This PR makes follower nodes write a local snapshot when they receive NEWLEADER, if they have no local snapshot and snapshot.trust.empty is true. Author: Stig Rohde Døssing <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Damien Diederen <[email protected]> Closes apache#1581 from srdo/zookeeper-3781
… election We have a logic in the server code, that would try to connect to an other quorum member, based on its server ID. We identify the address assigned to this ID first based on the last committed quorum configuration. If the connection attempt fails (or the server is not known in the committed configuration) then we try to find the address based on the last proposed quorum configuration. But we should do the second connection attempt, only if the address in the last proposed configuration differs from the address in the last committed configuration. Otherwise we would just retry to connect to the same address that failed just right before. In the current code we have a bug, because we compare the address object references (use "!=") instead of comparing the objects themselves (using "not equals"). In certain edge cases (e.g. when the last proposed and last committed addresses are the same, but the address is unreachable) this bug can lead to unnecessary retry of connection attempts. The normal behaviour would be to mark this connection attempt to be failed and wait for e.g. the next election round or wait for the other server to come online and initiate a connection to us. Author: Mate Szalay-Beko <[email protected]> Reviewers: Andor Molnar <[email protected]>, Damien Diederen <[email protected]> Closes apache#1615 from symat/ZOOKEEPER-4220
Since 5fe6850, it's no longer true that the server will either respond or not; now it can also respond that it won't obey, with the message that the command "is not executed because it is not in the whitelist", unlike what one gets if the command does not exist at all. Author: Federico Leva <[email protected]> Reviewers: maoling <[email protected]>, Enrico Olivelli <[email protected]> Closes apache#1608 from nemobis/ZOOKEEPER-2693
Add argument `const char *func` typically initialized with __func__ to include current function name in log message. Author: Sam Mikes <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko <[email protected]>, Damien Diederen <[email protected]> Closes apache#1609 from smikes/handle-msg-report-func
`InvalidSnapshotTest.testSnapshot` starts an instance of `ZooKeeperServer` on the version-controlled `resources/data/invalidsnap` directory, which, as a side-effect, \"fixes\" the following snapshot—which was broken on purpose (see ZOOKEEPER-367): `zookeeper-server/src/test/resources/data/invalidsnap/version-2/snapshot.83f` This status quo creates a number of problems: 1. It makes the test ineffective after the first run; 2. The file shows as modified in version control tools, which can be annoying; 3. The \"fixed\" snapshot can end up being committed by mistake, invalidating the test. (\#3 is not theoretical; that \"fixed\" snapshot frequently shows up in pull requests, and was recently merged into master.). Author: Damien Diederen <[email protected]> Reviewers: Mohammad Arshad <[email protected]> Closes apache#1622 from ztzg/ZOOKEEPER-4232-invalid-snapshot-is-invalid and squashes the following commits: 8b48eea [Damien Diederen] ZOOKEEPER-4232: Ensure that ZOOKEEPER-367 test data fails to parse 9250756 [Damien Diederen] ZOOKEEPER-4232: Run InvalidSnapshotTest on a copy of test data dcf5604 [Damien Diederen] ZOOKEEPER-4232: Restore test data for ZOOKEEPER-367
Async API calls attempt to flush the send buffer, which calls flush_send_queue(); and can report ZOPERATIONTIMEOUT ZSYSTEMERROR ZCONNECTIONLOSS Specifically: send_buffer() calls send(2) with MSG_NOSIGNAL, which can return EPIPE; then send_buffer return -1, causing ZCONNECTIONLOSS from flush_send_queue(). Current async API calls drop the return value from flush_send_queue(), as below: adaptor_send_queue(zh, 0); return (rc < 0)?ZMARSHALLINGERROR:ZOK; The async API then returns ZOK instead of ZCONNECTIONLOSS. Author: Sam Mikes <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Damien Diederen <[email protected]> Closes apache#1602 from smikes/asyncsend-returncode-3.6
…20 - CVE-2020-27223 The OWASP checker reports that the version of Jetty currently referenced by this branch is vulnerable to a CVE: [ERROR] Failed to execute goal org.owasp:dependency-check-maven:5.3.0:check (default-cli) on project zookeeper: [ERROR] [ERROR] One or more dependencies were identified with vulnerabilities that have a CVSS score greater than or equal to '0.0': [ERROR] [ERROR] jetty-server-9.4.35.v20201120.jar: CVE-2020-27223 [ERROR] jetty-http-9.4.35.v20201120.jar: CVE-2020-27223 https://nvd.nist.gov/vuln/detail/CVE-2020-27223 describes it as: > In Eclipse Jetty 9.4.6.v20170531 to 9.4.36.v20210114 (inclusive), > 10.0.0, and 11.0.0 when Jetty handles a request containing multiple > Accept headers with a large number of "quality" (i.e. q) parameters, > the server may enter a denial of service (DoS) state due to high CPU > usage processing those quality values, resulting in minutes of CPU > time exhausted processing those quality values. This changeset bumps Jetty to 9.4.38.v20210224, which is the latest as of the commit date. Author: Damien Diederen <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mohammad Arshad <[email protected]> Closes apache#1623 from ztzg/ZOOKEEPER-4023-jetty-CVE-2020-27223 and squashes the following commits: 7cb65fb [Damien Diederen] zookeeper-server: Distribution tarball does not include jetty-client 59cffa1 [Damien Diederen] ZOOKEEPER-4233: dependency-check:check failing - Jetty 9.4.35.v20201120 - CVE-2020-27223
Author: Mohammad Arshad <[email protected]> Reviewers: Enrico Olivelli <[email protected]> Closes apache#1616 from arshadmohammad/ZOOKEEPER-4227
… in RestMain Author: Mukti <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mohammad Arshad <[email protected]> Closes apache#1633 from MuktiKrishnan/ZOOKEEPER-4230-master
…executing commands -waitforconnection option will make zk client wait for -timeout time to connect to zk server. timeout time is 30ms by default but can be specified explicitly for a session using -timeout option in command line. Author: Mukti <[email protected]> Reviewers: maoling <[email protected]>, Mohammad Arshad <[email protected]> Closes apache#1626 from MuktiKrishnan/ZOOKEEPER-1871-master and squashes the following commits: 2947514 [Mukti] ZOOKEEPER-1871: Removed statement which was re-creating zookeeper admin in ZooKeeperMain.java and added documentation for waitforconnection in zookeeperCLI.md and c475d46 [Mukti] ZOOKEEPER-1871: Add an option to zkCli to wailt for connection before executing commands
…d free port …d free port Author: Amichai Rothman <[email protected]> Reviewers: Damien Diederen <[email protected]>,Andor Molnar <[email protected]>,Christopher Tubbs <[email protected]>,Mohammad Arshad <[email protected]> Closes apache#1599 from amichair/ZOOKEEPER-4205
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Quality Gates: FAILED
- Declining Code Health: 16 findings(s) 🚩
- Improving Code Health: 13 findings(s) ✅
- Affected Hotspots: 10 files(s) 🔥
Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Complex Method QuorumPeerConfig.java: parseProperties🔥
- Complex Method PrepRequestProcessor.java: pRequest2Txn🔥
- Complex Method cli.c: main
- Complex Method Learner.java: syncWithLeader
- Complex Method FastLeaderElection.java: lookForLeader🔥
- Code Duplication ZooKeeperQuotaTest.java: testMultiCreateThenSetDataShouldWork
- Complex Method Leader.java: lead🔥
- Deep, Nested Complexity QuorumOracleMaj.java: revalidateOutstandingProp
- Overall Code Complexity AuditHelper.java
- Complex Method QuorumBase.java: startServers
- Large Method QuorumBase.java: setUp
- Excess Number of Function Arguments QuorumPeerConfig.java: parseDynamicConfig🔥
- String Heavy Function Arguments AuditHelper.java
- Complex Method ZooKeeperMain.java: connectToZK🔥
- Complex Method ZooKeeperMain.java: ZooKeeperMain.MyCommandOptions.parseOptions🔥
- Bumpy Road Ahead EmptiedSnapshotRecoveryTest.java: testRestoreWithTrustedEmptySnapFilesWhenFollowing
✅ Positive Code Health Impact (highest to lowest):
- Overall Code Complexity zookeeper.c🔥
- Lines of Code in a Single File zookeeper.c🔥
- Lines of Code in a Single File ZooKeeperServer.java🔥
- Overall Code Complexity ZooInspectorManagerImpl.java
- Bumpy Road Ahead FastLeaderElection.java: lookForLeader🔥
- Complex Method zookeeper.c: zoo_amulti🔥
- Complex Method zookeeper.c: aremove_watches🔥
- String Heavy Function Arguments ZooInspectorManagerImpl.java
- Primitive Obsession ZooInspectorManagerImpl.java
- Primitive Obsession QuorumPeerConfig.java🔥
- Primitive Obsession FastLeaderElection.java🔥
- Complex Method zookeeper.c: zoo_acreate_ttl🔥
- Complex Method zookeeper.c: zoo_acreate2_ttl🔥
} else if (key.equals("oraclePath")) { | ||
oraclePath = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Getting worse: Complex Method
parseProperties increases in cyclomatic complexity from 91 to 92, threshold = 9
Why does this problem occur?
This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.
@@ -52,6 +52,7 @@ | |||
import org.apache.zookeeper.server.quorum.auth.QuorumAuth; | |||
import org.apache.zookeeper.server.quorum.flexible.QuorumHierarchical; | |||
import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; | |||
import org.apache.zookeeper.server.quorum.flexible.QuorumOracleMaj; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Getting better: Primitive Obsession
The ratio of primitive types in function arguments decreases from 76,00% to 75,86%, threshold = 30,0%
Why does this problem occur?
The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments. Read more.
@@ -674,7 +670,7 @@ void setupQuorumPeerConfig(Properties prop, boolean configBackwardCompatibilityM | |||
* @throws IOException | |||
* @throws ConfigException | |||
*/ | |||
public static QuorumVerifier parseDynamicConfig(Properties dynamicConfigProp, int eAlg, boolean warnings, boolean configBackwardCompatibilityMode) throws IOException, ConfigException { | |||
public static QuorumVerifier parseDynamicConfig(Properties dynamicConfigProp, int eAlg, boolean warnings, boolean configBackwardCompatibilityMode, String oraclePath) throws IOException, ConfigException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ New issue: Excess Number of Function Arguments
parseDynamicConfig has 5 arguments, threshold = 4
Why does this problem occur?
This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments. Read more.
@@ -52,6 +52,7 @@ | |||
import org.apache.zookeeper.server.quorum.auth.QuorumAuth; | |||
import org.apache.zookeeper.server.quorum.flexible.QuorumHierarchical; | |||
import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; | |||
import org.apache.zookeeper.server.quorum.flexible.QuorumOracleMaj; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ Getting worse: String Heavy Function Arguments
The ratio of strings in function arguments increases from 40,00% to 41,38%, threshold = 39,0%
Why does this problem occur?
The functions in this file have a high ratio of strings as arguments. Avoid adding more. Read more.
+ " tickTime {}" | ||
+ " minSessionTimeout {}" | ||
+ " maxSessionTimeout {}" | ||
+ " tickTime {} ms" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Getting better: Lines of Code in a Single File
The lines of code decreases from 1437 to 1435, improve code health by reducing it to 1000
Why does this problem occur?
The number of Lines of Code in a single file. More Lines of Code lowers the code health. Read more.
|
||
return nonblocking_send(zh, rc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Getting better: Complex Method
zoo_acreate_ttl decreases in cyclomatic complexity from 12 to 11, threshold = 9
Why does this problem occur?
This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.
@@ -279,7 +279,7 @@ static void queue_completion_nolock(completion_head_t *list, completion_list_t * | |||
int add_to_front); | |||
static void queue_completion(completion_head_t *list, completion_list_t *c, | |||
int add_to_front); | |||
static int handle_socket_error_msg(zhandle_t *zh, int line, int rc, | |||
static int handle_socket_error_msg(zhandle_t *zh, int line, const char *func, int rc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 4,84 to 4,76, threshold = 4
Why does this problem occur?
This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals. Read more.
} else if (opt.equals("-waitforconnection")) { | ||
options.put("waitforconnection", "true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Getting worse: Complex Method
ZooKeeperMain.MyCommandOptions.parseOptions increases in cyclomatic complexity from 9 to 10, threshold = 9
Why does this problem occur?
This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.
if (cl.getOption("waitforconnection") != null) { | ||
connectLatch = new CountDownLatch(1); | ||
} | ||
|
||
int timeout = Integer.parseInt(cl.getOption("timeout")); | ||
zk = new ZooKeeperAdmin(host, timeout, new MyWatcher(), readOnly, clientConfig); | ||
if (connectLatch != null) { | ||
if (!connectLatch.await(timeout, TimeUnit.MILLISECONDS)) { | ||
zk.close(); | ||
throw new IOException(KeeperException.create(KeeperException.Code.CONNECTIONLOSS)); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ New issue: Complex Method
connectToZK has a cyclomatic complexity of 10, threshold = 9
Why does this problem occur?
This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.
@@ -774,4 +774,25 @@ private void assertClientAuthInfo(List<String> expected, String actual) { | |||
}); | |||
} | |||
|
|||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ Getting worse: Low Cohesion
The number of different responsibilities increases from 21 to 22, threshold = 3
Why does this problem occur?
Cohesion is calculated using the LCOM4 metric. Low cohesion means that the module/class has multiple unrelated responsibilities, doing too many things and breaking the Single Responsibility Principle. Read more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Quality Gates: FAILED
- Declining Code Health: 16 findings(s) 🚩
- Improving Code Health: 13 findings(s) ✅
- Affected Hotspots: 10 files(s) 🔥
Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Complex Method QuorumPeerConfig.java: parseProperties🔥
- Complex Method PrepRequestProcessor.java: pRequest2Txn🔥
- Complex Method cli.c: main
- Complex Method Learner.java: syncWithLeader
- Complex Method FastLeaderElection.java: lookForLeader🔥
- Code Duplication ZooKeeperQuotaTest.java: testMultiCreateThenSetDataShouldWork
- Complex Method Leader.java: lead🔥
- Deep, Nested Complexity QuorumOracleMaj.java: revalidateOutstandingProp
- Overall Code Complexity AuditHelper.java
- Complex Method QuorumBase.java: startServers
- Large Method QuorumBase.java: setUp
- Excess Number of Function Arguments QuorumPeerConfig.java: parseDynamicConfig🔥
- String Heavy Function Arguments AuditHelper.java
- Complex Method ZooKeeperMain.java: connectToZK🔥
- Complex Method ZooKeeperMain.java: ZooKeeperMain.MyCommandOptions.parseOptions🔥
- Bumpy Road Ahead EmptiedSnapshotRecoveryTest.java: testRestoreWithTrustedEmptySnapFilesWhenFollowing
✅ Positive Code Health Impact (highest to lowest):
- Overall Code Complexity zookeeper.c🔥
- Lines of Code in a Single File zookeeper.c🔥
- Lines of Code in a Single File ZooKeeperServer.java🔥
- Overall Code Complexity ZooInspectorManagerImpl.java
- Bumpy Road Ahead FastLeaderElection.java: lookForLeader🔥
- Complex Method zookeeper.c: zoo_amulti🔥
- Complex Method zookeeper.c: aremove_watches🔥
- String Heavy Function Arguments ZooInspectorManagerImpl.java
- Primitive Obsession ZooInspectorManagerImpl.java
- Primitive Obsession QuorumPeerConfig.java🔥
- Primitive Obsession FastLeaderElection.java🔥
- Complex Method zookeeper.c: zoo_acreate_ttl🔥
- Complex Method zookeeper.c: zoo_acreate2_ttl🔥
No description provided.