You've already forked mariadb-columnstore-engine
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:
@ -18,7 +18,6 @@
|
|||||||
#include "Downloader.h"
|
#include "Downloader.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "SMLogging.h"
|
#include "SMLogging.h"
|
||||||
#include "MetadataFile.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -167,13 +166,6 @@ void Downloader::Download::operator()()
|
|||||||
bf::remove(tmpFile);
|
bf::remove(tmpFile);
|
||||||
size = 0;
|
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
|
// move it to its proper place
|
||||||
boost::system::error_code berr;
|
boost::system::error_code berr;
|
||||||
|
@ -489,7 +489,7 @@ ssize_t IOCoordinator::_write(const boost::filesystem::path &filename, const uin
|
|||||||
l_errno = errno;
|
l_errno = errno;
|
||||||
logger->log(LOG_ERR,"IOCoordinator::write(): Failed newObject.");
|
logger->log(LOG_ERR,"IOCoordinator::write(): Failed newObject.");
|
||||||
metadata.removeEntry(newObject.offset);
|
metadata.removeEntry(newObject.offset);
|
||||||
replicator->remove(firstDir/newObject.key);
|
replicator->remove(cachePath/firstDir/newObject.key);
|
||||||
errno = l_errno;
|
errno = l_errno;
|
||||||
if (count == 0) // if no data has been written yet, it's safe to return -1 here.
|
if (count == 0) // if no data has been written yet, it's safe to return -1 here.
|
||||||
return -1;
|
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
|
// remove the object created above; can't have 0-length objects
|
||||||
metadata.removeEntry(newObject.offset);
|
metadata.removeEntry(newObject.offset);
|
||||||
replicator->remove(firstDir/newObject.key);
|
replicator->remove(cachePath/firstDir/newObject.key);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else if ((uint)err < writeLength)
|
else if ((uint)err < writeLength)
|
||||||
@ -532,14 +532,6 @@ ssize_t IOCoordinator::_write(const boost::filesystem::path &filename, const uin
|
|||||||
newObjectKeys.push_back(newObject.key);
|
newObjectKeys.push_back(newObject.key);
|
||||||
goto out;
|
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);
|
cache->newObject(firstDir, newObject.key,writeLength + objectOffset);
|
||||||
newObjectKeys.push_back(newObject.key);
|
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
|
//log error and abort
|
||||||
logger->log(LOG_ERR,"IOCoordinator::append(): Failed newObject.");
|
logger->log(LOG_ERR,"IOCoordinator::append(): Failed newObject.");
|
||||||
metadata.removeEntry(newObject.offset);
|
metadata.removeEntry(newObject.offset);
|
||||||
replicator->remove(firstDir/newObject.key);
|
replicator->remove(cachePath/firstDir/newObject.key);
|
||||||
errno = l_errno;
|
errno = l_errno;
|
||||||
// if no data was written successfully yet, it's safe to return -1 here.
|
// if no data was written successfully yet, it's safe to return -1 here.
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
@ -659,7 +651,7 @@ ssize_t IOCoordinator::append(const char *_filename, const uint8_t *data, size_t
|
|||||||
else if (err == 0)
|
else if (err == 0)
|
||||||
{
|
{
|
||||||
metadata.removeEntry(newObject.offset);
|
metadata.removeEntry(newObject.offset);
|
||||||
replicator->remove(firstDir/newObject.key);
|
replicator->remove(cachePath/firstDir/newObject.key);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,14 +679,6 @@ ssize_t IOCoordinator::append(const char *_filename, const uint8_t *data, size_t
|
|||||||
|
|
||||||
metadata.updateEntry(newObject.offset, newObject.key, err);
|
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);
|
cache->newObject(firstDir, newObject.key,err);
|
||||||
newObjectKeys.push_back(newObject.key);
|
newObjectKeys.push_back(newObject.key);
|
||||||
@ -1026,7 +1010,6 @@ int IOCoordinator::copyFile(const char *_filename1, const char *_filename2)
|
|||||||
}
|
}
|
||||||
if (bf::exists(metaFile2))
|
if (bf::exists(metaFile2))
|
||||||
{
|
{
|
||||||
cout << "copyFile: deleting previous version of " << metaFile2 << endl;
|
|
||||||
deleteMetaFile(metaFile2);
|
deleteMetaFile(metaFile2);
|
||||||
++filesDeleted;
|
++filesDeleted;
|
||||||
}
|
}
|
||||||
@ -1055,7 +1038,6 @@ int IOCoordinator::copyFile(const char *_filename1, const char *_filename2)
|
|||||||
|
|
||||||
if (meta2.exists())
|
if (meta2.exists())
|
||||||
{
|
{
|
||||||
cout << "copyFile: this shouldn't happen" << endl;
|
|
||||||
meta2.removeAllEntries();
|
meta2.removeAllEntries();
|
||||||
++filesDeleted;
|
++filesDeleted;
|
||||||
}
|
}
|
||||||
@ -1086,23 +1068,6 @@ int IOCoordinator::copyFile(const char *_filename1, const char *_filename2)
|
|||||||
", dest = " + filename2 + ". Object " + object.key + " does not exist in either "
|
", dest = " + filename2 + ". Object " + object.key + " does not exist in either "
|
||||||
"cloud storage or the cache!");
|
"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
|
// put the copy in cloudstorage
|
||||||
err = cs->putObject(cachedObjPath.string(), newObj.key);
|
err = cs->putObject(cachedObjPath.string(), newObj.key);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -104,8 +104,6 @@ int LocalStorage::copy(const bf::path &source, const bf::path &dest)
|
|||||||
::unlink(dest.string().c_str());
|
::unlink(dest.string().c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (bf::file_size(source) != bf::file_size(dest))
|
|
||||||
logger->log(LOG_ERR, "LocalStorage::copy: partially copied a file somehow");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,8 +242,6 @@ int LocalStorage::copyObject(const string &source, const string &dest)
|
|||||||
size_t _size = bf::file_size(prefix/source);
|
size_t _size = bf::file_size(prefix/source);
|
||||||
bytesRead += _size;
|
bytesRead += _size;
|
||||||
bytesWritten += _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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,6 @@ void PrefixCache::populate()
|
|||||||
bf::directory_iterator dir(cachePrefix);
|
bf::directory_iterator dir(cachePrefix);
|
||||||
bf::directory_iterator dend;
|
bf::directory_iterator dend;
|
||||||
vector<string> newObjects;
|
vector<string> newObjects;
|
||||||
lru.clear();
|
|
||||||
m_lru.clear();
|
|
||||||
while (dir != dend)
|
while (dir != dend)
|
||||||
{
|
{
|
||||||
// put everything in lru & m_lru
|
// put everything in lru & m_lru
|
||||||
@ -382,8 +380,7 @@ void PrefixCache::newJournalEntry(size_t size)
|
|||||||
void PrefixCache::deletedJournal(size_t size)
|
void PrefixCache::deletedJournal(size_t size)
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> s(lru_mutex);
|
boost::unique_lock<boost::mutex> s(lru_mutex);
|
||||||
|
|
||||||
//assert(currentCacheSize >= size);
|
|
||||||
if (currentCacheSize >= size)
|
if (currentCacheSize >= size)
|
||||||
currentCacheSize -= size;
|
currentCacheSize -= size;
|
||||||
else
|
else
|
||||||
@ -398,8 +395,7 @@ void PrefixCache::deletedJournal(size_t size)
|
|||||||
void PrefixCache::deletedObject(const string &key, size_t size)
|
void PrefixCache::deletedObject(const string &key, size_t size)
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> s(lru_mutex);
|
boost::unique_lock<boost::mutex> s(lru_mutex);
|
||||||
|
|
||||||
//assert(currentCacheSize >= size);
|
|
||||||
M_LRU_t::iterator mit = m_lru.find(key);
|
M_LRU_t::iterator mit = m_lru.find(key);
|
||||||
assert(mit != m_lru.end());
|
assert(mit != m_lru.end());
|
||||||
|
|
||||||
|
@ -521,13 +521,6 @@ void Synchronizer::synchronize(const string &sourceFile, list<string>::iterator
|
|||||||
return;
|
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);
|
err = cs->putObject(objectPath.string(), cloudKey);
|
||||||
if (err)
|
if (err)
|
||||||
throw runtime_error(string("synchronize(): uploading ") + key + ", got " + strerror_r(errno, buf, 80));
|
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
|
// get a new key for the resolved version & upload it
|
||||||
string newCloudKey = MetadataFile::getNewKeyFromOldKey(cloudKey, size);
|
string newCloudKey = MetadataFile::getNewKeyFromOldKey(cloudKey, size);
|
||||||
string newKey = (prefix/newCloudKey).string();
|
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);
|
err = cs->putObject(data, size, newCloudKey);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user