synchronized boolean tryUpdatingLastStableOffset(TopicPartition tp, long lastStableOffset) {
        final TopicPartitionState state = assignedStateOrNull(tp);
        if (state != null) {
            assignedState(tp).lastStableOffset(lastStableOffset);
            return true;
        }
        return false;
    }
@Test
    public void testTryUpdatingLastStableOffset() {
        state.assignFromUser(Collections.singleton(tp0));
        final TopicPartition unassignedPartition = new TopicPartition("unassigned", 0);

        final long lastStableOffset = 10L;
        assertTrue(state.tryUpdatingLastStableOffset(tp0, lastStableOffset));
        assertEquals(lastStableOffset, state.partitionEndOffset(tp0, IsolationLevel.READ_COMMITTED));
        assertFalse(state.tryUpdatingLastStableOffset(unassignedPartition, lastStableOffset));
    }