Remove vestiges of Virtual pages

This concept was altered into confiscated pages, but some of the old
vestiges stuck around. This is just to remove them as the code is
not used and the terminology is very easy to conflate with the
terms used in the LSM wrapper.

Change-Id: I9ce8ea25a021d069e02eb15fcb80d703c06a883c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1413
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/FileMapManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/FileMapManager.java
index c492661..c4a294d 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/FileMapManager.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/FileMapManager.java
@@ -82,15 +82,4 @@
         name2IdMap.put(fileName, fileId);
     }
 
-    @Override
-    public int registerMemoryFile() {
-        Integer fileId = idCounter++;
-        id2nameMap.put(fileId, null);
-        return fileId;
-    }
-
-    @Override
-    public void unregisterMemFile(int fileId) throws HyracksDataException {
-        id2nameMap.remove(fileId);
-    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MultitenantVirtualBufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MultitenantVirtualBufferCache.java
index 3ef419e..6878fcf 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MultitenantVirtualBufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MultitenantVirtualBufferCache.java
@@ -131,17 +131,6 @@
         return vbc.getFileMapProvider();
     }
 
-    //These 4 methods are not applicable here
-    @Override
-    public int createMemFile() throws HyracksDataException {
-        throw new UnsupportedOperationException("Virtual Pages are not a valid concept in this context");
-    }
-
-    @Override
-    public void deleteMemFile(int fileId) throws HyracksDataException {
-        throw new UnsupportedOperationException("Virtual Pages are not a valid concept in this context");
-    }
-
     @Override
     public int getNumPagesOfFile(int fileId) throws HyracksDataException {
         throw new UnsupportedOperationException();
@@ -182,11 +171,6 @@
     }
 
     @Override
-    public void copyPage(ICachedPage src, ICachedPage dst) {
-
-    }
-
-    @Override
     public void setPageDiskId(ICachedPage page, long dpid) {
 
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java
index 49f9060..fce0b74 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java
@@ -350,16 +350,6 @@
         }
     }
 
