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

Removed unnecessary debugging printouts/logging, fixed a couple add'l bugs.

This commit is contained in:
Patrick LeBlanc
2020-05-27 14:57:10 -04:00
parent 6fd24d2d06
commit cd5e872104
5 changed files with 6 additions and 78 deletions

View File

@ -18,7 +18,6 @@
#include "Downloader.h"
#include "Config.h"
#include "SMLogging.h"
#include "MetadataFile.h"
#include <string>
#include <errno.h>
#include <iostream>
@ -167,13 +166,6 @@ void Downloader::Download::operator()()
bf::remove(tmpFile);
size = 0;
}
if (size != MetadataFile::getLengthFromKey(key))
{
ostringstream oss;
SMLogging *logr = SMLogging::get();
oss << "Downloader: got a file with a bad length field. key = " << key << " actual size = " << size;
logr->log(LOG_ERR, oss.str().c_str());
}
// move it to its proper place
boost::system::error_code berr;

View File

@ -489,7 +489,7 @@ ssize_t IOCoordinator::_write(const boost::filesystem::path &filename, const uin
l_errno = errno;
logger->log(LOG_ERR,"IOCoordinator::write(): Failed newObject.");
metadata.removeEntry(newObject.offset);
replicator->remove(firstDir/newObject.key);
replicator->remove(cachePath/firstDir/newObject.key);
errno = l_errno;
if (count == 0) // if no data has been written yet, it's safe to return -1 here.
return -1;
@ -499,7 +499,7 @@ ssize_t IOCoordinator::_write(const boost::filesystem::path &filename, const uin
{
// remove the object created above; can't have 0-length objects
metadata.removeEntry(newObject.offset);
replicator->remove(firstDir/newObject.key);
replicator->remove(cachePath/firstDir/newObject.key);
goto out;
}
else if ((uint)err < writeLength)
@ -533,14 +533,6 @@ ssize_t IOCoordinator::_write(const boost::filesystem::path &filename, const uin
goto out;
}
if (bf::file_size(cachePath/firstDir/newObject.key) != MetadataFile::getLengthFromKey(newObject.key))
{
ostringstream oss;
oss << "IOCoordinator::write(): detected bad length field in " << newObject.key
<< " real size = " << bf::file_size(cachePath/firstDir/newObject.key);
logger->log(LOG_ERR, oss.str().c_str());
}
cache->newObject(firstDir, newObject.key,writeLength + objectOffset);
newObjectKeys.push_back(newObject.key);
@ -649,7 +641,7 @@ ssize_t IOCoordinator::append(const char *_filename, const uint8_t *data, size_t
//log error and abort
logger->log(LOG_ERR,"IOCoordinator::append(): Failed newObject.");
metadata.removeEntry(newObject.offset);
replicator->remove(firstDir/newObject.key);
replicator->remove(cachePath/firstDir/newObject.key);
errno = l_errno;
// if no data was written successfully yet, it's safe to return -1 here.
if (count == 0)
@ -659,7 +651,7 @@ ssize_t IOCoordinator::append(const char *_filename, const uint8_t *data, size_t
else if (err == 0)
{
metadata.removeEntry(newObject.offset);
replicator->remove(firstDir/newObject.key);
replicator->remove(cachePath/firstDir/newObject.key);
goto out;
}
@ -688,14 +680,6 @@ ssize_t IOCoordinator::append(const char *_filename, const uint8_t *data, size_t
metadata.updateEntry(newObject.offset, newObject.key, err);
}
if (bf::file_size(cachePath/firstDir/newObject.key) != MetadataFile::getLengthFromKey(newObject.key))
{
ostringstream oss;
oss << "IOCoordinator::write(): detected bad length field in " << newObject.key
<< " real size = " << bf::file_size(cachePath/firstDir/newObject.key);
logger->log(LOG_ERR, oss.str().c_str());
}
cache->newObject(firstDir, newObject.key,err);
newObjectKeys.push_back(newObject.key);
@ -1026,7 +1010,6 @@ int IOCoordinator::copyFile(const char *_filename1, const char *_filename2)
}
if (bf::exists(metaFile2))
{
cout << "copyFile: deleting previous version of " << metaFile2 << endl;
deleteMetaFile(metaFile2);
++filesDeleted;
}
@ -1055,7 +1038,6 @@ int IOCoordinator::copyFile(const char *_filename1, const char *_filename2)
if (meta2.exists())
{
cout << "copyFile: this shouldn't happen" << endl;
meta2.removeAllEntries();
++filesDeleted;
}
@ -1086,23 +1068,6 @@ int IOCoordinator::copyFile(const char *_filename1, const char *_filename2)
", dest = " + filename2 + ". Object " + object.key + " does not exist in either "
"cloud storage or the cache!");
if (bf::file_size(cachedObjPath) != MetadataFile::getLengthFromKey(object.key))
{
ostringstream oss;
oss << "CopyFile: found a size mismatch in " << cachedObjPath <<
" real size = " << bf::file_size(cachedObjPath);
// XXXPAT: get a new key here
logger->log(LOG_ERR, oss.str().c_str());
}
if (MetadataFile::getLengthFromKey(object.key) != MetadataFile::getLengthFromKey(newObj.key))
{
ostringstream oss;
oss << "CopyFile: found a size mismatch in src and dest keys src = " << object.key <<
" dest = " << newObj.key;
logger->log(LOG_ERR, oss.str().c_str());
}
// put the copy in cloudstorage
err = cs->putObject(cachedObjPath.string(), newObj.key);
if (err)

View File

@ -104,8 +104,6 @@ int LocalStorage::copy(const bf::path &source, const bf::path &dest)
::unlink(dest.string().c_str());
return -1;
}
if (bf::file_size(source) != bf::file_size(dest))
logger->log(LOG_ERR, "LocalStorage::copy: partially copied a file somehow");
return 0;
}
@ -244,8 +242,6 @@ int LocalStorage::copyObject(const string &source, const string &dest)
size_t _size = bf::file_size(prefix/source);
bytesRead += _size;
bytesWritten += _size;
if (bf::file_size(prefix/source) != bf::file_size(prefix/dest))
logger->log(LOG_ERR, "LocalStorage::copyObject(): partially copied a file somehow");
}
return ret;
}

