int commit ( long upToTransactionId ) { long traceId = LoggerHelpers . traceEnterWithContext ( log , this . traceObjectId , "commit" , upToTransactionId ) ; // Commit every UpdateTransaction, in order, until we reach our transaction id. List < Long > commits = new ArrayList <> ( ) ; while ( ! this . transactions . isEmpty ( ) && this . transactions . peekFirst ( ) . getTransactionId ( ) <= upToTransactionId ) { ContainerMetadataUpdateTransaction txn = this . transactions . removeFirst ( ) ; txn . seal ( ) ; txn . commit ( this . metadata ) ; commits . add ( txn . getTransactionId ( ) ) ; } // Rebase the first remaining UpdateTransaction over to the current metadata (it was previously pointing to the // last committed UpdateTransaction). if ( commits . size ( ) > 0 && ! this . transactions . isEmpty ( ) ) { this . transactions . peekFirst ( ) . rebase ( this . metadata ) ; } LoggerHelpers . traceLeave ( log , this . traceObjectId , "commit" , traceId , commits ) ; return commits . size ( ) ; }
Commits all outstanding changes to the base Container Metadata up to and including the one for the given UpdateTransaction .