From d6ed4267a942b9441148cbe77d245e83eab367c8 Mon Sep 17 00:00:00 2001 From: Manuel Soulier Date: Thu, 12 Sep 2024 17:40:28 +0200 Subject: [PATCH] fix: test -> parquet support musn't trigger when parquet not required --- ...ortStep1InitializeClientTablesService.java | 4 ++- .../ImportStep3GetTableDataService.java | 5 +++- .../services/importServlet/dao/ClientDao.java | 26 +++++-------------- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep1InitializeClientTablesService.java b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep1InitializeClientTablesService.java index 407ab123..f7952c7f 100644 --- a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep1InitializeClientTablesService.java +++ b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep1InitializeClientTablesService.java @@ -72,7 +72,9 @@ public void execute(SendResponse resp) throws ArcException { } // drop tables from the client that had been requested from a former call - this.clientDao.dropPendingClientObjects(); + this.clientDao.dropPendingClientTables(); + + executeIfParquetDeclared(() -> this.clientDao.deletePendingClientParquet()); // create the table that will track the data table which has been built and retrieved createTrackTable(); diff --git a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java index 4a10d6a1..db4fce30 100644 --- a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java +++ b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java @@ -43,7 +43,10 @@ public void execute(SendResponse resp) throws ArcException { if (this.clientDao.isWebServiceNotPending()) { this.clientDao.dropTable(table); - this.clientDao.deleteParquet(table); + + if (arcClientIdentifier.getFormat().isParquet()) + this.clientDao.deleteParquet(table); + this.clientDao.deleteFromTrackTable(table.getTableName()); LoggerHelper.info(LOGGER, "Table " + table.getTableName() + " had been retrieved and dropped."); diff --git a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/dao/ClientDao.java b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/dao/ClientDao.java index c123dbc6..3fa68044 100644 --- a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/dao/ClientDao.java +++ b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/dao/ClientDao.java @@ -485,29 +485,14 @@ private String regExpClientTable() return client + "_([0123456789]{13,})_.*"; } - - /** - * drop objects generated by a client for called - * @throws ArcException - */ - public void dropPendingClientObjects() throws ArcException - { - LoggerHelper.info(LOGGER, "Dropping all client objects for client : "+this.client); - - // drop tables from the client that had been requested from a former call - dropPendingClientTables(); - - // drop parquet files that had been requested from a former call - deletePendingParquet(); - } - - /** * drop tables on coordinator and executors if it exists * @throws ArcException */ - private void dropPendingClientTables() throws ArcException + public void dropPendingClientTables() throws ArcException { + LoggerHelper.info(LOGGER, "Dropping all pending tables for client : "+this.client); + dropPendingClientTables(0); int numberOfExecutorNods = ArcDatabase.numberOfExecutorNods(); @@ -665,8 +650,11 @@ public void deleteParquet(TableToRetrieve table) throws ArcException { FileUtilsArc.deleteIfExists(new File(ParquetDao.exportTablePath(table,getParquetDirectory()))); } - private void deletePendingParquet() throws ArcException + public void deletePendingClientParquet() throws ArcException { + + LoggerHelper.info(LOGGER, "Delete all pending parquet files for client : "+this.client); + File parquetDirectory = new File(getParquetDirectory()); if (!parquetDirectory.exists())