diff --git a/db/wal_manager.cc b/db/wal_manager.cc index c5cf01748ab..dff3b126a0b 100644 --- a/db/wal_manager.cc +++ b/db/wal_manager.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "db/log_reader.h" @@ -172,8 +173,9 @@ void WalManager::PurgeObsoleteWALFiles() { s = env_->GetChildren(archival_dir, &files); if (!s.ok()) { IGNORE_STATUS_IF_ERROR(s); - ROCKS_LOG_ERROR(db_options_.info_log, "Can't get archive files: %s", - s.ToString().c_str()); + ROCKS_LOG_ERROR( + db_options_.info_log, "Can't get archive files: %s, Thread id: %lu", + s.ToString().c_str(), (unsigned long)pthread_self()); return; } @@ -190,8 +192,9 @@ void WalManager::PurgeObsoleteWALFiles() { if (!s.ok()) { IGNORE_STATUS_IF_ERROR(s); ROCKS_LOG_WARN(db_options_.info_log, - "Can't get file mod time: %s: %s", file_path.c_str(), - s.ToString().c_str()); + "Can't get file mod time: %s: %s, Thread id: %lu", + file_path.c_str(), s.ToString().c_str(), + (unsigned long)pthread_self()); continue; } if (now_seconds - file_m_time > db_options_.WAL_ttl_seconds) { @@ -199,8 +202,10 @@ void WalManager::PurgeObsoleteWALFiles() { /*force_fg=*/!wal_in_db_path_); if (!s.ok()) { IGNORE_STATUS_IF_ERROR(s); - ROCKS_LOG_WARN(db_options_.info_log, "Can't delete file: %s: %s", - file_path.c_str(), s.ToString().c_str()); + ROCKS_LOG_WARN(db_options_.info_log, + "Can't delete file: %s: %s, Thread id: %lu", + file_path.c_str(), s.ToString().c_str(), + (unsigned long)pthread_self()); continue; } else { MutexLock l(&read_first_record_cache_mutex_); @@ -216,8 +221,9 @@ void WalManager::PurgeObsoleteWALFiles() { if (!s.ok()) { IGNORE_STATUS_IF_ERROR(s); ROCKS_LOG_ERROR(db_options_.info_log, - "Unable to get file size: %s: %s", file_path.c_str(), - s.ToString().c_str()); + "Unable to get file size: %s: %s, , Thread id: %lu", + file_path.c_str(), s.ToString().c_str(), + (unsigned long)pthread_self()); return; } else { if (file_size > 0) { @@ -229,8 +235,9 @@ void WalManager::PurgeObsoleteWALFiles() { if (!s.ok()) { IGNORE_STATUS_IF_ERROR(s); ROCKS_LOG_WARN(db_options_.info_log, - "Unable to delete file: %s: %s", file_path.c_str(), - s.ToString().c_str()); + "Unable to delete file: %s: %s, Thread id: %lu", + file_path.c_str(), s.ToString().c_str(), + (unsigned long)pthread_self()); continue; } else { MutexLock l(&read_first_record_cache_mutex_); @@ -259,8 +266,9 @@ void WalManager::PurgeObsoleteWALFiles() { if (!s.ok()) { IGNORE_STATUS_IF_ERROR(s); ROCKS_LOG_WARN(db_options_.info_log, - "Unable to get archived WALs from: %s: %s", - archival_dir.c_str(), s.ToString().c_str()); + "Unable to get archived WALs from: %s: %s, Thread id: %lu", + archival_dir.c_str(), s.ToString().c_str(), + (unsigned long)pthread_self()); files_del_num = 0; } else if (files_del_num > archived_logs.size()) { ROCKS_LOG_WARN(db_options_.info_log, @@ -275,8 +283,10 @@ void WalManager::PurgeObsoleteWALFiles() { /*force_fg=*/!wal_in_db_path_); if (!s.ok()) { IGNORE_STATUS_IF_ERROR(s); - ROCKS_LOG_WARN(db_options_.info_log, "Unable to delete file: %s: %s", - file_path.c_str(), s.ToString().c_str()); + ROCKS_LOG_WARN(db_options_.info_log, + "Unable to delete file: %s: %s, Thread id: %lu", + file_path.c_str(), s.ToString().c_str(), + (unsigned long)pthread_self()); continue; } else { MutexLock l(&read_first_record_cache_mutex_); diff --git a/db_stress_tool/db_stress_shared_state.h b/db_stress_tool/db_stress_shared_state.h index 5d9fb34ac10..0fe7da1fcb4 100644 --- a/db_stress_tool/db_stress_shared_state.h +++ b/db_stress_tool/db_stress_shared_state.h @@ -378,7 +378,10 @@ class SharedState { } private: - static void IgnoreReadErrorCallback(void*) { ignore_read_error = true; } + static void IgnoreReadErrorCallback(void*) { + fprintf(stdout, "DBStress thread id: %lu\n", (unsigned long)pthread_self()); + ignore_read_error = true; + } // Pick random keys in each column family that will not experience overwrite. std::unordered_set GenerateNoOverwriteIds() const { diff --git a/db_stress_tool/no_batched_ops_stress.cc b/db_stress_tool/no_batched_ops_stress.cc index 5f8c06055ff..4826cc8aa01 100644 --- a/db_stress_tool/no_batched_ops_stress.cc +++ b/db_stress_tool/no_batched_ops_stress.cc @@ -1685,10 +1685,6 @@ class NonBatchedOpsStressTest : public StressTest { s = iter->status(); } - if (ro_copy.auto_refresh_iterator_with_snapshot) { - std::this_thread::sleep_for(std::chrono::microseconds(3 * 1000 * 1000)); - } - int injected_error_count = 0; if (fault_fs_guard) { injected_error_count = GetMinInjectedErrorCount( @@ -1701,6 +1697,8 @@ class NonBatchedOpsStressTest : public StressTest { // Grab mutex so multiple thread don't try to print the // stack trace at the same time MutexLock l(thread->shared->GetMutex()); + fprintf(stderr, "DBStress thread id: %lu\n", + (unsigned long)pthread_self()); fprintf(stderr, "Didn't get expected error from PrefixScan\n"); fprintf(stderr, "Callstack that injected the fault\n"); fault_fs_guard->PrintInjectedThreadLocalErrorBacktrace(