[ https://issues.apache.org/jira/browse/DRILL-5260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15881576#comment-15881576 ]
ASF GitHub Bot commented on DRILL-5260: --------------------------------------- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/753#discussion_r102844110 --- Diff: exec/java-exec/src/test/java/org/apache/drill/test/ClusterFixture.java --- @@ -295,8 +396,96 @@ public void close() throws Exception { if (ex != null) { throw ex; } + + // Delete any local files, if we wrote to the local + // persistent store. But, leave the files if the user wants + // to review them, for debugging, say. Note that, even if the + // files are preserved here, they will be removed when the + // next cluster fixture starts, else the CTTAS initialization + // will fail. + + if (! preserveLocalFiles) { + try { + removeLocalFiles(); + } catch (Exception e) { + ex = ex == null ? e : ex; + } + } + + // Remove temporary directories created for this cluster session. + + try { + removeTempDirs(); + } catch (Exception e) { + ex = ex == null ? e : ex; + } } + /** + * Removes files stored locally in the "local store provider." + * Required because CTTAS setup fails if these files are left from one + * run to the next. + * + * @throws IOException if a directory cannot be deleted + */ + + private void removeLocalFiles() throws IOException { + + // Don't delete if this is not a local Drillbit. + + if (! isLocal) { + return; + } + + // Don't delete if we did not write. + + if (! config.getBoolean(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE)) { + return; + } + + // Remove the local files if they exist. + + String localStoreLocation = config.getString(ExecConstants.SYS_STORE_PROVIDER_LOCAL_PATH); + File storeDir = new File(localStoreLocation); + if (! storeDir.exists()) { + return; + } + if (storeDir.exists()) { --- End diff -- Fixed. It is a nuisance that `deleteDirectory` throws an exception if the directory is already deleted... > Refinements to new "Cluster Fixture" test framework > --------------------------------------------------- > > Key: DRILL-5260 > URL: https://issues.apache.org/jira/browse/DRILL-5260 > Project: Apache Drill > Issue Type: Improvement > Affects Versions: 1.10 > Reporter: Paul Rogers > Assignee: Paul Rogers > Priority: Minor > Fix For: 1.10 > > > Roll-up of a number of enhancements to the cluster fixture framework. > * Config option to suppress printing of CSV and other output. (Allows > printing for single tests, not printing when running from Maven.) > * Parsing of query profiles to extract plan and run time information. > * Fix bug in log fixture when enabling logging for a package. > * Improved ZK support. > * Set up the new CTTAS default temporary workspace for tests. > * Revise TestDrillbitResiliance to use the new framework. > * Revise TestWindowFrame to to use the new framework. > * Revise TestMergeJoinWithSchemaChanges to use the new framework. -- This message was sent by Atlassian JIRA (v6.3.15#6346)