From 4d0589f3928422405fc21dcda7e03d3ff3864368 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 14 Aug 2009 17:29:45 -0700 Subject: [PATCH] Hadoop: Remove an exists call by checking return codes on mkdirs --- src/client/hadoop/ceph/CephFileSystem.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java index 5fc7ec1ebe988..8eff5cfa74073 100644 --- a/src/client/hadoop/ceph/CephFileSystem.java +++ b/src/client/hadoop/ceph/CephFileSystem.java @@ -47,7 +47,7 @@ import org.apache.hadoop.fs.FileStatus; public class CephFileSystem extends FileSystem { private static final long DEFAULT_BLOCK_SIZE = 4 * 1024 * 1024; - + private static final int EEXIST = 17; private URI uri; @@ -489,9 +489,9 @@ public class CephFileSystem extends FileSystem { // Step 2: create any nonexistent directories in the path Path parent = abs_path.getParent(); if (parent != null) { // if parent is root, we're done - if(!exists(parent)) { - mkdirs(parent); - } + int r = mkdirs(parent); + if (!(r==0 || r==-EEXIST)) + throw new IOException ("Error creating parent directory; code: " + r); } if (progress!=null) progress.progress(); // Step 3: open the file -- 2.39.5