This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch import-nouveau
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/import-nouveau by this push:
     new d9483017e cleanup nested indexes correctly
d9483017e is described below

commit d9483017e3e25f14cdb2f2619c0a03d74e8ed5b0
Author: Robert Newson <[email protected]>
AuthorDate: Wed Apr 19 23:06:12 2023 +0100

    cleanup nested indexes correctly
---
 .../org/apache/couchdb/nouveau/core/IndexManager.java    | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git 
a/nouveau/src/main/java/org/apache/couchdb/nouveau/core/IndexManager.java 
b/nouveau/src/main/java/org/apache/couchdb/nouveau/core/IndexManager.java
index 095400351..e0d0ea617 100644
--- a/nouveau/src/main/java/org/apache/couchdb/nouveau/core/IndexManager.java
+++ b/nouveau/src/main/java/org/apache/couchdb/nouveau/core/IndexManager.java
@@ -167,19 +167,17 @@ public final class IndexManager implements Managed {
                 } catch (final IOException e) {
                     LOGGER.error("I/O exception deleting " + p, e);
                 }
+                // Clean any newly empty directories.
+                do {
+                    final File f = p.toFile();
+                    if (f.isDirectory() && f.list().length == 0) {
+                        f.delete();
+                    }
+                } while ((p = p.getParent()) != null && !rootDir.equals(p));
             });
         } finally {
             stream.close();
         }
-
-        // Clean any newly empty directories.
-        Path p = indexRootPath;
-        do {
-            final File f = p.toFile();
-            if (f.isDirectory() && f.list().length == 0) {
-                f.delete();
-            }
-        } while ((p = p.getParent()) != null && !rootDir.equals(p));
     }
 
     private void deleteIndex(final String name) throws IOException {

Reply via email to