1 Reply Latest reply: Apr 27, 2012 5:48 PM by 526060 RSS

    BDBSQL_FILE_PER_TABLE flag not working with BDB 5.3.15

    907700
      Hi,

      I am trying to compile Berkeley DB version 5.3.15 with BDBSQL_FILE_PER_TABLE flag to store each table created in DBSQL as a seperate file.

      The issue I am facing is that all the table files along with the metadata file are being created outside the "database location". The issue does not exist with Berkeley DB version 5.2.

      After looking into the file "sqlite3.c" I figured the problem was present in the function "btreePrepareEnvironment" in the following portion of the code.

      #ifdef BDBSQL_FILE_PER_TABLE
      /* Reuse envDirNameBuf. */
      dirPathName = dirPathBuf;
      memset(dirPathName, 0, BT_MAX_PATH);
      *//sqlite3_snprintf(sizeof(dirPathName), dirPathName, // The size of dirPathName = 4. only "../" portion was getting copied to dirPathName variable.*
      sqlite3_snprintf(sizeof(dirPathBuf), dirPathName, // TEMP FIX
      "../%s", pBt->short_name);
      pDbEnv->set_data_dir(pDbEnv, dirPathName);
      pDbEnv->set_create_dir(pDbEnv, dirPathName);
      #else
      pDbEnv->set_data_dir(pDbEnv, "..");
      #endif

      Please let me know if this is a sufficient fix. Also can I get an official patch for the fix?

      Regards
      Sandeep