|
> that is to say the picture shows that change vectors of one redo record can scatter in multiple log buffers as well.
Change vectors of one redo record will be merged right before they're copied into the public redo strand (area). They will be continuous. Jonathan Lewis's book "Oracle Core Essential Internals" talks about this.
> how Oracle can write redo records to disk exactly as the order they are produced(or in other words, in the right order)
Easy. Oracle just writes redo buffers sequentially. The buffers are filled sequentially. Are you thinking they are not? When I say a transaction can scatter redo records in multiple log buffers, I mean this trivial scenario: the redo records are generated at different times and a new log buffer is assigned in the middle. For example, time1: rr1 (redo record 1) of tx1; time2: rr1 of tx2; time3: rr2 of tx1, ... and suppose between time2 and time3, a log buffer is full and a new buffer is allocated. You see, tx1 has two redo records in two buffers.
In the picture you showed, the order of log buffers will be written to disk sequentially, blocks 1 and 2, then blocks 3 and 4. The two blocks in one buffer are written out in one I/O, at least from Oracle's point of view (and usually from the storage layer's point of view as well, unless log block size mismatches disk sector size). It makes little sense to say block 1 in your picture goes to disk before block 2, since they're in one I/O. But it's OK to say block 1 is written before block 3. |
|