cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [cassandra] dcapwell commented on a change in pull request #388: CASSANDRA-15429: Support NodeTool in dtest
Date Tue, 10 Dec 2019 22:37:14 GMT
dcapwell commented on a change in pull request #388: CASSANDRA-15429: Support NodeTool in dtest

 File path: test/distributed/org/apache/cassandra/distributed/mock/nodetool/
 @@ -0,0 +1,241 @@
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.distributed.mock.nodetool;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.ColumnFamilyStoreMBean;
+import org.apache.cassandra.db.HintedHandOffManager;
+import org.apache.cassandra.db.compaction.CompactionManager;
+import org.apache.cassandra.gms.FailureDetector;
+import org.apache.cassandra.gms.FailureDetectorMBean;
+import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.locator.EndpointSnitchInfo;
+import org.apache.cassandra.locator.EndpointSnitchInfoMBean;
+import org.apache.cassandra.metrics.CassandraMetricsRegistry;
+import org.apache.cassandra.metrics.DefaultNameFactory;
+import org.apache.cassandra.metrics.MetricNameFactory;
+import org.apache.cassandra.service.CacheService;
+import org.apache.cassandra.service.CacheServiceMBean;
+import org.apache.cassandra.service.GCInspector;
+import org.apache.cassandra.service.StorageProxy;
+import org.apache.cassandra.service.StorageService;
+import org.apache.cassandra.streaming.StreamManager;
+public class InternalNodeProbe extends NodeProbe
+    // dummy constructors
+    public InternalNodeProbe(String host, int port, String username, String password) throws
+    {
+        super(host, port, username, password);
+    }
+    public InternalNodeProbe(String host, int port) throws IOException
+    {
+        super(host, port);
+    }
+    protected void connect() throws IOException
+    {
+        // note that we are not connecting via JMX for testing
+        mbeanServerConn = null;
+        jmxc = null;
+        ssProxy = StorageService.instance;
+        msProxy = MessagingService.instance();
+        streamProxy = StreamManager.instance;
+        compactionProxy = CompactionManager.instance;
+        fdProxy = (FailureDetectorMBean) FailureDetector.instance;
+        cacheService = CacheService.instance;
+        spProxy = StorageProxy.instance;
+        hhProxy = HintedHandOffManager.instance;
+        gcProxy = new GCInspector();
+        gossProxy = Gossiper.instance;
+        memProxy = ManagementFactory.getMemoryMXBean();
+        runtimeProxy = ManagementFactory.getRuntimeMXBean();
+    }
+    @Override
+    public void close() throws IOException
+    {
+        // nothing to close. no-op
+    }
+    @Override
+    // overrides all the methods referenced mbeanServerConn/jmxc in super
+    public EndpointSnitchInfoMBean getEndpointSnitchInfoProxy()
+    {
+        return new EndpointSnitchInfo();
+    }
+    @Override
+    public CacheServiceMBean getCacheServiceMBean()
+    {
+        return cacheService;
+    }
+    @Override
+    public void setCacheCapacities(int keyCacheCapacity, int rowCacheCapacity, int counterCacheCapacity)
 Review comment:
   The main issues with this are that it is easier to not be maintained (new `NodeProbe` command
added but not updated internal, bugs in existing commands get fixed but not ported to internal,
etc.), and by forking you add a larger surface area which could add bugs.  Its possible that
the forks change the behavior, and by doing so cause w/e tests use them to pass, but when
we use the command on a real cluster it fails.
   > The NodeProbe is messy already. No test cases
   I 100% agree this is an issue, but by trying to "mock", you actually make it so no tests
which use this are actually testing the real code; see point above.
   > new methods added in the class only for the purpose of the new commands
   And that can keep happening.  Since it can keep happening, the maintenance becomes high
if we go with "mock"
   > In principle, refactoring the NodeProbe is welcoming. But I think it deserves a separate
   Adding the cache service field should be part of that...
   My personal preference would be to block this PR on that change.  If you want to do that
first, that's fine by me, but I am concerned with the maintenance cost by not doing it, so
would rather not move the "mock" in.  
   In looking at your changes, a few small refactors would actually be enough to get all your
overrides to go away.

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message