code: private SegmentMetadataUpdateTransaction getOrCreateSegmentUpdateTransaction(String segmentName, long segmentId) {
          SegmentMetadataUpdateTransaction sm = tryGetSegmentUpdateTransaction(segmentId);
          if (sm == null) {
              SegmentMetadata baseSegmentMetadata = createSegmentMetadata(segmentName, segmentId);
              sm = new SegmentMetadataUpdateTransaction(baseSegmentMetadata, this.recoveryMode);
              this.segmentUpdates.put(segmentId, sm);
          }
  
          return sm;
      }
docs: Gets an UpdateableSegmentMetadata for the given Segment. If already registered, it returns that instance,
  otherwise it creates and records a new Segment metadata.