You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2023/04/03 17:05:00 UTC

[jira] [Commented] (RATIS-1722) Fix the suppressed findbugs warnings in SimpleStateMachineStorage

    [ https://issues.apache.org/jira/browse/RATIS-1722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708050#comment-17708050 ] 

Attila Doroszlai commented on RATIS-1722:
-----------------------------------------

[~szetszwo],

{{findLatestSnapshot()}} is used in some Ozone integration tests.  After this change (also backported to 2.5.0 RC) how can these tests find the latest snapshot?

 * {{getLatestSnapshot()}} updates the reference only once, returns the same object afterwards
 * {{findLatestSnapshot(Path)}} is not public

List of affected tests:

{code}
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestContainerStateMachine.java
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestContainerStateMachineFailures.java
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestValidateBCSIDOnRestart.java
{code}

Can we expose the "find+update" part of {{getLatestSnapshot}}?

{code:title=https://github.com/apache/ratis/blob/f70bf4fef0c919978408ceaf5ae569ff164e6136/ratis-server/src/main/java/org/apache/ratis/statemachine/impl/SimpleStateMachineStorage.java#L214-L229}
  @Override
  public SingleFileSnapshotInfo getLatestSnapshot() {
    final SingleFileSnapshotInfo s = latestSnapshot.get();
    if (s != null) {
      return s;
    }
    final File dir = stateMachineDir;
    if (dir == null) {
      return null;
    }
    try {
      return updateLatestSnapshot(findLatestSnapshot(dir.toPath()));
    } catch (IOException ignored) {
      return null;
    }
  }
{code}

> Fix the suppressed findbugs warnings in SimpleStateMachineStorage
> -----------------------------------------------------------------
>
>                 Key: RATIS-1722
>                 URL: https://issues.apache.org/jira/browse/RATIS-1722
>             Project: Ratis
>          Issue Type: Sub-task
>          Components: StateMachine
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>             Fix For: 3.0.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> There are a few suppressed findbugs warnings in SimpleStateMachineStorage
> - @SuppressFBWarnings("NP_NULL_ON_SOME_PATH")
> - @SuppressFBWarnings("SE_COMPARATOR_SHOULD_BE_SERIALIZABLE")



--
This message was sent by Atlassian Jira
(v8.20.10#820010)