Transaction fixation to disk

Content-Disposition: inlineUser-Agent: Mutt/1.5.19 (2009-01-05)Hello,I’m new to this list, and joined primarily to ask the followingquestion: I found this comment to “A Shallow Introduction to the K ProgrammingLanguage”: http://www.kuro5hin.org/comments/2002/11/14/22741/791?pid3#154What I’m curious is the line “logging consists of a single atomicappend to the log file”. How does Kdb do this?AFAIU traditional approach is as follows: suppose log record that youwant to fixate to disk atomically spans several disk sectors. Youfirst issue write command for all sectors but the last one. Then youissue an I/O barrier, and the write command for the last sector.After that you issue sync command, and give it some time to complete.Only after that can you be confident that the transaction has beenfixated to disk. All of this is necessary because: - with traditional HDDs only a single sector write is atomic (each sector has it’s own checksum, and updated as a whole). - you need I/O barrier to make the final sector of the log record be written last. Otherwise HDD controller may reorder writes for more linear head movement, so after major failure you may read the last sector OK, and yet can’t assume that the whole log record is valid. You can avoid I/O barrier if log record fits within one sector. - you have to wait for sync to complete because the moment you issue sync command HDD head may be on the wrong track, so you have to give it (a full stroke) time to move to the right track. Also, when on the right track the target sector may just pass beneath the head, so you have to wait for at least one full turn of a disk plate.With this, “millions of transactions per second” sounds more like amarketing speak. Or does Kdb has a relaxed notion of transaction, ordoes things completely different? Any insight would be appreciated!-- Tomash Brechko

hi Tomash,> I found this comment to “A Shallow Introduction to the K Programming> Language”:>> ?http://www.kuro5hin.org/comments/2002/11/14/22741/791?pid=153#154try a more recent source like: http://kx.com/papers/Kdb+\_Whitepaper\_2010.pdf\> With this, “millions of transactions per second” sounds more like athis may be a typo – the statistic is probably “millions of recordsper second” for bulk transactions or queries.ta, jack.