1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Fixes of bugs from ASAN warnings, part one (#2796)

This commit is contained in:
Leonid Fedorov
2023-03-30 18:29:04 +03:00
committed by GitHub
parent a1d20d82d5
commit 2f153184c3
71 changed files with 591 additions and 2038 deletions

View File

@ -47,15 +47,10 @@ bool IDBFactory::installDefaultPlugins()
// protect these methods since we are changing our static data structure
boost::mutex::scoped_lock lock(fac_guard);
s_plugins[IDBDataFile::BUFFERED] =
FileFactoryEnt(IDBDataFile::BUFFERED, "buffered", new BufferedFileFactory(), new PosixFileSystem());
s_plugins[IDBDataFile::UNBUFFERED] = FileFactoryEnt(IDBDataFile::UNBUFFERED, "unbuffered",
new UnbufferedFileFactory(), new PosixFileSystem());
// TODO: use the installPlugin fcn below instead of declaring this statically, then remove the dependency
// IDBDatafile -> cloudio
// s_plugins[IDBDataFile::CLOUD] = FileFactoryEnt(IDBDataFile::CLOUD, "cloud", new SMFileFactory(), new
// SMFileSystem());
s_plugins.emplace(IDBDataFile::BUFFERED, FileFactoryEnt(IDBDataFile::BUFFERED, "buffered", new BufferedFileFactory(),
new PosixFileSystem()));
s_plugins.emplace(IDBDataFile::UNBUFFERED, FileFactoryEnt(IDBDataFile::UNBUFFERED, "unbuffered",
new UnbufferedFileFactory(), new PosixFileSystem()));
return false;
}
@ -86,7 +81,7 @@ bool IDBFactory::installPlugin(const std::string& plugin)
}
FileFactoryEnt ent = (*(FileFactoryEntryFunc)functor)();
s_plugins[ent.type] = ent;
s_plugins.emplace(ent.type, std::move(ent));
std::ostringstream oss;
oss << "IDBFactory::installPlugin: installed filesystem plugin " << plugin;
@ -112,7 +107,7 @@ IDBDataFile* IDBFactory::open(IDBDataFile::Types type, const char* fname, const
throw std::runtime_error(oss.str());
}
return s_plugins[type].factory->open(fname, mode, opts, colWidth);
return s_plugins.at(type).factory->open(fname, mode, opts, colWidth);
}
IDBFileSystem& IDBFactory::getFs(IDBDataFile::Types type)
@ -124,7 +119,14 @@ IDBFileSystem& IDBFactory::getFs(IDBDataFile::Types type)
throw std::runtime_error(oss.str());
}
return *(s_plugins[type].filesystem);
return *(s_plugins.at(type).filesystem);
}
FileFactoryEnt::~FileFactoryEnt()
{
delete filesystem;
delete factory;
}
} // namespace idbdatafile