h2/src/main/org/h2/mvstore/MVMap.java
/**
     * Open an old version for the given map.
     *
     * @param version the version
     * @return the map
     */
Open an old version for the given map.
@param version the version
@return the map
Open an old version for the given map . @param version the version @return the map
public MVMap<K, V> openVersion(long version) {
        if (readOnly) {
            throw DataUtils.newUnsupportedOperationException(
                    "This map is read-only; need to call the method on the writable map");
        }
        DataUtils.checkArgument(version >= createVersion,
                "Unknown version {0}; this map was created in version is {1}",
                version, createVersion);
        Page newest = null;
        Page r = root;
        if (version >= r.getVersion() &&
                (version == writeVersion ||
                r.getVersion() >= 0 ||
                version <= createVersion ||
                store.getFileStore() == null)) {
            newest = r;
        } else {
            int i = searchRoot(version);
            if (i < 0) {
                if (i == -1) {
                    return store.openMapVersion(version, id, this);
                }
                i = -i - 2;
            }
            newest = oldRoots.get(i);
        }
        MVMap<K, V> m = openReadOnly();
        m.root = newest;
        return m;
    }
public MVMap < K , V > openVersion ( long version ) { if ( readOnly ) { throw DataUtils . newUnsupportedOperationException ( "This map is read-only; need to call the method on the writable map" ) ; } DataUtils . checkArgument ( version >= createVersion , "Unknown version {0}; this map was created in version is {1}" , version , createVersion ) ; Page newest = null ; Page r = root ; if ( version >= r . getVersion ( ) && ( version == writeVersion || r . getVersion ( ) >= 0 || version <= createVersion || store . getFileStore ( ) == null ) ) { newest = r ; } else { int i = searchRoot ( version ) ; if ( i < 0 ) { if ( i == - 1 ) { return store . openMapVersion ( version , id , this ) ; } i = - i - 2 ; } newest = oldRoots . get ( i ) ; } MVMap < K , V > m = openReadOnly ( ) ; m . root = newest ; return m ; }
Open an old version for the given map.
Open an old version for the given map .
// need to copy because it can change // find the newest page that has a getVersion() <= version // not found // smaller than all in-memory versions