public void appendStandbySnapshot(
        final long recordingId,
        final long leadershipTermId,
        final long termBaseLogPosition,
        final long logPosition,
        final long timestamp,
        final int serviceId,
        final String archiveEndpoint)
    {
        validateRecordingId(recordingId);

        if (Strings.isEmpty(archiveEndpoint))
        {
            throw new ClusterException("Remote snapshots must have a valid endpoint");
        }

        if (archiveEndpoint.length() > MAX_ENDPOINT_LENGTH)
        {
            throw new ClusterException(
                "Endpoint is too long: " + archiveEndpoint.length() + " vs " + MAX_ENDPOINT_LENGTH);
        }

        if (!restoreInvalidSnapshot(
            recordingId, leadershipTermId, termBaseLogPosition, logPosition, timestamp, serviceId))
        {
            append(
                ENTRY_TYPE_STANDBY_SNAPSHOT,
                recordingId,
                leadershipTermId,
                termBaseLogPosition,
                logPosition,
                timestamp,
                serviceId,
                archiveEndpoint);
        }
    }
@Test
    void shouldRejectSnapshotEntryIfEndpointIsTooLong(@TempDir final File tempDir)
    {
        final String endpoint = Tests.generateStringWithSuffix("a", "x", 5000);
        try (RecordingLog log = new RecordingLog(tempDir, true))
        {
            final ClusterException exception = assertThrowsExactly(ClusterException.class,
                () -> log.appendStandbySnapshot(1, 2, 1000, 2000, 1_000_000_000L, SERVICE_ID, endpoint));
            assertEquals("ERROR - Endpoint is too long: " + endpoint.length() + " vs " + MAX_ENDPOINT_LENGTH,
                exception.getMessage());
        }
    }