Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-1643

EBUSY from truncate()

    • Type: Icon: Task Task
    • Resolution: Done
    • WT2.5.2
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Hi!

      Sometimes when converting DB from BDB to WiredTiger we get EBUSY when trying to truncate() index file.
      The conversion code basically looks like the following:

      =============================
      system("rm -rf \"" WT_HOME "\" && mkdir \"" WT_HOME "\"");

      wiredtiger_open(WT_HOME, NULL, "create,checkpoint=(wait=30)", &conn);

      conn->open_session(conn, NULL, NULL, &session);
      session->create(session, "table:main", "key_format=u,value_format=u,columns=(k,v)");
      session->create(session, "index:main:index", "columns=(v)");
      session->create(session, "index:main:index1", "columns=(v)");

      /_ open BDB table, create cursor _/

      while (/_ BDB cursor next() returns records _/) {
      WT_ITEM ki, vi;
      /_ fill ki and vi from BDB record _/

      cursor->set_key(cursor, &ki);
      cursor->set_value(cursor, &vi);
      cursor->insert(cursor);
      }

      cursor->close(cursor);

      session->truncate(session, "file:main_index.wti", NULL, NULL, NULL);

      ============================= END

      The last truncate() call fails sometimes with EBUSY (Device or resource busy)
      In cases where I saw this problem conversion takes quite a long time so probably it's somehow related to periodic checkpoints configured with 30 sec period.
      I was able to reproduce it only on both 2.5.0 and develop.

      Please advise!

            Assignee:
            donald.anderson@mongodb.com Donald Anderson
            Reporter:
            dmitri-shubin Dmitri Shubin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: