LogRecordSequence.AdvanceBaseSequenceNumber(SequenceNumber) Método
Definição
Move o número de sequência de base para a parte inicial do log.Moves the base sequence number of the log forward. Esse método não pode ser herdado.This method cannot be inherited.
public:
virtual void AdvanceBaseSequenceNumber(System::IO::Log::SequenceNumber newBaseSequenceNumber);
public void AdvanceBaseSequenceNumber (System.IO.Log.SequenceNumber newBaseSequenceNumber);
abstract member AdvanceBaseSequenceNumber : System.IO.Log.SequenceNumber -> unit
override this.AdvanceBaseSequenceNumber : System.IO.Log.SequenceNumber -> unit
Public Sub AdvanceBaseSequenceNumber (newBaseSequenceNumber As SequenceNumber)
Parâmetros
- newBaseSequenceNumber
- SequenceNumber
Especifica o novo SequenceNumber de base para o log.Specifies the new base SequenceNumber for the log. Isso deve ficar no intervalo entre o número de sequência de base atual e o último número de sequência do log de modo inclusivo.This must lie in the range between the current base sequence number and the last sequence number of the log inclusively.
Implementações
Exceções
newBaseSequenceNumber não é válido para essa sequência.newBaseSequenceNumber is not valid for this sequence.
Uma cauda ou base de um arquivo novo ou existente do registro ativo é inválida.A new or existing archive tail or base of the active log is invalid.
- ou --or-
newBaseSequenceNumber não está entre os números de base e de última sequência dessa sequência.newBaseSequenceNumber is not between the base and last sequence numbers of this sequence.
A solicitação não pôde ser executada devido a uma exceção de E/S inesperada.The request could not be performed because of an unexpected I/O exception.
- ou --or-
Não foi possível executar a solicitação devido a um erro de dispositivo de E/S.The request could not be performed because of an I/O device error.
O log especificado não tem nenhuma extensão.The specified log does not have any extents. Uma ou mais extensões devem ser criadas antes de uma sequência de registro poder ser usada.One or more extents must be created before a record sequence may be used.
O método foi chamado depois que a sequência foi descartada.The method was called after the sequence has been disposed of.
Não há memória suficiente para continuar a execução do programa.There is not enough memory to continue the execution of the program.
O acesso para a sequência de log especificada foi negado pelo sistema operacional.Access for the specified log sequence is denied by the operating system.
A sequência de registros está cheia.The record sequence is full.
Exemplos
Este exemplo mostra como usar o AdvanceBaseSequenceNumber método com o TailPinned evento para liberar espaço em uma sequência de log.This example shows how to use the AdvanceBaseSequenceNumber method with the TailPinned event to free up space in a log sequence.
recordSequence.RetryAppend = true;
recordSequence.TailPinned += new EventHandler<TailPinnedEventArgs>(HandleTailPinned);
void HandleTailPinned(object sender, TailPinnedEventArgs tailPinnedEventArgs)
{
// tailPinnedEventArgs.TargetSequenceNumber is the target
// sequence number to free up space to.
// However, this sequence number is not necessarily valid. We have
// to use this sequence number as a starting point for finding a
// valid point within the log to advance toward. You need to
// identify a record with a sequence number equal to, or greater
// than TargetSequenceNumber; let's call this
// realTargetSequenceNumber. Once found, move the base
recordSequence.AdvanceBaseSequenceNumber(realTargetSequenceNumber);
}
Comentários
Esse método é usado com frequência com o TailPinned evento para liberar espaço em um registro.This method is often used with the TailPinned event to free up space in a record. O TailPinned evento indica que a parte final da sequência (ou seja, o número de sequência base) precisa ser movida para frente para liberar espaço.The TailPinned event indicates that the tail of the sequence (that is, the base sequence number) needs to be moved forward to free up space. O espaço livre pode ser feito escrevendo áreas de reinicialização usando o WriteRestartArea método ou truncando o log e usando o AdvanceBaseSequenceNumber método para avançar o número de sequência base de um log para aquele especificado pelo newBaseSequenceNumber parâmetro.Freeing space can be done by either writing restart areas using the WriteRestartArea method, or truncating the log and using the AdvanceBaseSequenceNumber method to advance the base sequence number of a log to the one specified by the newBaseSequenceNumber parameter. O exemplo de código na seção de exemplo demonstra a segunda abordagem.The code sample in the Example section demonstrates the second approach.
Observe que chamar esse método é o mesmo que definir um novo número de sequência base usando o WriteRestartArea método, exceto que nenhum registro de reinicialização é gravado no log.Note that calling this method is the same as setting a new base sequence number using the WriteRestartArea method, except that no restart record is written to the log.