code: public static boolean isCompatibleClientProtocol(
        long clientVersion, long serverVersion) {
      return clientVersion == serverVersion ||
             (
              ( clientVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION-1 ||
                clientVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION ||
                clientVersion == ClientProtocol.ITERATIVE_LISTING_VERSION ||
                clientVersion == ClientProtocol.BULK_BLOCK_LOCATIONS_VERSION ||
                clientVersion == ClientProtocol.CONCAT_VERSION ||
                clientVersion == ClientProtocol.LIST_CORRUPT_FILEBLOCKS_VERSION ||
                clientVersion == ClientProtocol.SAVENAMESPACE_FORCE ||
                clientVersion == ClientProtocol.RECOVER_LEASE_VERSION ||
                clientVersion == ClientProtocol.CLOSE_RECOVER_LEASE_VERSION
              ) &&
              ( serverVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION-1 ||
                serverVersion == ClientProtocol.OPTIMIZE_FILE_STATUS_VERSION ||
                serverVersion == ClientProtocol.ITERATIVE_LISTING_VERSION ||
                serverVersion == ClientProtocol.BULK_BLOCK_LOCATIONS_VERSION  ||
                serverVersion == ClientProtocol.CONCAT_VERSION ||
                serverVersion == ClientProtocol.LIST_CORRUPT_FILEBLOCKS_VERSION ||
                serverVersion == ClientProtocol.SAVENAMESPACE_FORCE ||
                serverVersion == ClientProtocol.RECOVER_LEASE_VERSION ||
                serverVersion == ClientProtocol.CLOSE_RECOVER_LEASE_VERSION
             ));
    }
docs: Check if the client and NameNode have compatible ClientProtocol versions
  
  @param clientVersion the version of ClientProtocol that client has
  @param serverVersion the version of ClientProtocol that NameNode has
  @return true if two versions are compatible