jyothsnakonisa commented on code in PR #175:
URL:
https://github.com/apache/cassandra-analytics/pull/175#discussion_r2923267889
##########
cassandra-analytics-common/src/main/java/org/apache/cassandra/cdc/msg/RangeTombstoneBuilder.java:
##########
@@ -25,40 +25,22 @@
/**
* Keep track of the last range tombstone marker to build {@link
RangeTombstone}
* The caller should check whether {@link #canBuild()} after adding marker,
and it should build whenever possible.
+ * IMPLEMENTATION NOTE: Refactored from abstract class to interface, due to
classloader clash. Superclass is loaded
+ * by application classloader, but concrete implementation (from bridge
module) with dedicated classloader.
*
* @param <T>
*/
-public abstract class RangeTombstoneBuilder<T>
+public interface RangeTombstoneBuilder<T>
{
- RangeTombstone rangeTombstone;
- boolean expectOpen = true;
-
- public RangeTombstone buildTombstone(List<Value> start, boolean
isStartInclusive, List<Value> end, boolean isEndInclusive)
- {
- return new RangeTombstone(start, isStartInclusive, end,
isEndInclusive);
- }
-
- public boolean canBuild()
- {
- return rangeTombstone != null;
- }
-
- public RangeTombstone build()
- {
- RangeTombstone res = rangeTombstone;
- rangeTombstone = null;
- return res;
- }
-
- public abstract void add(T marker);
+ RangeTombstone buildTombstone(List<Value> start, boolean isStartInclusive,
List<Value> end, boolean isEndInclusive);
+ boolean canBuild();
+ RangeTombstone build();
+ void add(T marker);
Review Comment:
Can you add documentation to these interface methods?
##########
cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/bridge/AbstractCdcBridgeImplementation.java:
##########
@@ -79,6 +82,28 @@ public void log(CqlTable cqlTable, CommitLogInstance log,
Row row, long timestam
log(TimeProvider.DEFAULT, cqlTable, log, row, timestamp);
}
+ public CommitLogInstance createCommitLogInstance(Path path)
+ {
+ return new FourZeroCommitLog(path);
Review Comment:
As per my understanding commit log implementation has not changed between
4.0 and 5.0 but just double checking that returning FourZeroCommitLog is
correct or not
##########
cassandra-bridge/src/main/java/org/apache/cassandra/bridge/CdcBridge.java:
##########
@@ -59,6 +60,10 @@ public void log(CqlTable cqlTable, CommitLogInstance log,
Row row, long timestam
log(TimeProvider.DEFAULT, cqlTable, log, row, timestamp);
}
+ public abstract CommitLogInstance createCommitLogInstance(Path path);
+
+ public abstract TableIdLookup internalTableIdLookup();
+
Review Comment:
Can you please add java docs?
##########
cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/bridge/AbstractCdcBridgeImplementation.java:
##########
@@ -79,6 +82,28 @@ public void log(CqlTable cqlTable, CommitLogInstance log,
Row row, long timestam
log(TimeProvider.DEFAULT, cqlTable, log, row, timestamp);
}
+ public CommitLogInstance createCommitLogInstance(Path path)
+ {
+ return new FourZeroCommitLog(path);
+ }
+
+ public TableIdLookup internalTableIdLookup()
+ {
+ return new TableIdLookup()
+ {
+ @Nullable
+ public UUID lookup(String keyspace, String table) throws
NoSuchElementException
+ {
+ TableMetadata tm = Schema.instance.getTableMetadata(keyspace,
table);
+ if (tm == null)
+ {
+ throw new NoSuchElementException();
+ }
+ return tm.id.asUUID();
+ }
+ };
Review Comment:
You are creating a new instance of TableIdLookup for every invocation of
this method, instead can you have a single instance and return it on every call?
##########
cassandra-five-zero-bridge/src/main/java/org/apache/cassandra/bridge/CdcBridgeImplementation.java:
##########
@@ -67,6 +67,8 @@ protected static synchronized void setCDC(Path path, int
commitLogSegmentSize, b
DatabaseDescriptor.setCommitLogSyncGroupWindow(30);
DatabaseDescriptor.setCommitLogSegmentSize(commitLogSegmentSize);
DatabaseDescriptor.getRawConfig().commitlog_total_space = new
DataStorageSpec.IntMebibytesBound(1024);
+
DatabaseDescriptor.setCommitLogWriteDiskAccessMode(Config.DiskAccessMode.direct);
Review Comment:
Can u check if it's okay to hardcode it, curious if this changes based on
hardware
##########
cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/cdc/msg/AbstractRangeTombstoneBuilder.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.cdc.msg;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public abstract class AbstractRangeTombstoneBuilder<T> implements
RangeTombstoneBuilder<T>
+{
+ RangeTombstone rangeTombstone;
+ boolean expectOpen = true;
Review Comment:
May be make them protected?
--
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]