Index: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java
===================================================================
--- oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java	(revision 1530932)
+++ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionNamespaces.java	(working copy)
@@ -18,6 +18,7 @@
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -51,18 +52,17 @@
      */
     private final Map<String, String> namespaces;
 
-    /**
-     * A snapshot of the namespace registry when these SessionNamespaces
-     * are first accessed. Key: prefix, value: uri
-     */
-    private Map<String, String> snapshotPrefixUri;
-    
-    /**
-     * A snapshot of the namespace registry when these SessionNamespaces
-     * are first accessed. Key: uri, value: prefix
-     */
-    private Map<String, String> snapshotUriPrefix;
-
+//    /**
+//     * A snapshot of the namespace registry when these SessionNamespaces
+//     * are first accessed. Key: prefix, value: uri
+//     */
+//    private Map<String, String> snapshotPrefixUri;
+//
+//    /**
+//     * A snapshot of the namespace registry when these SessionNamespaces
+//     * are first accessed. Key: uri, value: prefix
+//     */
+//    private Map<String, String> snapshotUriPrefix;
 
     private final SessionContext sessionContext;
 
@@ -114,11 +114,11 @@
             namespaces.put(prefix, uri);
         }
 
-        if (snapshotPrefixUri.containsKey(prefix)) {
-            // make sure we have a prefix in case an existing
-            // namespace uri is re-mapped
-            getNamespacePrefix(snapshotPrefixUri.get(prefix));
-        }
+//        if (snapshotPrefixUri.containsKey(prefix)) {
+//            // make sure we have a prefix in case an existing
+//            // namespace uri is re-mapped
+//            getNamespacePrefix(snapshotPrefixUri.get(prefix));
+//        }
     }
 
     /**
@@ -126,14 +126,17 @@
      */
     String[] getNamespacePrefixes() throws RepositoryException {
         init();
+        String[] existingPrefs = getNamespaceRegistry().getPrefixes();
         synchronized (namespaces) {
             if (namespaces.isEmpty()) {
-                Set<String> prefixes = snapshotPrefixUri.keySet();
-                return prefixes.toArray(new String[prefixes.size()]);
+                // Set<String> prefixes = snapshotPrefixUri.keySet();
+                // return prefixes.toArray(new String[prefixes.size()]);
+                return existingPrefs;
             }
         }
         Set<String> uris = new HashSet<String>();
-        uris.addAll(snapshotPrefixUri.values());
+        // uris.addAll(snapshotPrefixUri.values());
+         uris.addAll(Arrays.asList(getNamespaceRegistry().getURIs()));
         synchronized (namespaces) {
             // Add namespace uris only visible to session
             uris.addAll(namespaces.values());
@@ -154,9 +157,9 @@
             String uri = namespaces.get(prefix);
 
             if (uri == null) {
-                // Not in local mappings, try snapshot ones
-                uri = snapshotPrefixUri.get(prefix);
-                if (uri == null) {
+//                // Not in local mappings, try snapshot ones
+//                uri = snapshotPrefixUri.get(prefix);
+//                if (uri == null) {
                     // Not in snapshot mappings, try the global ones
                     uri = getNamespaceRegistry().getURI(prefix);
                     if (namespaces.containsValue(uri)) {
@@ -164,7 +167,7 @@
                         // so there are no mappings for this prefix
                         throw new NamespaceException("Namespace not found: " + prefix);
                     }
-                }
+//                }
             }
 
             return uri;
@@ -185,14 +188,14 @@
                 }
             }
 
-            // try snapshot
-            String prefix = snapshotUriPrefix.get(uri);
-            if (prefix != null && !namespaces.containsKey(prefix)) {
-                return prefix;
-            }
+//            // try snapshot
+//            String prefix = snapshotUriPrefix.get(uri);
+//            if (prefix != null && !namespaces.containsKey(prefix)) {
+//                return prefix;
+//            }
 
             // The following throws an exception if the URI is not found, that's OK
-            prefix = getNamespaceRegistry().getPrefix(uri);
+            String prefix = getNamespaceRegistry().getPrefix(uri);
 
             // Generate a new prefix if the global mapping is already taken
             String base = prefix;
@@ -233,17 +236,17 @@
     }
 
     private void init() throws RepositoryException {
-        if (snapshotPrefixUri == null) {
-            NamespaceRegistry registry = getNamespaceRegistry();
-            Map<String, String> prefixUri = new HashMap<String, String>();
-            Map<String, String> uriPrefix = new HashMap<String, String>();
-            for (String prefix : registry.getPrefixes()) {
-                String uri = registry.getURI(prefix);
-                prefixUri.put(prefix, uri);
-                uriPrefix.put(uri, prefix);
-            }
-            snapshotPrefixUri = prefixUri;
-            snapshotUriPrefix = uriPrefix;
-        }
+//        if (snapshotPrefixUri == null) {
+//            NamespaceRegistry registry = getNamespaceRegistry();
+//            Map<String, String> prefixUri = new HashMap<String, String>();
+//            Map<String, String> uriPrefix = new HashMap<String, String>();
+//            for (String prefix : registry.getPrefixes()) {
+//                String uri = registry.getURI(prefix);
+//                prefixUri.put(prefix, uri);
+//                uriPrefix.put(uri, prefix);
+//            }
+//            snapshotPrefixUri = prefixUri;
+//            snapshotUriPrefix = uriPrefix;
+//        }
     }
 }
