Maxwell-Guo commented on code in PR #3237:
URL: https://github.com/apache/cassandra/pull/3237#discussion_r1556932269


##########
src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java:
##########
@@ -103,62 +108,72 @@ public static CommitLogArchiver construct()
             else
             {
                 commitlog_commands.load(stream);
-                String archiveCommand = 
commitlog_commands.getProperty("archive_command");
-                String restoreCommand = 
commitlog_commands.getProperty("restore_command");
-                String restoreDirectories = 
commitlog_commands.getProperty("restore_directories");
-                if (restoreDirectories != null && 
!restoreDirectories.isEmpty())
+                return getArchiverFromProperty(commitlog_commands);
+            }
+        }
+        catch (IOException e)
+        {
+            throw new RuntimeException("Unable to load 
commitlog_archiving.properties", e);
+        }
+    }
+
+    public static CommitLogArchiver getArchiverFromProperty(Properties 
commitlogCommands)
+    {
+        assert !commitlogCommands.isEmpty();
+        String archiveCommand = 
commitlogCommands.getProperty("archive_command");
+        String restoreCommand = 
commitlogCommands.getProperty("restore_command");
+        String restoreDirectories = 
commitlogCommands.getProperty("restore_directories");
+        if (restoreDirectories != null && !restoreDirectories.isEmpty())
+        {
+            for (String dir : restoreDirectories.split(DELIMITER))
+            {
+                File directory = new File(dir);
+                if (!directory.exists())
                 {
-                    for (String dir : restoreDirectories.split(DELIMITER))
+                    if (!directory.tryCreateDirectory())
                     {
-                        File directory = new File(dir);
-                        if (!directory.exists())
-                        {
-                            if (!directory.tryCreateDirectory())
-                            {
-                                throw new RuntimeException("Unable to create 
directory: " + dir);
-                            }
-                        }
+                        throw new RuntimeException("Unable to create 
directory: " + dir);
                     }
                 }
-                String targetTime = 
commitlog_commands.getProperty("restore_point_in_time");
-                TimeUnit precision = 
TimeUnit.valueOf(commitlog_commands.getProperty("precision", "MICROSECONDS"));
-                long restorePointInTime;
-                try
-                {
-                    restorePointInTime = Strings.isNullOrEmpty(targetTime) ? 
Long.MAX_VALUE : format.parse(targetTime).getTime();
-                }
-                catch (ParseException e)
-                {
-                    throw new RuntimeException("Unable to parse restore target 
time", e);
-                }
-
-                String snapshotPosition = 
commitlog_commands.getProperty("snapshot_commitlog_position");
-                CommitLogPosition snapshotCommitLogPosition;
-                try
-                {
+            }
+        }
+        String targetTime = 
commitlogCommands.getProperty("restore_point_in_time");
+        //todo remove this as this is not used
+        TimeUnit precision = 
TimeUnit.valueOf(commitlogCommands.getProperty("precision", "MICROSECONDS"));

Review Comment:
   I have removed this 



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