public void DeleteSection(long sectionPageNumber) { if (_tx.Flags == TransactionFlags.Read) { ThrowReadOnlyTransaction(sectionPageNumber); } if (sectionPageNumber != _sectionHeader->PageNumber) { // this is in another section, cannot delete it directly, so we'll forward to the right section var actualSection = new RawDataSection(_tx, sectionPageNumber); if (actualSection._sectionHeader->SectionOwnerHash != _sectionHeader->SectionOwnerHash) { VoronUnrecoverableErrorException.Raise(_tx.Environment, $"Cannot delete section because the raw data section starting in {sectionPageNumber} belongs to a different owner"); } actualSection.DeleteSection(sectionPageNumber); return; } for (int i = 0; i < _sectionHeader->NumberOfPages; i++) { _tx.FreePage(_sectionHeader->PageNumber + i + 1); } _tx.FreePage(_sectionHeader->PageNumber); }
public void DeleteSection(long sectionPageNumber) { if (sectionPageNumber != _sectionHeader->PageNumber) { // this is in another section, cannot delete it directly, so we'll forward to the right section var actualSection = new RawDataSection(_tx, sectionPageNumber); if (actualSection._sectionHeader->SectionOwnerHash != _sectionHeader->SectionOwnerHash) { throw new InvalidDataException( $"Cannot delete section because the raw data section starting in {sectionPageNumber} belongs to a different owner"); } actualSection.DeleteSection(sectionPageNumber); return; } for (int i = 0; i < _sectionHeader->NumberOfPages; i++) { _tx.FreePage(_sectionHeader->PageNumber + i + 1); } _tx.FreePage(_sectionHeader->PageNumber); }