Merge branch 'release-5.0'
This commit is contained in:
commit
e318aabe55
|
@ -562,7 +562,7 @@ private:
|
|||
// TODO: Don't do this hacky investigation-specific thing
|
||||
StringRef fname(filename);
|
||||
if(fname.endsWith(LiteralStringRef(".sqlite")) || fname.endsWith(LiteralStringRef(".sqlite-wal"))) {
|
||||
std::string logFileName = filename;
|
||||
std::string logFileName = basename(filename);
|
||||
while(logFileName.find("/") != std::string::npos)
|
||||
logFileName = logFileName.substr(logFileName.find("/") + 1);
|
||||
if(!logFileName.empty()) {
|
||||
|
@ -576,12 +576,13 @@ private:
|
|||
logFile = fopen(logFileName.c_str(), "w");
|
||||
if(logFile != nullptr)
|
||||
TraceEvent("KAIOLogOpened").detail("File", filename).detail("LogFile", logFileName);
|
||||
else
|
||||
else {
|
||||
TraceEvent(SevWarn, "KAIOLogOpenFailure")
|
||||
.detail("File", filename)
|
||||
.detail("LogFile", logFileName)
|
||||
.detail("ErrorCode", errno)
|
||||
.detail("ErrorDesc", strerror(errno));
|
||||
}
|
||||
} catch(Error &e) {
|
||||
TraceEvent(SevError, "KAIOLogOpenFailure").error(e);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ bool simulator_should_inject_fault( const char* context, const char* file, int l
|
|||
TraceEvent(SevWarn, "FaultInjected").detail("Context", context).detail("File", file).detail("Line", line).detail("ErrorCode", error_code);
|
||||
if(error_code == error_code_io_timeout) {
|
||||
g_network->setGlobal(INetwork::enASIOTimedOut, (flowGlobalType)true);
|
||||
g_network->setGlobal(INetwork::enASIOTimedOutInjected, (flowGlobalType)true);
|
||||
g_pSimulator->getCurrentProcess()->io_timeout_injected = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -64,13 +64,14 @@ public:
|
|||
|
||||
uint64_t fault_injection_r;
|
||||
double fault_injection_p1, fault_injection_p2;
|
||||
bool io_timeout_injected;
|
||||
|
||||
ProcessInfo(const char* name, LocalityData locality, ProcessClass startingClass, NetworkAddress address,
|
||||
INetworkConnections *net, const char* dataFolder, const char* coordinationFolder )
|
||||
: name(name), locality(locality), startingClass(startingClass), address(address), dataFolder(dataFolder),
|
||||
network(net), coordinationFolder(coordinationFolder), failed(false), excluded(false), cpuTicks(0),
|
||||
rebooting(false), fault_injection_p1(0), fault_injection_p2(0),
|
||||
fault_injection_r(0), machine(0)
|
||||
fault_injection_r(0), machine(0), io_timeout_injected(false)
|
||||
{}
|
||||
|
||||
Future<KillType> onShutdown() { return shutdownSignal.getFuture(); }
|
||||
|
|
|
@ -253,18 +253,11 @@ struct SQLiteDB : NonCopyable {
|
|||
|
||||
void checkError( const char* context, int rc ) {
|
||||
//if (g_random->random01() < .001) rc = SQLITE_INTERRUPT;
|
||||
|
||||
if (rc) {
|
||||
Error err = (rc == SQLITE_IOERR_TIMEOUT) ? io_timeout() : io_error();
|
||||
|
||||
// Our exceptions don't propagate through sqlite, so we don't know for sure if the error that caused this was
|
||||
// an injected fault. Assume that if fault injection is happening, this is an injected fault.
|
||||
//
|
||||
// Also, timeouts returned from our VFS plugin to SQLite are no always propagated out of the sqlite API as timeouts,
|
||||
// so if a timeout has been injected in this process then assume this error is an injected fault.
|
||||
if (g_network->isSimulated() &&
|
||||
( (g_simulator.getCurrentProcess()->fault_injection_p1 || g_simulator.getCurrentProcess()->rebooting) || (bool)g_network->global(INetwork::enASIOTimedOutInjected))
|
||||
)
|
||||
Error err = io_error();
|
||||
if (g_network->isSimulated() && (g_simulator.getCurrentProcess()->fault_injection_p1 || g_simulator.getCurrentProcess()->rebooting))
|
||||
err = err.asInjectedFault();
|
||||
|
||||
if (db)
|
||||
|
@ -2016,7 +2009,7 @@ ACTOR Future<Void> GenerateIOLogChecksumFile(std::string filename) {
|
|||
unsigned int c = 0;
|
||||
while(fread(buf, 1, 4096, f) > 0)
|
||||
fprintf(fout, "%u %u\n", c++, hashlittle(buf, 4096, 0xab12fd93));
|
||||
fclose(f);
|
||||
fclose(f);
|
||||
fclose(fout);
|
||||
|
||||
return Void();
|
||||
|
|
|
@ -113,8 +113,6 @@ static int asyncRead(sqlite3_file *pFile, void *zBuf, int iAmt, sqlite_int64 iOf
|
|||
}
|
||||
return SQLITE_OK;
|
||||
} catch (Error& e) {
|
||||
if(e.code() == error_code_io_timeout)
|
||||
return SQLITE_IOERR_TIMEOUT;
|
||||
return SQLITE_IOERR_READ;
|
||||
}
|
||||
}
|
||||
|
@ -148,8 +146,6 @@ static int asyncReadZeroCopy(sqlite3_file *pFile, void **data, int iAmt, sqlite_
|
|||
++p->debug_zcreads;
|
||||
return SQLITE_OK;
|
||||
} catch (Error& e) {
|
||||
if(e.code() == error_code_io_timeout)
|
||||
return SQLITE_IOERR_TIMEOUT;
|
||||
return SQLITE_IOERR_READ;
|
||||
}
|
||||
}
|
||||
|
@ -183,8 +179,6 @@ static int asyncWrite(sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_in
|
|||
waitFor( p->file->write( zBuf, iAmt, iOfst ) );
|
||||
return SQLITE_OK;
|
||||
} catch(Error& e) {
|
||||
if(e.code() == error_code_io_timeout)
|
||||
return SQLITE_IOERR_TIMEOUT;
|
||||
return SQLITE_IOERR_WRITE;
|
||||
}
|
||||
}
|
||||
|
@ -195,8 +189,6 @@ static int asyncTruncate(sqlite3_file *pFile, sqlite_int64 size){
|
|||
waitFor( p->file->truncate( size ) );
|
||||
return SQLITE_OK;
|
||||
} catch(Error& e) {
|
||||
if(e.code() == error_code_io_timeout)
|
||||
return SQLITE_IOERR_TIMEOUT;
|
||||
return SQLITE_IOERR_TRUNCATE;
|
||||
}
|
||||
}
|
||||
|
@ -213,8 +205,6 @@ static int asyncSync(sqlite3_file *pFile, int flags){
|
|||
.detail("IAsyncFile", (int64_t)p->file.getPtr())
|
||||
.error(e);
|
||||
|
||||
if(e.code() == error_code_io_timeout)
|
||||
return SQLITE_IOERR_TIMEOUT;
|
||||
return SQLITE_IOERR_FSYNC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -649,6 +649,7 @@ static void printUsage( const char *name, bool devhelp ) {
|
|||
printf(" -k KEY, --key KEY Target key for search role.\n");
|
||||
printf(" -m SIZE, --memory SIZE\n"
|
||||
" Memory limit. The default value is 8GiB. When specified\n"
|
||||
printf(" --kvfile FILE Input file (SQLite database file) for use by the 'kvfilegeneratesums' and 'kvfileintegritycheck' roles.\n");
|
||||
" without a unit, MiB is assumed.\n");
|
||||
printf(" -M SIZE, --storage_memory SIZE\n"
|
||||
" Maximum amount of memory used for storage. The default\n"
|
||||
|
@ -816,7 +817,7 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
//Enables profiling on this thread (but does not start it)
|
||||
registerThreadForProfiling();
|
||||
|
||||
|
||||
std::string commandLine;
|
||||
for (int a = 0; a<argc; a++) {
|
||||
if (a) commandLine += ' ';
|
||||
|
@ -1438,7 +1439,7 @@ int main(int argc, char* argv[]) {
|
|||
// Initialize the thread pool
|
||||
CoroThreadPool::init();
|
||||
// Ordinarily, this is done when the network is run. However, network thread should be set before TraceEvents are logged. This thread will eventually run the network, so call it now.
|
||||
TraceEvent::setNetworkThread();
|
||||
TraceEvent::setNetworkThread();
|
||||
|
||||
if (role == Simulation || role == CreateTemplateDatabase) {
|
||||
//startOldSimulator();
|
||||
|
|
|
@ -454,7 +454,6 @@ SQLITE_API int sqlite3_exec(
|
|||
#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
|
||||
#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
|
||||
#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
|
||||
#define SQLITE_IOERR_TIMEOUT (SQLITE_IOERR | (21<<8))
|
||||
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
|
||||
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
|
||||
#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
|
||||
|
|
|
@ -76,10 +76,11 @@ struct ErrorInfo {
|
|||
};
|
||||
|
||||
Error checkIOTimeout(Error const &e) {
|
||||
// Convert io_errors to io_timeout if global timeout bool was set
|
||||
if(e.code() == error_code_io_error && (bool)g_network->global(INetwork::enASIOTimedOut)) {
|
||||
// Convert all_errors to io_timeout if global timeout bool was set
|
||||
if((bool)g_network->global(INetwork::enASIOTimedOut)) {
|
||||
Error timeout = io_timeout();
|
||||
if(e.isInjectedFault() || (bool)g_network->global(INetwork::enASIOTimedOutInjected))
|
||||
// If this error was injected OR if the timeout was injected then make the resulting io_timeout injected
|
||||
if(e.isInjectedFault() || (g_network->isSimulated() && g_pSimulator->getCurrentProcess()->io_timeout_injected) )
|
||||
timeout = timeout.asInjectedFault();
|
||||
return timeout;
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ ACTOR Future<Void> workerHandleErrors(FutureStream<ErrorInfo> errors) {
|
|||
loop choose {
|
||||
when( ErrorInfo _err = waitNext(errors) ) {
|
||||
ErrorInfo err = _err;
|
||||
err.error = checkIOTimeout(err.error); // Convert io_errors to io_timeout if ASIO flag is set
|
||||
err.error = checkIOTimeout(err.error); // Possibly convert error to io_timeout
|
||||
|
||||
bool ok =
|
||||
err.error.code() == error_code_success ||
|
||||
|
|
|
@ -196,7 +196,7 @@ public:
|
|||
|
||||
enum enumGlobal {
|
||||
enFailureMonitor = 0, enFlowTransport = 1, enTDMetrics = 2, enNetworkConnections = 3,
|
||||
enNetworkAddressFunc = 4, enFileSystem = 5, enASIOService = 6, enEventFD = 7, enRunCycleFunc = 8, enASIOTimedOut = 9, enASIOTimedOutInjected = 10
|
||||
enNetworkAddressFunc = 4, enFileSystem = 5, enASIOService = 6, enEventFD = 7, enRunCycleFunc = 8, enASIOTimedOut = 9
|
||||
};
|
||||
|
||||
virtual void longTaskCheck( const char* name ) {}
|
||||
|
|
Loading…
Reference in New Issue