title: GCS - Global Consistency with delete + rename
body: <p>My issue may be a result of my misunderstanding with global consistency in google storage, but since I have not experienced this issue until just recently (mid November) and now it seems easily reproducible, I wanted some clarification.  The issue started happening in a piece of spark code running on compute engine using bdutil but I can reproduce from the command line with gsutil.</p>
  
  <p>My code is deleting a destination path and then immediately renaming a source path as the destination path.  With global consistency I would expect since the destination path no longer exists, the src would be renamed to the destination, but instead the src is being nested inside destination as if the destination still exists and that is not consistent.</p>
  
  <p>The hadoop code to reproduce looks like:</p>
  
  <pre><code>fs.delete(new Path(dest), true)
  fs.rename(new Path(src), new Path(dest))
  </code></pre>
  
  <p>From command line I can reproduce with:</p>
  
  <pre><code>gsutil -m rm -r gs://mybucket/dest
  gsutil -m cp -r gs://mybucket/src gs://mybucket/dest
  </code></pre>
  
  <p>If the reason is because list operations are eventually consistent and the FileSystem implementation is using list operations to determine if the destination still exists, then I understand, and then is there a recommended solution to ensure the destination no longer exists before renaming?</p>
  
  <p>Thanks,
  Luke</p>