Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
zacw7 committed Oct 28, 2024
1 parent a688ce0 commit 722e516
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions velox/common/caching/SsdFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,20 @@ bool SsdFile::write(
<< ", size: " << iovecs.size() << ", offset: " << offset
<< ", error code: " << errno
<< ", error string: " << folly::errnoStr(errno);
// 1. The file descriptor fd is not valid.
// 2. The array of buffers iov is null or has a null pointer in it.
// 3. The number of buffers iovcnt is less than 1 or greater than UIO_MAXIOV.
// 4. The offset offset is negative or greater than the size of the file.
auto fd = writeDataFile_->fd();
VELOX_SSD_CACHE_LOG(ERROR) << " fd " << fd;
int flags = fcntl(fd, F_GETFD);
VELOX_SSD_CACHE_LOG(ERROR) << "fd flags: " << flags << " err: " << folly::errnoStr(errno);
VELOX_SSD_CACHE_LOG(ERROR) << " iovecs ";
for (const auto iovec :iovecs) {
VELOX_SSD_CACHE_LOG(ERROR) << "iov_base == nullptr: " << (iovec.iov_base == nullptr) << " len " << iovec.iov_len;
}
VELOX_SSD_CACHE_LOG(ERROR) << " iovcnt " << iovecs.size();
VELOX_SSD_CACHE_LOG(ERROR) << " offset " << offset;
++stats_.writeSsdErrors;
return false;
}
Expand Down
9 changes: 9 additions & 0 deletions velox/common/file/File.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ class WriteFile {
/// be needed to get the exact size written, and this should be able to be
/// called after the file close.
virtual uint64_t size() const = 0;

virtual int32_t fd() {
VELOX_NYI("{} is not implemented", __FUNCTION__);
}
};

// We currently do a simple implementation for the in-memory files
Expand Down Expand Up @@ -349,6 +353,11 @@ class LocalWriteFile final : public WriteFile {
return size_;
}

int32_t fd() {
return fd_;
}


private:
// File descriptor.
int32_t fd_{-1};
Expand Down

0 comments on commit 722e516

Please sign in to comment.