View File

@ -133,8 +133,6 @@ void PrefixCache::populate()
bf::directory_iterator dir(cachePrefix);
bf::directory_iterator dend;
vector<string> newObjects;
lru.clear();
m_lru.clear();
while (dir != dend)
{
// put everything in lru & m_lru
@ -383,7 +381,6 @@ void PrefixCache::deletedJournal(size_t size)
{
boost::unique_lock<boost::mutex> s(lru_mutex);
//assert(currentCacheSize >= size);
if (currentCacheSize >= size)
currentCacheSize -= size;
else
@ -399,7 +396,6 @@ void PrefixCache::deletedObject(const string &key, size_t size)
{
boost::unique_lock<boost::mutex> s(lru_mutex);
//assert(currentCacheSize >= size);
M_LRU_t::iterator mit = m_lru.find(key);
assert(mit != m_lru.end());

View File

@ -521,13 +521,6 @@ void Synchronizer::synchronize(const string &sourceFile, list<string>::iterator
return;
}
if (bf::file_size(objectPath) != MetadataFile::getLengthFromKey(cloudKey))
{
ostringstream oss;
oss << "Synchronizer::synchronize(): found a size mismatch in key = " << cloudKey <<
" real size = " << bf::file_size(objectPath);
logger->log(LOG_ERR, oss.str().c_str());
}
err = cs->putObject(objectPath.string(), cloudKey);
if (err)
throw runtime_error(string("synchronize(): uploading ") + key + ", got " + strerror_r(errno, buf, 80));
@ -703,20 +696,6 @@ void Synchronizer::synchronizeWithJournal(const string &sourceFile, list<string>
// get a new key for the resolved version & upload it
string newCloudKey = MetadataFile::getNewKeyFromOldKey(cloudKey, size);
string newKey = (prefix/newCloudKey).string();
try {
if (size != MetadataFile::getLengthFromKey(newCloudKey))
{
ostringstream oss;
oss << "SyncWithJournal: detected the file size mismatch on the merged object somehow. " <<
"key = " << newCloudKey << "real size = " << bf::file_size(prefix/newCloudKey);
logger->log(LOG_ERR, oss.str().c_str());
}
} catch(exception &e)
{
logger->log(LOG_ERR, "DEB4");
}
err = cs->putObject(data, size, newCloudKey);
if (err)
{