-    //These 4 methods aren't applicable here.
-    @Override
-    public int createMemFile() throws HyracksDataException {
-        return 0;
-    }
-
-    @Override
-    public void deleteMemFile(int fileId) throws HyracksDataException {
-    }
-
     @Override
     public int getNumPagesOfFile(int fileId) throws HyracksDataException {
         synchronized (fileMapManager) {
@@ -405,11 +395,6 @@
     }
 
     @Override
-    public void copyPage(ICachedPage src, ICachedPage dst) {
-        throw new UnsupportedOperationException("Virtual buffer caches don't have FIFO writers");
-    }
-
-    @Override
     public void setPageDiskId(ICachedPage page, long dpid) {
 
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
index e201181..8391e5c 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
@@ -70,7 +70,6 @@
     private final IFileMapManager fileMapManager;
     private final CleanerThread cleanerThread;
     private final Map<Integer, BufferedFileHandle> fileInfoMap;
-    private final Set<Integer> virtualFiles;
     private final AsyncFIFOPageQueueManager fifoWriter;
     private final Queue<BufferCacheHeaderHelper> headerPageCache = new ConcurrentLinkedQueue<>();
 
@@ -104,7 +103,6 @@
 
         Executor executor = Executors.newCachedThreadPool(threadFactory);
         fileInfoMap = new HashMap<>();
-        virtualFiles = new HashSet<>();
         cleanerThread = new CleanerThread();
         executor.execute(cleanerThread);
         closed = false;
@@ -153,9 +151,9 @@
         synchronized (fileInfoMap) {
             fInfo = fileInfoMap.get(fileId);
         }
-        if (fInfo == null && !virtualFiles.contains(fileId)) {
+        if (fInfo == null) {
             throw new HyracksDataException("pin called on a fileId " + fileId + " that has not been created.");
-        } else if (fInfo != null && fInfo.getReferenceCount() <= 0) {
+        } else if (fInfo.getReferenceCount() <= 0) {
             throw new HyracksDataException("pin called on a fileId " + fileId + " that has not been opened.");
         }
     }
@@ -802,22 +800,6 @@
     }
 
     @Override
-    public int createMemFile() throws HyracksDataException {
-        if (LOGGER.isLoggable(fileOpsLevel)) {
-            LOGGER.log(fileOpsLevel, "Creating memory file in cache: " + this);
-        }
-        int fileId;
-        synchronized (fileInfoMap) {
-            fileId = fileMapManager.registerMemoryFile();
-        }
-        synchronized (virtualFiles) {
-            virtualFiles.add(fileId);
-        }
-        return fileId;
-
-    }
-
-    @Override
     public void openFile(int fileId) throws HyracksDataException {
         if (LOGGER.isLoggable(fileOpsLevel)) {
             LOGGER.log(fileOpsLevel, "Opening file: " + fileId + " in cache: " + this);
@@ -999,20 +981,6 @@
     }
 
     @Override
-    public synchronized void deleteMemFile(int fileId) throws HyracksDataException {
-        //TODO: possible sanity chcecking here like in above?
-        if (LOGGER.isLoggable(fileOpsLevel)) {
-            LOGGER.log(fileOpsLevel, "Deleting memory file: " + fileId + " in cache: " + this);
-        }
-        synchronized (virtualFiles) {
-            virtualFiles.remove(fileId);
-        }
-        synchronized (fileInfoMap) {
-            fileMapManager.unregisterMemFile(fileId);
-        }
-    }
-
-    @Override
     public void start() {
         // no op
     }
@@ -1378,13 +1346,6 @@
     }
 
     @Override
-    public void copyPage(ICachedPage src, ICachedPage dst) {
-        CachedPage srcCast = (CachedPage) src;
-        CachedPage dstCast = (CachedPage) dst;
-        System.arraycopy(srcCast.buffer.array(), 0, dstCast.getBuffer().array(), 0, srcCast.buffer.capacity());
-    }
-
-    @Override
     public boolean isReplicationEnabled() {
         if (ioReplicationManager != null) {
             return ioReplicationManager.isReplicationEnabled();
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/DebugBufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/DebugBufferCache.java
index 6c88275..4461069 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/DebugBufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/DebugBufferCache.java
@@ -177,16 +177,6 @@
     }
 
     @Override
-    public int createMemFile() throws HyracksDataException {
-        return bufferCache.createMemFile();
-    }
-
-    @Override
-    public void deleteMemFile(int fileId) throws HyracksDataException {
-        bufferCache.deleteMemFile(fileId);
-    }
-
-    @Override
     public int getNumPagesOfFile(int fileId) throws HyracksDataException {
         return bufferCache.getNumPagesOfFile(fileId);
     }
@@ -223,12 +213,6 @@
     }
 
     @Override
-    public void copyPage(ICachedPage src, ICachedPage dst) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
     public void setPageDiskId(ICachedPage page, long dpid) {
         // TODO Auto-generated method stub
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/IBufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/IBufferCache.java
index 27e7982..90273f4 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/IBufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/IBufferCache.java
@@ -30,16 +30,12 @@
 
     public void createFile(FileReference fileRef) throws HyracksDataException;
 
-    public int createMemFile() throws HyracksDataException;
-
     public void openFile(int fileId) throws HyracksDataException;
 
     public void closeFile(int fileId) throws HyracksDataException;
 
     public void deleteFile(int fileId, boolean flushDirtyPages) throws HyracksDataException;
 
-    public void deleteMemFile(int fileId) throws HyracksDataException;
-
     public ICachedPage tryPin(long dpid) throws HyracksDataException;
 
     public ICachedPage pin(long dpid, boolean newPage) throws HyracksDataException;
@@ -76,8 +72,6 @@
 
     public void finishQueue();
 
-    void copyPage(ICachedPage src, ICachedPage dst);
-
     void setPageDiskId(ICachedPage page, long dpid);
 
     public boolean isReplicationEnabled();
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/IFileMapManager.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/IFileMapManager.java
index acb4ba2..0d81776 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/IFileMapManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/IFileMapManager.java
@@ -47,7 +47,4 @@
      */
     public void unregisterFile(int fileId) throws HyracksDataException;
 
-    public int registerMemoryFile();
-
-    public void unregisterMemFile(int fileId) throws HyracksDataException;
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/TransientFileMapManager.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/TransientFileMapManager.java
index 05ff825..66d54b1 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/TransientFileMapManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/file/TransientFileMapManager.java
@@ -72,15 +72,4 @@
         name2IdMap.put(fileRef, fileId);
     }
 
-    @Override
-    public int registerMemoryFile() {
-        Integer fileId = idCounter++;
-        id2nameMap.put(fileId, null);
-        return fileId;
-    }
-
-    @Override
-    public void unregisterMemFile(int fileId) throws HyracksDataException {
-        id2nameMap.remove(fileId);
-    }
 }