1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4328 There is a new option in both cpimport and cpimport.bin to asign

an owner for all data files created by cpimport

The patch consists of two parts: cpimport.bin changes, cpimport splitter
changes

cpimport.bin computes uid_t and gid_t early and propagates it down the stack
where MCS creates data files
This commit is contained in:
Roman Nozdrin
2020-10-01 12:19:32 +00:00
parent f584bab846
commit 328ae25650
19 changed files with 200 additions and 43 deletions

View File

@ -785,10 +785,18 @@ int FileOp::extendFile(
// if obsolete file exists, "w+b" will truncate and write over
pFile = openFile( fileName, "w+b" );//new file
if (pFile == 0)
return ERR_FILE_CREATE;
{
// We presume the path will contain /
std::string filePath(fileName);
std::ostringstream ossChown;
if (chownDataFileDir(ossChown, filePath))
return ERR_FILE_CHOWN;
}
newFile = true;
if ( isDebug(DEBUG_1) && getLogger() )
@ -2923,5 +2931,24 @@ void FileOp::setFixFlag(bool isFix)
{
m_isFix = isFix;
}
bool FileOp::chownDataFileDir(std::ostringstream& error,
const std::string& fileName)
{
std::string dirName = fileName.substr(0, fileName.find_last_of('/'));
if (chownFileDir(error, fileName, dirName))
{
logging::Message::Args args;
logging::Message message(1);
args.add(error.str());
message.format(args);
logging::LoggingID lid(SUBSYSTEM_ID_WE_BULK);
logging::MessageLog ml(lid);
ml.logErrorMessage( message );
return true;
}
return false;
}
} //end of namespace