You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "chenglei (Jira)" <ji...@apache.org> on 2020/06/24 13:59:00 UTC

[jira] [Updated] (HBASE-24625) AsyncFSWAL.getLogFileSizeIfBeingWritten does not return the expected synced file length.

     [ https://issues.apache.org/jira/browse/HBASE-24625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

chenglei updated HBASE-24625:
-----------------------------
    Description: 
By HBASE-1004, we introduce {{WALFileLengthProvider}} interface to keep the current writing wal file length  by ourselves,  {{WALEntryStream}} used by {{ReplicationSourceWALReader}} could only read WAL file byte size <= {{WALFileLengthProvider.getLogFileSizeIfBeingWritten}} if the WAL file is current been writing on the same RegionServer .

{{AsyncFSWAL}} implements {{WALFileLengthProvider}}  by {{AbstractFSWAL.getLogFileSizeIfBeingWritten}}, just as folllows :
{code:java}
   public OptionalLong getLogFileSizeIfBeingWritten(Path path) {
    rollWriterLock.lock();
    try {
      Path currentPath = getOldPath();
      if (path.equals(currentPath)) {
        W writer = this.writer;
        return writer != null ? OptionalLong.of(writer.getLength()) : OptionalLong.empty();
      } else {
        return OptionalLong.empty();
      }
    } finally {
      rollWriterLock.unlock();
    }
  }
{code}

For {{AsyncFSWAL}},  above {{AsyncFSWAL.writer}}  is {{AsyncProtobufLogWriter}} ,{{AsyncProtobufLogWriter.getLength}}  is as follows:

{code:java}
    public long getLength() {
        return length.get();
    }
{code}

But for {{AsyncProtobufLogWriter}}, any append method may increase the above {{AsyncProtobufLogWriter.length}}, especial



  was:By HBASE-1004, we introduce {{WALFileLengthProvider}} to keep the current writing wal file length  by ourselves


> AsyncFSWAL.getLogFileSizeIfBeingWritten does not return the expected synced file length.
> ----------------------------------------------------------------------------------------
>
>                 Key: HBASE-24625
>                 URL: https://issues.apache.org/jira/browse/HBASE-24625
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 2.3.0
>            Reporter: chenglei
>            Priority: Major
>
> By HBASE-1004, we introduce {{WALFileLengthProvider}} interface to keep the current writing wal file length  by ourselves,  {{WALEntryStream}} used by {{ReplicationSourceWALReader}} could only read WAL file byte size <= {{WALFileLengthProvider.getLogFileSizeIfBeingWritten}} if the WAL file is current been writing on the same RegionServer .
> {{AsyncFSWAL}} implements {{WALFileLengthProvider}}  by {{AbstractFSWAL.getLogFileSizeIfBeingWritten}}, just as folllows :
> {code:java}
>    public OptionalLong getLogFileSizeIfBeingWritten(Path path) {
>     rollWriterLock.lock();
>     try {
>       Path currentPath = getOldPath();
>       if (path.equals(currentPath)) {
>         W writer = this.writer;
>         return writer != null ? OptionalLong.of(writer.getLength()) : OptionalLong.empty();
>       } else {
>         return OptionalLong.empty();
>       }
>     } finally {
>       rollWriterLock.unlock();
>     }
>   }
> {code}
> For {{AsyncFSWAL}},  above {{AsyncFSWAL.writer}}  is {{AsyncProtobufLogWriter}} ,{{AsyncProtobufLogWriter.getLength}}  is as follows:
> {code:java}
>     public long getLength() {
>         return length.get();
>     }
> {code}
> But for {{AsyncProtobufLogWriter}}, any append method may increase the above {{AsyncProtobufLogWriter.length}}, especial



--
This message was sent by Atlassian Jira
(v8.3.4#803005)