diff --git a/RELEASE.md b/RELEASE.md index 44700488..fd6cc0b8 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,7 @@ # Release Notes +## [4.5.1] - 2024-10-11 +- Made CDM generated SCB unique & much short-lived when using the TLS option to connect to Astra more securely. + ## [4.5.0] - 2024-10-03 - Upgraded to use log4j 2.x and included a template properties file that will help separate general logs from CDM class specific logs including a separate log for rows identified by `DiffData` (Validation) errors. - Upgraded to use Spark `3.5.3`. diff --git a/src/main/java/com/datastax/cdm/data/DataUtility.java b/src/main/java/com/datastax/cdm/data/DataUtility.java index 76d6d003..2df21b7a 100644 --- a/src/main/java/com/datastax/cdm/data/DataUtility.java +++ b/src/main/java/com/datastax/cdm/data/DataUtility.java @@ -31,7 +31,8 @@ import com.datastax.cdm.schema.CqlTable; public class DataUtility { - public static final Logger logger = LoggerFactory.getLogger(CqlConversion.class); + public static final Logger logger = LoggerFactory.getLogger(DataUtility.class.getName()); + protected static final String SCB_FILE_NAME = "_temp_cdm_scb_do_not_touch.zip"; public static boolean diff(Object obj1, Object obj2) { @@ -151,19 +152,19 @@ public static String getMyClassMethodLine(Exception e) { return "Unknown"; } - public static void deleteGeneratedSCB() { - File file = new File(PKFactory.Side.ORIGIN + SCB_FILE_NAME); + public static void deleteGeneratedSCB(long runId) { + File file = new File(PKFactory.Side.ORIGIN + "_" + Long.toString(runId) + SCB_FILE_NAME); if (file.exists()) { file.delete(); } - file = new File(PKFactory.Side.TARGET + SCB_FILE_NAME); + file = new File(PKFactory.Side.TARGET + "_" + Long.toString(runId) + SCB_FILE_NAME); if (file.exists()) { file.delete(); } } public static File generateSCB(String host, String port, String trustStorePassword, String trustStorePath, - String keyStorePassword, String keyStorePath, PKFactory.Side side) throws IOException { + String keyStorePassword, String keyStorePath, PKFactory.Side side, long runId) throws IOException { FileOutputStream fileOutputStream = new FileOutputStream("config.json"); String scbJson = new StringBuilder("{\"host\": \"").append(host).append("\", \"port\": ").append(port) .append(", \"keyStoreLocation\": \"./identity.jks\", \"keyStorePassword\": \"").append(keyStorePassword) @@ -175,7 +176,8 @@ public static File generateSCB(String host, String port, String trustStorePasswo FilePathAndNewName configFileWithName = new FilePathAndNewName(configFile, "config.json"); FilePathAndNewName keyFileWithName = new FilePathAndNewName(new File(keyStorePath), "identity.jks"); FilePathAndNewName trustFileWithName = new FilePathAndNewName(new File(trustStorePath), "trustStore.jks"); - File zipFile = zip(Arrays.asList(configFileWithName, keyFileWithName, trustFileWithName), side + SCB_FILE_NAME); + File zipFile = zip(Arrays.asList(configFileWithName, keyFileWithName, trustFileWithName), + side + "_" + Long.toString(runId) + SCB_FILE_NAME); configFile.delete(); return zipFile; diff --git a/src/main/java/com/datastax/cdm/job/AbstractJobSession.java b/src/main/java/com/datastax/cdm/job/AbstractJobSession.java index 5c718547..991ae14a 100644 --- a/src/main/java/com/datastax/cdm/job/AbstractJobSession.java +++ b/src/main/java/com/datastax/cdm/job/AbstractJobSession.java @@ -110,12 +110,12 @@ public synchronized void initCdmRun(long runId, long prevRunId, Collection