private boolean growDatabaseByConfiguredSize() { int reservedStorageSpace = configImpl().databaseGrowthSize(); if (reservedStorageSpace <= 0) { return false; } int reservedBlocks = _blockConverter.bytesToBlocks(reservedStorageSpace); int reservedBytes = _blockConverter.blocksToBytes(reservedBlocks); Slot slot = new Slot(_blockEndAddress, reservedBlocks); if (Debug4.xbytes && Deploy.overwrite) { overwriteDeletedBlockedSlot(slot); } else { writeBytes(new ByteArrayBuffer(reservedBytes), _blockEndAddress, 0); } _freespaceManager.free(_blockConverter.toNonBlockedLength(slot)); _blockEndAddress += reservedBlocks; return true; }
public void free(Slot slot) { if (slot.isNull()) { return; // TODO: This should really be an IllegalArgumentException but old database files // with index-based FreespaceManagers appear to deliver zeroed slots. // throw new IllegalArgumentException(); } if (_freespaceManager == null) { // Can happen on early free before freespacemanager // is up, during conversion. return; } if (DTrace.enabled) { DTrace.FILE_FREE.logLength(slot.address(), slot.length()); } _freespaceManager.free(slot); }