You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vyacheslav Koptilin (Jira)" <ji...@apache.org> on 2020/06/09 13:01:00 UTC
[jira] [Updated] (IGNITE-13137) WAL reservation may failed even
though the required segment is available
[ https://issues.apache.org/jira/browse/IGNITE-13137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vyacheslav Koptilin updated IGNITE-13137:
-----------------------------------------
Ignite Flags: Release Notes Required (was: Docs Required,Release Notes Required)
> WAL reservation may failed even though the required segment is available
> ------------------------------------------------------------------------
>
> Key: IGNITE-13137
> URL: https://issues.apache.org/jira/browse/IGNITE-13137
> Project: Ignite
> Issue Type: Bug
> Components: persistence
> Affects Versions: 2.8
> Reporter: Vyacheslav Koptilin
> Priority: Major
>
> It seems there is a race in {{FileWriteAheadLogManager}} that may lead to the inability to reserve a WAL segment.
> Let's consider the following scenario:
> - log WAL record that requires a rollover of the current segment.
> - archiver is moving the WAL file to an archive folder
> - trying to reserve this segment
> {code:java}
> @Override public boolean reserve(WALPointer start) {
> ...
> segmentAware.reserve(((FileWALPointer)start).index());
> if (!hasIndex(((FileWALPointer)start).index())) { <-- hasIndex returns false
> segmentAware.release(((FileWALPointer)start).index());
> return false;
> }
> ...
> }
> private boolean hasIndex(long absIdx) {
> ...
> boolean inArchive = new File(walArchiveDir, segmentName).exists() ||
> new File(walArchiveDir, zipSegmentName).exists();
> if (inArchive) <-- At this point, the required WAL segment is not moved yet, so inArchive == false
> return true;
> if (absIdx <= lastArchivedIndex()) <-- lastArchivedIndex() scans archive directory and finds a new WAL segment,
> return false; <-- and absIdx == lastArchivedIndex!
> FileWriteHandle cur = currHnd;
> return cur != null && cur.getSegmentId() >= absIdx;
> }
> {code}
> Besides this race, it seems to me, the behavior of WAL reservation should be improved in a case when the required segment is already reserved/locked. In that particular case, we don't need to check WAL archive directory at all.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)