Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataLog: Fix behavior when low on space #6486

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private static void logMain() {
// based on free disk space, scan for "old" FRC_*.wpilog files and remove
{
File logDir = new File(m_logDir);
long freeSpace = logDir.getFreeSpace();
long freeSpace = logDir.getUsableSpace();
if (freeSpace < kFreeSpaceThreshold) {
// Delete oldest FRC_*.wpilog files (ignore FRC_TBD_*.wpilog as we just created one)
File[] files =
Expand Down Expand Up @@ -304,7 +304,7 @@ private static void logMain() {
+ freeSpace / 1000000
+ " MB of free space remaining! Logs will get deleted below "
+ kFreeSpaceThreshold / 1000000
+ " MB of free space."
+ " MB of free space. "
+ "Consider deleting logs off the storage device.",
false);
}
Expand Down
3 changes: 3 additions & 0 deletions wpiutil/src/main/native/cpp/DataLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ void DataLog::WriterThreadMain(std::string_view dir) {
lock.unlock();
StartLogFile(state);
lock.lock();
if (m_state == kStopped) {
continue;
}
Gold856 marked this conversation as resolved.
Show resolved Hide resolved
if (state.f != fs::kInvalidFile) {
// Emit start and schema data records
for (auto&& entryInfo : m_entries) {
Expand Down
Loading