Navigation Menu

Skip to content

Commit

Permalink
storage: fix a bug that auto repair may cause crash
Browse files Browse the repository at this point in the history
The following sequence causes crash:

  1. connection1: open indexes
  2. connection2: open indexes
  3. connection1: start operations log check and detects crash!
  4. connection2: start operations log check and blocked.
  5. connection1: finish auto repair by recreating indexes.
  6. connection2: is unblocked and detects no crash but has opened indexes
     that are recreated connection1.
  7. connection2: use dropped index and is crashed.

TODO:

  * The same problem exists in wrapper mode.
  * Reduce lock scope. We can reduce lock scope by detecting "DISABLE
    KEYS" mode without opening indexes.

[groonga-dev,03608]

Reported by Hiroshi Kagami. Thanks!!!
  • Loading branch information
kou committed Oct 29, 2015
1 parent 18deb72 commit 4892dfb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ha_mroonga.cpp
Expand Up @@ -4292,6 +4292,9 @@ int ha_mroonga::storage_open(const char *name, int mode, uint open_options)
}

if (!(open_options & HA_OPEN_FOR_REPAIR)) {
// TODO: Reduce lock scope
mrn::Lock lock(&mrn_operations_mutex);

error = storage_open_indexes(name);
if (error) {
storage_close_columns();
Expand All @@ -4303,7 +4306,6 @@ int ha_mroonga::storage_open(const char *name, int mode, uint open_options)
storage_set_keys_in_use();

{
mrn::Lock lock(&mrn_operations_mutex);
mrn::PathMapper mapper(name);
const char *table_name = mapper.table_name();
size_t table_name_size = strlen(table_name);
Expand Down

0 comments on commit 4892dfb

Please sign in to comment.