Bug #39846 Falcon: Concurrent online alter causes assertion in SRLUpdateIndex::append()
Submitted: 4 Oct 2008 0:08 Modified: 9 Jan 2009 14:10
Reporter: Christopher Powers Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S1 (Critical)
Version: OS:Any
Assigned to: Christopher Powers CPU Architecture:Any
Tags: F_ONLINE ALTER

[4 Oct 2008 0:08] Christopher Powers
Description:
Concurrent online alter stress test causes an assertion in SRLUpdateIndex::append() because the index associated with the DeferredIndex being processed had been deleted.

How to repeat:
1. Install random query generator: 
https://inside.mysql.com/wiki/QARandomQueryGenerationTutorial

2. Run SystemQA falcon_online_alter

runall.pl 
   --basedir=<mysql directory> \
   --engine=Falcon \
   --grammar=conf/falcon_online_alter.yy \
   --threads=10 \
   --queries=100000

Suggested fix:
The problem is that deferredIndex->index is set to NULL by another thread performing Index::detachDeferredIndex():

void SRLUpdateIndex::append(DeferredIndex* deferredIndex)
{
   Sync syncIndexes(&log->syncIndexes, "SRLUpdateIndex::append(1)");
   syncIndexes.lock(Shared);

   Transaction *transaction = deferredIndex->transaction;
   DeferredIndexWalker walker(deferredIndex, NULL);
   uint indexId = deferredIndex->index->indexId;
   int idxVersion = deferredIndex->index->indexVersion;
   int tableSpaceId = deferredIndex->index->dbb->tableSpaceId;
...

This can be resolved by getting a shared lock on the DeferredIndex and confirming that ::index is valid before getting the indexId, indexVersion and tablespaceId.
[4 Oct 2008 0:09] Christopher Powers
Verified during debugging of Bug#39795, "Falcon: Online add index does not support index with non-null columns"
[4 Oct 2008 0:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/55299

2853 Christopher Powers	2008-10-03
      Bug#39846, "Falcon: Concurrent online alter causes assertion in SRLUpdateIndex::append()"
[9 Jan 2009 14:10] MC Brown
A note has been added to the 6.0.8 changelog: 

When performing an online DROP INDEX on a Falcon table, the operation may conflict with other index operations such as including index scans. When one client drops an index, another client may initiate a concurrent index operation that accesses the mapping object of the index being dropped, and this can cause a crash