暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

「YashanDB个人版体验」崖山数据库这一点比达梦强

792

前面提到过达梦数据库不支持多块写,会导致一定程度写放大问题。那么崖山数据库是否支持呢?带着这个疑问我们来简单测一测,看看是否有什么新的发现。

首先创建个测试表:

    SQL> create table test1 as select * from t17 where 1=2;


    Succeed.


    Elapsed: 00:00:00.009
    SQL> insert into test1 select * from t17 where rownum < 10000;


    9999 rows affected.


    Elapsed: 00:00:00.036
    SQL> commit;


    Succeed.


    Elapsed: 00:00:00.001
    SQL> alter system switch logfile;


    Succeed.


    Elapsed: 00:00:00.028
    SQL>
    SQL> select name,THREAD_ID from v$process where name='DBWR';


    NAME THREAD_ID
    --------------------------------- ---------------------
    DBWR 8526
    DBWR 8527

    在insert数据时我们就可以同时打开strace和blktrace进行简单跟踪。

      [root@yashandb1 ~]# strace -fr -o tmp/8518.log  -p 8518
      strace: Process 8518 attached with 55 threads
      ^Cstrace: Process 8518 detached
      strace: Process 8520 detached
      strace: Process 8521 detached
      strace: Process 8522 detached
      strace: Process 8523 detached
      ......
      [root@yashandb1 ~]# cat tmp/8518.log|grep 8526|grep 'pwrite64(4'
      8526 0.000033 pwrite64(48, "s\300\216D[\0\0\0\332\35\1\0\0\0\0\0\200!\0\0\4\0\0\0\0\0\0\0\0\0\0\0"..., 8192, 1097728) = 8192
      8526 0.000188 pwrite64(48, "2\212\16[v\0\0\0\332\35\1\0\0\0\0\0@E\0\0\4\0\0\0R\0\0\0\0\0\0\0"..., 8192, 2269184) = 8192
      8526 0.000169 pwrite64(48, "\310(s\312!\1\0\0\332\35\1\0\0\0\0\0\0G\0\0\v\0\0\0\0\4\0\0\0\0\0\0"..., 8192, 2326528) = 8192
      8526 0.000265 pwrite64(49, "\267\227\226h\23\t\0\0\331\35\1\0\0\0\0\0@~\2\0\7\0\0\0@X\6\0\200X\6\0"..., 16384, 20914176) = 16384
      8526 0.000173 pwrite64(49, "\330\206ZE\33\t\0\0\352\35\1\0\0\0\0\0\200\226\2\0\7\0\0\0@\\\6\0\200]\6\0"..., 16384, 21708800) = 16384
      8526 0.000206 pwrite64(49, "<\245\370\320\266\0\0\0\331\35\1\0\0\0\0\0@X\6\0\10\0\0\0\200X\6\0\0X\6\0"..., 16384, 53223424 <unfinished ...>
      8526 0.000069 pwrite64(49, "7\332\254\300\246\0\0\0\352\35\1\0\0\0\0\0@\\\6\0\10\0\0\0\200\\\6\0\0\\\6\0"..., 49152, 53354496) = 49152
      [root@yashandb1 ~]#
      [root@yashandb1 ~]# cat tmp/8518.log|grep 8526|grep 'pwrite64(5'
      8526 0.000178 pwrite64(50, "L\31qU\\\2\0\0\350\35\1\0\0\0\0\0\200\0\0\0\t\0\0\0\200\0\0\0 \0\0\0"..., 8192, 16384) = 8192
      8526 0.000168 pwrite64(50, "Q$\2250\35\0\0\0\333\35\1\0\0\0\0\0\0$\25\0 \0\0\0\361\10\0\0\0\0\0\0"..., 1064960, 177340416 <unfinished ...>
      8526 0.000034 pwrite64(50, "O\233\236\305\5\0\0\0\353\35\1\0\0\0\0\0\0L\25\0\4\0\0\0\361\10\0\0\0\0\0\0"..., 131072, 178651136) = 131072

      8526 为DBWR线程,从该线程的写情况来看,肯定是进行了IO 合并,有大于8192的情况,由此可见崖山数据库可以实现多块写的。这一点看上去比达梦强。解析来看看blktrace的情况

        [root@yashandb1 ~]# blktrace -d  dev/sda2
        ^C=== sda2 ===
        CPU 0: 20 events, 1 KiB data
        CPU 1: 268 events, 13 KiB data
        CPU 2: 200 events, 10 KiB data
        CPU 3: 319 events, 15 KiB data
        CPU 4: 39 events, 2 KiB data
        CPU 5: 67 events, 4 KiB data
        CPU 6: 0 events, 0 KiB data
        CPU 7: 232 events, 11 KiB data
        Total: 1145 events (dropped 0), 54 KiB data
        [root@yashandb1 ~]#


        [root@yashandb1 ~]# ls -ltr
        total 72
        -rw-------. 1 root root 1547 Sep 8 15:23 anaconda-ks.cfg
        -rw-r--r-- 1 root root 1872 Nov 17 15:35 sda2.blktrace.4
        -rw-r--r-- 1 root root 3216 Nov 17 15:35 sda2.blktrace.5
        -rw-r--r-- 1 root root 15344 Nov 17 15:35 sda2.blktrace.3
        -rw-r--r-- 1 root root 12864 Nov 17 15:35 sda2.blktrace.1
        -rw-r--r-- 1 root root 9632 Nov 17 15:35 sda2.blktrace.2
        -rw-r--r-- 1 root root 0 Nov 17 15:35 sda2.blktrace.6
        -rw-r--r-- 1 root root 960 Nov 17 15:35 sda2.blktrace.0
        -rw-r--r-- 1 root root 11160 Nov 17 15:35 sda2.blktrace.7

        先合并一下trace文件:

          [root@yashandb1 ~]# blkparse -i sda2 -d sda2.blktrace_all.parse
          Input file sda2.blktrace.0 added
          Input file sda2.blktrace.1 added
          Input file sda2.blktrace.2 added
          Input file sda2.blktrace.3 added
          Input file sda2.blktrace.4 added
          Input file sda2.blktrace.5 added
          Input file sda2.blktrace.7 added
          8,2 4 1 0.000000000 8853 A WSM 155225656 + 11 <- (253,0) 52479544
          ......
          8,2 1 24 10.626109698 8601 A WSM 59645959 + 3 <- (253,2) 43128839
          8,0 1 25 10.626110199 8601 A WSM 61745159 + 3 <- (8,2) 59645959
          8,2 1 26 10.626111104 8601 Q WSM 61745159 + 3 [WORKER]
          8,2 1 27 10.626114549 8601 G WSM 61745159 + 3 [WORKER]
          8,2 1 28 10.626115504 8601 P N [WORKER]
          8,2 1 29 10.626117038 8601 I WSM 61745159 + 3 [WORKER]
          8,2 1 30 10.626118441 8601 U N [WORKER] 1
          8,2 1 31 10.626119634 8601 D WSM 61745159 + 3 [WORKER]
          8,2 1 32 10.626502054 0 C WSM 61745159 + 3 [0]
          8,2 1 33 10.694865061 8526 A WS 59708832 + 16 <- (253,2) 43191712
          8,0 1 34 10.694865615 8526 A WS 61808032 + 16 <- (8,2) 59708832
          8,2 1 35 10.694867479 8526 Q WS 61808032 + 16 [DBWR]
          8,2 1 36 10.694874606 8526 G WS 61808032 + 16 [DBWR]
          8,2 1 37 10.694876718 8526 I WS 61808032 + 16 [DBWR]
          8,2 1 38 10.694884953 8526 D WS 61808032 + 16 [DBWR]
          8,2 1 39 10.695360057 0 C WS 61808032 + 16 [0]
          。。。。。。
          8,2 1 76 10.703242985 8526 P N [DBWR]
          8,2 1 77 10.703244501 8526 I WSM 61745166 + 2 [DBWR]
          8,2 1 78 10.703245707 8526 U N [DBWR] 1
          8,2 1 79 10.703246974 8526 D WSM 61745166 + 2 [DBWR]
          8,2 1 80 10.706622914 0 C WSM 61745166 + 2 [0]
          8,2 4 10 10.816649391 8549 A WS 59975312 + 1024 <- (253,2) 43458192
          8,0 4 11 10.816650253 8549 A WS 62074512 + 1024 <- (8,2) 59975312
          8,2 4 12 10.816651893 8549 Q WS 62074512 + 1024 [LOGW]
          8,2 4 13 10.816658488 8549 G WS 62074512 + 1024 [LOGW]
          8,2 4 14 10.816662631 8549 I WS 62074512 + 1024 [LOGW]
          8,2 4 15 10.816665962 8549 D WS 62074512 + 1024 [LOGW]
          8,2 4 16 10.816971184 8549 A WS 59976336 + 928 <- (253,2) 43459216
          8,0 4 17 10.816971856 8549 A WS 62075536 + 928 <- (8,2) 59976336
          8,2 4 18 10.816972440 8549 Q WS 62075536 + 928 [LOGW]
          8,2 4 19 10.816974592 8549 G WS 62075536 + 928 [LOGW]
          8,2 4 20 10.816977368 8549 I WS 62075536 + 928 [LOGW]
          8,2 4 21 10.816978702 8549 D WS 62075536 + 928 [LOGW]
          8,2 4 22 10.818415682 0 C WS 62074512 + 1024 [0]
          8,2 4 23 10.819062222 0 C WS 62075536 + 928 [0]
          8,2 4 24 10.819259454 8549 A WSM 59645968 + 2 <- (253,2) 43128848
          8,0 4 25 10.819259892 8549 A WSM 61745168 + 2 <- (8,2) 59645968
          8,2 4 26 10.819260600 8549 Q WSM 61745168 + 2 [LOGW]
          8,2 4 27 10.819264185 8549 G WSM 61745168 + 2 [LOGW]
          8,2 4 28 10.819265071 8549 P N [LOGW]
          8,2 4 29 10.819266604 8549 I WSM 61745168 + 2 [LOGW]
          8,2 4 30 10.819268084 8549 U N [LOGW] 1
          8,2 4 31 10.819269364 8549 D WSM 61745168 + 2 [LOGW]
          8,2 4 32 10.819584068 0 C WSM 61745168 + 2 [0]
          8,2 0 1 12.602087677 8601 A WS 59977264 + 24 <- (253,2) 43460144
          8,0 0 2 12.602088652 8601 A WS 62076464 + 24 <- (8,2) 59977264
          8,2 0 3 12.602090340 8601 Q WS 62076464 + 24 [WORKER]
          8,2 0 4 12.602098398 8601 G WS 62076464 + 24 [WORKER]
          8,2 0 5 12.602101846 8601 I WS 62076464 + 24 [WORKER]
          8,2 0 6 12.602105695 8601 D WS 62076464 + 24 [WORKER]
          8,2 0 7 12.602600077 0 C WS 62076464 + 24 [0]
          8,2 0 8 12.602672057 8601 A WSM 59645970 + 2 <- (253,2) 43128850
          8,0 0 9 12.602672518 8601 A WSM 61745170 + 2 <- (8,2) 59645970
          8,2 0 10 12.602673199 8601 Q WSM 61745170 + 2 [WORKER]
          8,2 0 11 12.602676484 8601 G WSM 61745170 + 2 [WORKER]
          8,2 0 12 12.602677299 8601 P N [WORKER]
          8,2 0 13 12.602678762 8601 I WSM 61745170 + 2 [WORKER]
          8,2 0 14 12.602680119 8601 U N [WORKER] 1
          8,2 0 15 12.602681215 8601 D WSM 61745170 + 2 [WORKER]
          8,2 0 16 12.602975795 0 C WSM 61745170 + 2 [0]
          8,2 1 81 13.706853536 8526 A WS 59708816 + 16 <- (253,2) 43191696
          8,0 1 82 13.706854365 8526 A WS 61808016 + 16 <- (8,2) 59708816
          8,2 1 83 13.706856222 8526 Q WS 61808016 + 16 [DBWR]
          8,2 1 84 13.706863355 8526 G WS 61808016 + 16 [DBWR]
          8,2 1 85 13.706865911 8526 I WS 61808016 + 16 [DBWR]
          8,2 1 86 13.706869236 8526 D WS 61808016 + 16 [DBWR]
          8,2 1 87 13.707369836 0 C WS 61808016 + 16 [0]
          8,2 1 88 13.707439293 8526 A WSM 59645972 + 2 <- (253,2) 43128852
          8,0 1 89 13.707439750 8526 A WSM 61745172 + 2 <- (8,2) 59645972
          8,2 1 90 13.707440632 8526 Q WSM 61745172 + 2 [DBWR]
          8,2 1 91 13.707444147 8526 G WSM 61745172 + 2 [DBWR]
          8,2 1 92 13.707445046 8526 P N [DBWR]
          8,2 1 93 13.707446646 8526 I WSM 61745172 + 2 [DBWR]
          8,2 1 94 13.707447986 8526 U N [DBWR] 1
          8,2 1 95 13.707449109 8526 D WSM 61745172 + 2 [DBWR]
          8,2 1 96 13.709796523 0 C WSM 61745172 + 2 [0]
          8,2 1 97 13.709923402 8526 A WS 59924376 + 16 <- (253,2) 43407256
          8,0 1 98 13.709923927 8526 A WS 62023576 + 16 <- (8,2) 59924376
          8,2 1 99 13.709924789 8526 Q WS 62023576 + 16 [DBWR]
          8,2 1 100 13.709928558 8526 G WS 62023576 + 16 [DBWR]
          8,2 1 101 13.709930325 8526 I WS 62023576 + 16 [DBWR]
          8,2 1 102 13.709932253 8526 D WS 62023576 + 16 [DBWR]
          8,2 1 103 13.710439294 0 C WS 62023576 + 16 [0]
          8,2 1 104 13.710504154 8526 A WSM 59645974 + 2 <- (253,2) 43128854
          8,0 1 105 13.710504615 8526 A WSM 61745174 + 2 <- (8,2) 59645974
          8,2 1 106 13.710505414 8526 Q WSM 61745174 + 2 [DBWR]
          8,2 1 107 13.710509209 8526 G WSM 61745174 + 2 [DBWR]
          8,2 1 108 13.710509951 8526 P N [DBWR]
          8,2 1 109 13.710511438 8526 I WSM 61745174 + 2 [DBWR]
          8,2 1 110 13.710512647 8526 U N [DBWR] 1
          8,2 1 111 13.710513847 8526 D WSM 61745174 + 2 [DBWR]
          8,2 1 112 13.712818943 8561 C WSM 61745174 + 2 [0]
          8,2 1 113 13.712920383 8526 A WS 64168232 + 16 <- (253,2) 47651112
          8,0 1 114 13.712920831 8526 A WS 66267432 + 16 <- (8,2) 64168232
          8,2 1 115 13.712921580 8526 Q WS 66267432 + 16 [DBWR]
          8,2 1 116 13.712924820 8526 G WS 66267432 + 16 [DBWR]
          8,2 1 117 13.712926391 8526 I WS 66267432 + 16 [DBWR]
          8,2 1 118 13.712928372 8526 D WS 66267432 + 16 [DBWR]
          8,2 1 119 13.713235899 8561 C WS 66267432 + 16 [0]
          8,2 1 120 13.713662401 8526 A WSM 59645976 + 2 <- (253,2) 43128856
          8,0 1 121 13.713662772 8526 A WSM 61745176 + 2 <- (8,2) 59645976
          8,2 1 122 13.713663694 8526 Q WSM 61745176 + 2 [DBWR]
          8,2 1 123 13.713667316 8526 G WSM 61745176 + 2 [DBWR]
          8,2 1 124 13.713668108 8526 P N [DBWR]
          8,2 1 125 13.713669584 8526 I WSM 61745176 + 2 [DBWR]
          8,2 1 126 13.713670677 8526 U N [DBWR] 1
          8,2 1 127 13.713672227 8526 D WSM 61745176 + 2 [DBWR]
          8,2 1 128 13.713971679 0 C WSM 61745176 + 2 [0]
          8,2 3 1 30.063403203 8601 A WS 38092648 + 8 <- (253,2) 21575528
          8,0 3 2 30.063403738 8601 A WS 40191848 + 8 <- (8,2) 38092648
          8,2 3 3 30.063405432 8601 Q WS 40191848 + 8 [WORKER]
          ......


          8,2 7 44 40.700779961 8527 P N [DBWR]
          8,2 7 45 40.700781334 8527 I WSM 61745238 + 2 [DBWR]
          8,2 7 46 40.700782373 8527 U N [DBWR] 1
          8,2 7 47 40.700783345 8527 D WSM 61745238 + 2 [DBWR]
          8,2 7 48 40.702053025 0 C WSM 61745238 + 2 [0]
          8,2 7 49 40.703384715 8527 A WS 59826088 + 1024 <- (253,2) 43308968
          8,0 7 50 40.703385130 8527 A WS 61925288 + 1024 <- (8,2) 59826088
          8,2 7 51 40.703385848 8527 Q WS 61925288 + 1024 [DBWR]
          8,2 7 52 40.703388681 8527 G WS 61925288 + 1024 [DBWR]
          8,2 7 53 40.703391836 8527 I WS 61925288 + 1024 [DBWR]
          8,2 7 54 40.703393673 8527 D WS 61925288 + 1024 [DBWR]
          8,2 7 55 40.704013939 8527 A WS 59827112 + 1024 <- (253,2) 43309992
          8,0 7 56 40.704014340 8527 A WS 61926312 + 1024 <- (8,2) 59827112
          8,2 7 57 40.704014895 8527 Q WS 61926312 + 1024 [DBWR]
          8,2 7 58 40.704017421 8527 G WS 61926312 + 1024 [DBWR]
          8,2 7 59 40.704020391 8527 I WS 61926312 + 1024 [DBWR]
          8,2 7 60 40.704021794 8527 D WS 61926312 + 1024 [DBWR]
          8,2 7 61 40.704536968 8527 A WS 59828136 + 544 <- (253,2) 43311016
          8,0 7 62 40.704537493 8527 A WS 61927336 + 544 <- (8,2) 59828136
          8,2 7 63 40.704538288 8527 Q WS 61927336 + 544 [DBWR]
          8,2 7 64 40.704541061 8527 G WS 61927336 + 544 [DBWR]
          8,2 7 65 40.704544014 8527 I WS 61927336 + 544 [DBWR]
          8,2 7 66 40.704545558 8527 D WS 61927336 + 544 [DBWR]
          8,2 7 67 40.705417456 0 C WS 61926312 + 1024 [0]
          8,2 7 68 40.705541425 0 C WS 61925288 + 1024 [0]
          8,2 7 69 40.706835171 0 C WS 61927336 + 544 [0]
          。。。。。。
          8,2 7 160 40.721064114 8527 A WS 64741976 + 16 <- (253,2) 48224856
          8,0 7 161 40.721064569 8527 A WS 66841176 + 16 <- (8,2) 64741976
          8,2 7 162 40.721065340 8527 Q WS 66841176 + 16 [DBWR]
          8,2 7 163 40.721068190 8527 G WS 66841176 + 16 [DBWR]
          8,2 7 164 40.721069466 8527 I WS 66841176 + 16 [DBWR]
          8,2 7 165 40.721071347 8527 D WS 66841176 + 16 [DBWR]
          8,2 7 166 40.721268139 8527 A WS 65612600 + 1024 <- (253,2) 49095480
          8,0 7 167 40.721268650 8527 A WS 67711800 + 1024 <- (8,2) 65612600
          8,2 7 168 40.721269188 8527 Q WS 67711800 + 1024 [DBWR]
          8,2 7 169 40.721270982 8527 G WS 67711800 + 1024 [DBWR]
          8,2 7 170 40.721273632 8527 I WS 67711800 + 1024 [DBWR]
          8,2 7 171 40.721274724 8527 D WS 67711800 + 1024 [DBWR]
          8,2 7 172 40.721963819 8527 C WS 66841176 + 16 [0]
          8,2 7 173 40.722124955 8527 A WS 65613624 + 1024 <- (253,2) 49096504
          8,0 7 174 40.722125503 8527 A WS 67712824 + 1024 <- (8,2) 65613624
          8,2 7 175 40.722126448 8527 Q WS 67712824 + 1024 [DBWR]
          8,2 7 176 40.722129863 8527 G WS 67712824 + 1024 [DBWR]
          8,2 7 177 40.722134286 8527 I WS 67712824 + 1024 [DBWR]
          8,2 7 178 40.722136074 8527 D WS 67712824 + 1024 [DBWR]
          8,2 7 179 40.722864681 8527 A WS 65614648 + 32 <- (253,2) 49097528
          8,0 7 180 40.722865039 8527 A WS 67713848 + 32 <- (8,2) 65614648
          8,2 7 181 40.722865720 8527 Q WS 67713848 + 32 [DBWR]
          8,2 7 182 40.722868126 8527 G WS 67713848 + 32 [DBWR]
          8,2 7 183 40.722869365 8527 I WS 67713848 + 32 [DBWR]
          8,2 7 184 40.722870938 8527 D WS 67713848 + 32 [DBWR]
          8,2 7 185 40.722968313 8527 A WS 65615160 + 256 <- (253,2) 49098040
          8,0 7 186 40.722968631 8527 A WS 67714360 + 256 <- (8,2) 65615160
          8,2 7 187 40.722969119 8527 Q WS 67714360 + 256 [DBWR]
          8,2 7 188 40.722970629 8527 G WS 67714360 + 256 [DBWR]
          8,2 7 189 40.722972042 8527 I WS 67714360 + 256 [DBWR]
          8,2 7 190 40.722973008 8527 D WS 67714360 + 256 [DBWR]
          8,2 7 191 40.724848855 0 C WS 67714360 + 256 [0]
          8,2 7 192 40.724994181 0 C WS 67711800 + 1024 [0]
          8,2 7 193 40.726535926 0 C WS 67713848 + 32 [0]
          8,2 7 194 40.726539508 0 C WS 67712824 + 1024 [0]
          。。。。。。
          8,2 3 275 40.736419873 8525 A WS 64168488 + 16 <- (253,2) 47651368
          8,0 3 276 40.736420281 8525 A WS 66267688 + 16 <- (8,2) 64168488
          8,2 3 277 40.736421120 8525 Q WS 66267688 + 16 [CKPT]
          8,2 3 278 40.736423906 8525 G WS 66267688 + 16 [CKPT]
          8,2 3 279 40.736425223 8525 I WS 66267688 + 16 [CKPT]
          8,2 3 280 40.736426923 8525 D WS 66267688 + 16 [CKPT]
          8,2 3 281 40.736771857 0 C WS 66267688 + 16 [0]
          8,2 3 282 40.736813613 8525 A WSM 59646060 + 2 <- (253,2) 43128940
          8,0 3 283 40.736813974 8525 A WSM 61745260 + 2 <- (8,2) 59646060
          8,2 3 284 40.736814499 8525 Q WSM 61745260 + 2 [CKPT]
          8,2 3 285 40.736816724 8525 G WSM 61745260 + 2 [CKPT]
          8,2 3 286 40.736817426 8525 P N [CKPT]
          8,2 3 287 40.736818608 8525 I WSM 61745260 + 2 [CKPT]
          8,2 3 288 40.736819547 8525 U N [CKPT] 1
          8,2 3 289 40.736820242 8525 D WSM 61745260 + 2 [CKPT]
          8,2 3 290 40.738214216 0 C WSM 61745260 + 2 [0]
          。。。。。。


          Total (sda2):
          Reads Queued: 0, 0KiB Writes Queued: 134, 5,867KiB
          Read Dispatches: 0, 0KiB Write Dispatches: 127, 5,869KiB
          Reads Requeued: 0 Writes Requeued: 0
          Reads Completed: 0, 0KiB Writes Completed: 127, 5,869KiB
          Read Merges: 0, 0KiB Write Merges: 7, 32KiB
          IO unplugs: 52 Timer unplugs: 0


          Throughput (R/W): 0KiB/s 144KiB/s
          Events (sda2): 1,021 entries
          Skips: 0 forward (0 - 0.0%)

          然后通过btt -i sda2.blktrace_all.parse  进一步格式化之后,我们选择其中一个便宜量的位置来看看

              8,2    7       51    40.703385848  8527  Q  WS 61925288 + 1024 [DBWR]
            8,2 7 52 40.703388681 8527 G WS 61925288 + 1024 [DBWR]
            8,2 7 53 40.703391836 8527 I WS 61925288 + 1024 [DBWR]
            8,2 7 54 40.703393673 8527 D WS 61925288 + 1024 [DBWR]
            8,2 7 55 40.704013939 8527 A WS 59827112 + 1024 <- (253,2) 43309992
            8,0 7 56 40.704014340 8527 A WS 61926312 + 1024 <- (8,2) 59827112
            8,2 7 57 40.704014895 8527 Q WS 61926312 + 1024 [DBWR]
            8,2 7 58 40.704017421 8527 G WS 61926312 + 1024 [DBWR]
            8,2 7 59 40.704020391 8527 I WS 61926312 + 1024 [DBWR]
            8,2 7 60 40.704021794 8527 D WS 61926312 + 1024 [DBWR]
            8,2 7 61 40.704536968 8527 A WS 59828136 + 544 <- (253,2) 43311016
            8,0 7 62 40.704537493 8527 A WS 61927336 + 544 <- (8,2) 59828136
            8,2 7 63 40.704538288 8527 Q WS 61927336 + 544 [DBWR]
            8,2 7 64 40.704541061 8527 G WS 61927336 + 544 [DBWR]
            8,2 7 65 40.704544014 8527 I WS 61927336 + 544 [DBWR]
            8,2 7 66 40.704545558 8527 D WS 61927336 + 544 [DBWR]
            8,2 7 67 40.705417456 0 C WS 61926312 + 1024 [0]
            8,2 7 68 40.705541425 0 C WS 61925288 + 1024 [0]

            这里我们过滤其中的偏移量 61925288,则可以看到该IO操作的前后位置:

              [root@yashandb1 ~]# cat sda2.blktrace_all.parse.offset_8,2_w.dat|grep 61925288
              40.703393673 61925288 61926312
              [root@yashandb1 ~]# cat sda2.blktrace_all.parse.offset_8,2_c.dat|grep 61925288
              40.703393673 61925288 61926312
              [root@yashandb1 ~]#

              根据前后数据相减,可以发现刚好等于1024,跟最前面看到的偏移量是、所读的block数是一致的。需要注意的是,这里的block是OS block。简单的讲,这一个DBWR的IO写请求,在os层实际上调用了1024次,大概也就是512kb。

              同时在进行测试的过程中,还发现了一些有趣的地方;比如表被truncate后,对象的data_object_id会加1,这与Oracle的机制一致,如下:

                SQL>  select object_id,data_object_id from dba_objects where object_name='TEST1';


                OBJECT_ID DATA_OBJECT_ID
                --------------------- ---------------------
                2288 2289


                1 row fetched.
                SQL>

                 其次还发现崖山数据库也存在ROWID的概念,虽然看上去跟Oracle ROWID不太一样,但是表达的含义确是一致的,甚至看起来我认为更直观,从这里可以看出,设计者是动过一些思考的。

                  SQL> select rowid from test1 where rownum < 3;


                  ROWID
                  --------------------------------------------
                  2289:4:0:21652:0
                  2289:4:0:21652:1


                  2 rows fetched.


                  SQL> select * from test1 where rowid='2289:4:0:21652:0';


                  OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS TEMPORARY GENERATED SECONDARY NAMESPACE SHARING EDITIONABLE DATABASE_MAINTAINED APPLICATION DUPLICATED SHARDED
                  ------------ ---------------------- ------------------- --------------------- --------------------- --------------------- ------------ ----------------- --------- --------- --------- --------- --------- ------------ ------- ----------- ------------------- ----------- ---------- -------
                  ENMO TEST115 2272 2272 TABLE 2023-11-15 2023-11-15 VALID N 1 NONE N N N


                  1 row fetched.
                  SQL>

                  不难看出崖山数据库的ROWID结构为:data_object_id:tbs_id:file_id:block_number:row#.

                  最后简单总结一下:

                  1、崖山数据库支持多块写,支持IO合并;单次最大IO应该是1mb。

                  2、支持rowid,且结构与Oracle一致,更加直观。

                  至于其他的一些功能特性,有时间再研究。

                  最后修改时间:2023-11-23 15:22:46
                  文章转载自Roger的数据库专栏,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

                  评论