You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "smiklosovic (via GitHub)" <gi...@apache.org> on 2023/02/15 21:35:39 UTC

[GitHub] [cassandra] smiklosovic opened a new pull request, #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

smiklosovic opened a new pull request, #2159:
URL: https://github.com/apache/cassandra/pull/2159

   patch by Stefan Miklosovic; reviewed by TBD for CASSANDRA-18264
   
   Thanks for sending a pull request! Here are some tips if you're new here:
    
    * Ensure you have added or run the [appropriate tests](https://cassandra.apache.org/_/development/testing.html) for your PR.
    * Be sure to keep the PR description updated to reflect all changes.
    * Write your PR title to summarize what this PR proposes.
    * If possible, provide a concise example to reproduce the issue for a faster review.
    * Read our [contributor guidelines](https://cassandra.apache.org/_/development/index.html)
    * If you're making a documentation change, see our [guide to documentation contribution](https://cassandra.apache.org/_/development/documentation.html)
    
   Commit messages should follow the following format:
   
   ```
   <One sentence description, usually Jira title or CHANGES.txt summary>
   
   <Optional lengthier description (context on patch)>
   
   patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####
   
   Co-authored-by: Name1 <email1>
   Co-authored-by: Name2 <email2>
   
   ```
   
   The [Cassandra Jira](https://issues.apache.org/jira/projects/CASSANDRA/issues/)
   
   


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1108302695


##########
examples/triggers/README.adoc:
##########
@@ -0,0 +1,63 @@
+Cassandra Trigger Example

Review Comment:
   I reworked the readme to asciidoc as that is the documentation format we use.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1108301503


##########
examples/triggers/src/org/apache/cassandra/triggers/AuditTrigger.java:
##########
@@ -29,19 +29,27 @@
 import org.apache.cassandra.db.partitions.PartitionUpdate;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.utils.FBUtilities;
-import org.apache.cassandra.utils.UUIDGen;
+import org.apache.cassandra.utils.TimeUUID;
 
 public class AuditTrigger implements ITrigger

Review Comment:
   I tidied up this class a little bit and fixed it so it compiles again.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1108300701


##########
ide/idea/workspace.xml:
##########
@@ -227,6 +227,7 @@
                                           -Dcassandra.logdir=$PROJECT_DIR$/data/logs
                                           -Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true
                                           -Dcassandra.storagedir=$PROJECT_DIR$/data
+                                          -Dcassandra.triggers_dir=$PROJECT_DIR$/conf/triggers

Review Comment:
   This needs to be here otherwise running Cassandra from IDEA will not load that trigger which was installed there by `ant install` from `examples/triggers`.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1108302249


##########
examples/triggers/build.xml:
##########
@@ -57,7 +57,12 @@
 		</jar>
 	</target>
 
+	<target name="install" depends="jar">

Review Comment:
   Instructions in readme were telling to copy this jar manually to `conf/triggers`. There is no reason a user has to do that step manually if we can automate it.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic closed pull request #2159: CASSANDRA-18264 4.1 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic closed pull request #2159: CASSANDRA-18264 4.1 Fix copying of JAR of a trigger to temporary file
URL: https://github.com/apache/cassandra/pull/2159


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1108299693


##########
src/java/org/apache/cassandra/triggers/CustomClassLoader.java:
##########
@@ -83,7 +82,7 @@ public void addClassPath(File dir)
             logger.info("Loading new jar {}", inputJar.absolutePath());
             try
             {
-                copy(inputJar.toPath(), out.toPath());
+                copy(inputJar.toPath(), out.toPath(), StandardCopyOption.REPLACE_EXISTING);

Review Comment:
   because `FileUtils.createTempFile("cassandra-", ".jar", lib);` creates an empty file, copying here will fail because it will not copy it when the destination exists. We need to replace it.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1109068503


##########
examples/ssl-factory/test/unit/org/apache/cassandra/security/KubernetesSecretsSslContextFactoryTest.java:
##########
@@ -64,7 +64,7 @@ public static void prepare()
     private static void deleteFileIfExists(String file)
     {
         Path filePath = Paths.get(file);
-        boolean deleted = PathUtils.tryDelete(filePath);
+        boolean deleted = new File(filePath).toJavaIOFile().delete();

Review Comment:
   This is fine from checkstyle point of view. We are still using `File` wrapper for Cassandra.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1108298486


##########
src/java/org/apache/cassandra/triggers/CustomClassLoader.java:
##########
@@ -39,15 +38,15 @@
 
 /**
  * Custom class loader will load the classes from the class path, CCL will load
- * the classes from the the URL first, if it cannot find the required class it
- * will let the parent class loader do the its job.
+ * the classes from the URL first, if it cannot find the required class it
+ * will let the parent class loader do its job.
  *
  * Note: If the CCL is GC'ed then the associated classes will be unloaded.
  */
 public class CustomClassLoader extends URLClassLoader
 {
     private static final Logger logger = LoggerFactory.getLogger(CustomClassLoader.class);
-    private final Map<String, Class<?>> cache = new ConcurrentHashMap<String, Class<?>>();

Review Comment:
   this is not necessary from compiler



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2159: CASSANDRA-18264 Fix copying of JAR of a trigger to temporary file

Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #2159:
URL: https://github.com/apache/cassandra/pull/2159#discussion_r1108303126


##########
.gitignore:
##########
@@ -84,3 +84,5 @@ venv/
 # build-scripts will put cassandra-builds into the directory
 cassandra-builds/
 cassandra-dtest/
+
+conf/triggers/trigger-example.jar

Review Comment:
   If somebody forgets to do `ant clean` on triggers example and commits.



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org