smiklosovic commented on code in PR #2117:
URL: https://github.com/apache/cassandra/pull/2117#discussion_r1090314635


##########
src/java/org/apache/cassandra/db/compaction/CompactionManager.java:
##########
@@ -1848,7 +1848,7 @@ public void run()
                 }
             }
         };
-
+        

Review Comment:
   this is not necessary, please return it back as it was.



##########
src/java/org/apache/cassandra/db/virtual/SnapshotsTable.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.db.virtual;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.cassandra.db.SnapshotDetailsTabularData;
+import org.apache.cassandra.db.marshal.BooleanType;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.dht.LocalPartitioner;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.StorageService;
+
+public class SnapshotsTable extends AbstractVirtualTable
+{
+    private static final String SNAPSHOT_NAME = "snapshot_name";
+    private static final String KEYSPACE_NAME = "keyspace_name";
+    private static final String COLUMNFAMILY_NAME = "columnfamily_name";
+    private static final String TRUE_SIZE = "true_size";
+    private static final String SIZE_ON_DISK = "size_on_disk";
+    private static final String CREATE_TIME = "created_at";
+    private static final String EXPIRATION_TIME = "expires_at";
+    private static final String EPHEMERAL = "ephemeral";
+    
+    SnapshotsTable(String keyspace)
+    {
+        super(TableMetadata.builder(keyspace, "snapshots")
+                           .comment("tables snapshots")

Review Comment:
   I would change this to "available snapshots" or "current snapshots" or 
"present snapshots"



##########
src/java/org/apache/cassandra/db/virtual/SnapshotsTable.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.db.virtual;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.cassandra.db.SnapshotDetailsTabularData;
+import org.apache.cassandra.db.marshal.BooleanType;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.dht.LocalPartitioner;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.StorageService;
+
+public class SnapshotsTable extends AbstractVirtualTable
+{
+    private static final String SNAPSHOT_NAME = "snapshot_name";
+    private static final String KEYSPACE_NAME = "keyspace_name";
+    private static final String COLUMNFAMILY_NAME = "columnfamily_name";
+    private static final String TRUE_SIZE = "true_size";
+    private static final String SIZE_ON_DISK = "size_on_disk";
+    private static final String CREATE_TIME = "created_at";
+    private static final String EXPIRATION_TIME = "expires_at";
+    private static final String EPHEMERAL = "ephemeral";
+    
+    SnapshotsTable(String keyspace)
+    {
+        super(TableMetadata.builder(keyspace, "snapshots")
+                           .comment("tables snapshots")
+                           .kind(TableMetadata.Kind.VIRTUAL)
+                           .partitioner(new 
LocalPartitioner(UTF8Type.instance))
+                           .addPartitionKeyColumn(SNAPSHOT_NAME, 
UTF8Type.instance)

Review Comment:
   I would change the key. Partition key would be keyspace and clustering 
column would be table and name of the snapshot. That way, you can ask:
   
   ````
   use system_views;
   select * from snapshots;
   select * from snapshots where keyspace = 'ks1';
   select * from snapshots where keyspace = 'ks1' and table = 'tb1';
   select * from snapshots where keyspace = 'ks1' and table = 'tb1' and name = 
"mysnapshot";
   ````
   
   In practice, I think it is more common to ask questions like "what snapshots 
this keyspace / table" has? Instead of querying that table by name of the 
particular snapshot. What if I do not know the name of the snapshot in advance?
   



##########
src/java/org/apache/cassandra/db/virtual/SnapshotsTable.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.db.virtual;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.cassandra.db.SnapshotDetailsTabularData;
+import org.apache.cassandra.db.marshal.BooleanType;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.dht.LocalPartitioner;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.StorageService;
+
+public class SnapshotsTable extends AbstractVirtualTable
+{
+    private static final String SNAPSHOT_NAME = "snapshot_name";
+    private static final String KEYSPACE_NAME = "keyspace_name";

Review Comment:
   isnt "keyspace" enough?



##########
src/java/org/apache/cassandra/db/virtual/SnapshotsTable.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.db.virtual;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.cassandra.db.SnapshotDetailsTabularData;
+import org.apache.cassandra.db.marshal.BooleanType;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.dht.LocalPartitioner;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.StorageService;
+
+public class SnapshotsTable extends AbstractVirtualTable
+{
+    private static final String SNAPSHOT_NAME = "snapshot_name";
+    private static final String KEYSPACE_NAME = "keyspace_name";
+    private static final String COLUMNFAMILY_NAME = "columnfamily_name";
+    private static final String TRUE_SIZE = "true_size";
+    private static final String SIZE_ON_DISK = "size_on_disk";
+    private static final String CREATE_TIME = "created_at";
+    private static final String EXPIRATION_TIME = "expires_at";
+    private static final String EPHEMERAL = "ephemeral";
+    
+    SnapshotsTable(String keyspace)
+    {
+        super(TableMetadata.builder(keyspace, "snapshots")
+                           .comment("tables snapshots")
+                           .kind(TableMetadata.Kind.VIRTUAL)
+                           .partitioner(new 
LocalPartitioner(UTF8Type.instance))
+                           .addPartitionKeyColumn(SNAPSHOT_NAME, 
UTF8Type.instance)
+                           .addClusteringColumn(KEYSPACE_NAME, 
UTF8Type.instance)
+                           .addClusteringColumn(COLUMNFAMILY_NAME, 
UTF8Type.instance)
+                           .addRegularColumn(TRUE_SIZE, LongType.instance)
+                           .addRegularColumn(SIZE_ON_DISK, LongType.instance)
+                           .addRegularColumn(CREATE_TIME, UTF8Type.instance)
+                           .addRegularColumn(EXPIRATION_TIME, 
UTF8Type.instance)
+                           .addRegularColumn(EPHEMERAL, BooleanType.instance)
+                           .build());
+    }
+  
+    @Override
+    public DataSet data() 
+    {
+        SimpleDataSet result = new SimpleDataSet(metadata());
+        
+        // include snapshots with ttl and ephemeral
+        Map<String, TabularData> snapshotDetails = 
StorageService.instance.getSnapshotDetails(ImmutableMap.of("no_ttl", "false", 
"include_ephemeral", "true"));
+        for(Map.Entry<String, TabularData> entry : snapshotDetails.entrySet())

Review Comment:
   `for (`



##########
src/java/org/apache/cassandra/db/virtual/SnapshotsTable.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.db.virtual;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.cassandra.db.SnapshotDetailsTabularData;
+import org.apache.cassandra.db.marshal.BooleanType;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.dht.LocalPartitioner;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.StorageService;
+
+public class SnapshotsTable extends AbstractVirtualTable
+{
+    private static final String SNAPSHOT_NAME = "snapshot_name";
+    private static final String KEYSPACE_NAME = "keyspace_name";
+    private static final String COLUMNFAMILY_NAME = "columnfamily_name";

Review Comment:
   I would rename "columnfamily" to "table" so "columnfamily_name" to "table" 
only?



##########
src/java/org/apache/cassandra/db/virtual/SnapshotsTable.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.db.virtual;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.cassandra.db.SnapshotDetailsTabularData;
+import org.apache.cassandra.db.marshal.BooleanType;
+import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.cassandra.dht.LocalPartitioner;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.StorageService;
+
+public class SnapshotsTable extends AbstractVirtualTable
+{
+    private static final String SNAPSHOT_NAME = "snapshot_name";

Review Comment:
   isnt "name" enough?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to