SQLite

Check-in [3ba08e53d5]
Login

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

Overview
Comment:New test case for reading and writing the same rtree concurrently.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3ba08e53d54165f5541756ad13a4c2f0b18516cb612a256e056ed1ff76c1fa83
User & Date: drh 2018-05-24 22:42:27.872
Context
2018-05-24
23:51
When doing a one-pass UPDATE or DELETE on virtual tables, close the cursor prior to running VUpdate. This allows one-pass to work on virtual tables that do not allow concurrent reads and writes. Enhance rtree to take advantage of this new capability. (check-in: b816023ce0 user: drh tags: trunk)
22:42
New test case for reading and writing the same rtree concurrently. (check-in: 3ba08e53d5 user: drh tags: trunk)
22:31
Do not allow RTree writes when a read cursor is active on the same virtual table, as the writes might rebalance and disrupt the read cursors. Return the new SQLITE_LOCKED_VTAB error code if this happens. (check-in: d4ce666108 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/rtree/rtree8.test.
174
175
176
177
178
179
180
























181
182
183
  execsql BEGIN
  for {set i 0} {$i < 200} {incr i} {
    execsql { DELETE FROM t2 WHERE id = $i }
  }
  execsql COMMIT
} {}
do_rtree_integrity_test rtree8-5.5 t2


























finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
  execsql BEGIN
  for {set i 0} {$i < 200} {incr i} {
    execsql { DELETE FROM t2 WHERE id = $i }
  }
  execsql COMMIT
} {}
do_rtree_integrity_test rtree8-5.5 t2

# 2018-05-24
# The following script caused an assertion fault and/or segfault
# prior to the fix that prevents simultaneous reads and writes on
# the same rtree virtual table.
#
do_test rtree8-6.1 {
  db close
  sqlite3 db :memory:
  db eval {
    PRAGMA page_size=512;
    CREATE VIRTUAL TABLE t1 USING rtree(id,x1,x2,y1,y2);
    WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c WHERE x<49)
    INSERT INTO t1 SELECT x, x, x+1, x, x+1 FROM c;
  }
  set rc [catch {
    db eval {SELECT id FROM t1} x {
      db eval {DELETE FROM t1 WHERE id=$x(id)}
    }
  } msg]
  lappend rc $msg
} {1 {database table is locked}}




finish_test