/ Check-in [52e443eb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Instead of just the flags byte, include the first 8 bytes of the relevant page in an on-commit conflict log message.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | begin-concurrent-pnu
Files: files | file ages | folders
SHA3-256:52e443eb5523963a6b09be66ab1c7281930d0155bf3df13eee0ec9066dbc7f0b
User & Date: dan 2018-05-15 11:33:42
Context
2018-05-15
11:55
Merge latest trunk changes into this branch. check-in: 72f39efa user: dan tags: begin-concurrent-pnu
11:33
Instead of just the flags byte, include the first 8 bytes of the relevant page in an on-commit conflict log message. check-in: 52e443eb user: dan tags: begin-concurrent-pnu
11:28
Instead of just the flags byte, include the first 8 bytes of the relevant page in an on-commit conflict log message. check-in: e7dc03e7 user: dan tags: begin-concurrent
09:03
Include the value of the "flags" byte of the relevant page in the log message emitted when a BEGIN CONCURRENT commit conflict is detected. check-in: de19abb9 user: dan tags: begin-concurrent-pnu
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

 10473  10473   #ifdef SQLITE_OMIT_CONCURRENT
 10474  10474     assert( pgno==0 );
 10475  10475   #else
 10476  10476     if( rc==SQLITE_BUSY_SNAPSHOT && pgno ){
 10477  10477       PgHdr *pPg = 0;
 10478  10478       int rc2 = sqlite3PagerGet(pBt->pPager, pgno, &pPg, 0);
 10479  10479       if( rc2==SQLITE_OK ){
 10480         -      u8 pageFlags = 0;
 10481  10480         int bWrite = -1;
 10482  10481         const char *zObj = 0;
 10483  10482         const char *zTab = 0;
        10483  +      char zContent[17];
 10484  10484   
 10485  10485         if( pPg ){
 10486  10486           Pgno pgnoRoot = 0;
 10487  10487           HashElem *pE;
 10488  10488           Schema *pSchema;
        10489  +        u8 *aData = (u8*)sqlite3PagerGetData(pPg);
        10490  +        int i;
        10491  +        for(i=0; i<8; i++){
        10492  +          static const char hexdigits[] = {
        10493  +            '0', '1', '2', '3', '4', '5', '6', '7',
        10494  +            '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 
        10495  +          };
        10496  +          zContent[i*2] = hexdigits[(aData[i] >> 4)];
        10497  +          zContent[i*2+1] = hexdigits[(aData[i] & 0xF)];
        10498  +        }
        10499  +        zContent[16] = '\0';
 10489  10500   
 10490  10501           pgnoRoot = ((MemPage*)sqlite3PagerGetExtra(pPg))->pgnoRoot;
 10491  10502           bWrite = sqlite3PagerIswriteable(pPg);
 10492         -        pageFlags = ((u8*)sqlite3PagerGetData(pPg))[0];
 10493  10503           sqlite3PagerUnref(pPg);
 10494  10504   
 10495  10505           pSchema = sqlite3SchemaGet(p->db, p);
 10496  10506           if( pSchema ){
 10497  10507             for(pE=sqliteHashFirst(&pSchema->tblHash); pE; pE=sqliteHashNext(pE)){
 10498  10508               Table *pTab = (Table *)sqliteHashData(pE);
 10499  10509               if( pTab->tnum==(int)pgnoRoot ){
................................................................................
 10511  10521             }
 10512  10522           }
 10513  10523         }
 10514  10524   
 10515  10525         sqlite3_log(SQLITE_OK,
 10516  10526             "cannot commit CONCURRENT transaction "
 10517  10527             "- conflict at page %d "
 10518         -          "(%s page; part of db %s %s%s%s; flags=0x%02x)",
        10528  +          "(%s page; part of db %s %s%s%s; content=%s...)",
 10519  10529             (int)pgno,
 10520  10530             (bWrite==0?"read-only":(bWrite>0?"read/write":"unknown")),
 10521  10531             (zTab ? "index" : "table"),
 10522  10532             (zTab ? zTab : ""), (zTab ? "." : ""), (zObj ? zObj : "UNKNOWN"),
 10523         -          pageFlags
        10533  +          zContent
 10524  10534         );
 10525  10535       }
 10526  10536     }
 10527  10537   #endif
 10528  10538     sqlite3BtreeLeave(p);
 10529  10539     return rc;
 10530  10540   }

Changes to test/concurrent5.test.

    55     55     db eval {
    56     56       INSERT INTO t1 VALUES(randomblob(200), randomblob(200));
    57     57     }
    58     58   
    59     59     catchsql COMMIT db2
    60     60   } {1 {database is locked}}
    61     61   do_test_conflict_msg 1.1.2 {
    62         -  conflict at page 2 (read-only page; part of db table t1; flags=0x05)
           62  +  conflict at page 2 (read-only page; part of db table t1; content=0500000063021100...)
    63     63   }
    64     64   
    65     65   do_test 1.2.1 {
    66     66     set ::log [list]
    67     67     db2 eval {
    68     68       ROLLBACK;
    69     69       BEGIN CONCURRENT;
................................................................................
    74     74       INSERT INTO t1 VALUES(12, 11);
    75     75     }
    76     76   
    77     77     catchsql COMMIT db2
    78     78   } {1 {database is locked}}
    79     79   
    80     80   do_test_conflict_msg 1.2.2 {
    81         -  conflict at page 105 (read/write page; part of db table t1; flags=0x0d)
           81  +  conflict at page 105 (read/write page; part of db table t1; content=0D00000002026100...)
    82     82   }
    83     83   
    84     84   do_test 1.3.1 {
    85     85     set ::log [list]
    86     86     db2 eval {
    87     87       ROLLBACK;
    88     88       BEGIN CONCURRENT;
................................................................................
    93     93       INSERT INTO t2 VALUES('y');
    94     94     }
    95     95   
    96     96     catchsql COMMIT db2
    97     97   } {1 {database is locked}}
    98     98   
    99     99   do_test_conflict_msg 1.3.2 {
   100         -  conflict at page 3 (read/write page; part of db table t2; flags=0x0d)
          100  +  conflict at page 3 (read/write page; part of db table t2; content=0D0000000103FB00...)
   101    101   }
   102    102   
   103    103   do_test 1.4.1 {
   104    104     set ::log [list]
   105    105   
   106    106     execsql {
   107    107       ROLLBACK;
................................................................................
   117    117     } db2
   118    118   
   119    119     execsql { INSERT INTO t3 VALUES(NULL, 5002) } db
   120    120     catchsql COMMIT db2
   121    121   } {1 {database is locked}}
   122    122   
   123    123   do_test_conflict_msg 1.3.2 {
   124         -  conflict at page 211 (read/write page; part of db index t3.i3; flags=0x0a)
          124  +  conflict at page 211 (read/write page; part of db index t3.i3; content=0A0310006300D800...)
   125    125   }
   126    126   
   127    127   db close
   128    128   db2 close
   129    129   sqlite3_shutdown
   130    130   test_sqlite3_log 
   131    131   sqlite3_initialize
   132    132   finish_test
   133    133