~akiban-technologies/akiban-persistit/build

« back to all changes in this revision

Viewing changes to src/main/java/com/persistit/Persistit.java

merge pbeaman: Fixes bug1126868.

https://code.launchpad.net/~pbeaman/akiban-persistit/fix-1126868-lock-table-pruning/+merge/152063

Show diffs side-by-side

added added

removed removed

Lines of Context:
1079
1079
     * @throws PersistitException
1080
1080
     */
1081
1081
    public Volume createTemporaryVolume() throws PersistitException {
1082
 
        int pageSize = _configuration.getTmpVolPageSize();
1083
 
        if (pageSize == 0) {
1084
 
            for (final int size : _bufferPoolTable.keySet()) {
1085
 
                if (size > pageSize) {
1086
 
                    pageSize = size;
1087
 
                }
1088
 
            }
1089
 
        }
1090
 
        return createTemporaryVolume(pageSize);
 
1082
        return createTemporaryVolume(temporaryVolumePageSize());
1091
1083
    }
1092
1084
 
1093
1085
    /**
1115
1107
        return Volume.createTemporaryVolume(this, pageSize, directory);
1116
1108
    }
1117
1109
 
 
1110
    private int temporaryVolumePageSize() {
 
1111
        int pageSize = _configuration.getTmpVolPageSize();
 
1112
        if (pageSize == 0) {
 
1113
            for (final int size : _bufferPoolTable.keySet()) {
 
1114
                if (size > pageSize) {
 
1115
                    pageSize = size;
 
1116
                }
 
1117
            }
 
1118
        }
 
1119
        return pageSize;
 
1120
    }
 
1121
 
1118
1122
    /**
1119
1123
     * Delete a volume currently loaded volume and remove it from the list
1120
1124
     * returned by {@link #getVolumes()}.
1296
1300
        checkInitialized();
1297
1301
        checkClosed();
1298
1302
        if (_lockVolume == null) {
1299
 
            _lockVolume = createTemporaryVolume();
1300
 
            _lockVolume.setHandle(Volume.LOCK_VOLUME_HANDLE);
 
1303
            final int pageSize = temporaryVolumePageSize();
 
1304
            if (!Volume.isValidPageSize(pageSize)) {
 
1305
                throw new IllegalArgumentException("Invalid page size " + pageSize);
 
1306
            }
 
1307
            final String directoryName = getConfiguration().getTmpVolDir();
 
1308
            final File directory = directoryName == null ? null : new File(directoryName);
 
1309
            _lockVolume = Volume.createLockVolume(this, pageSize, directory);
 
1310
            _volumes.add(_lockVolume);
1301
1311
        }
1302
1312
        return _lockVolume;
1303
1313
    }