From 29bec740f5be36417e9bdaf0a44f3f9e6757d1a4 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Wed, 23 Mar 2022 14:28:13 -0700 Subject: [PATCH] Return invalid argument if batch is null (#9744) Summary: Originally, a corruption will be returned by `DBImpl::WriteImpl(batch...)` if batch is null. This is inaccurate since there is no data corruption. Return `Status::InvalidArgument()` instead. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9744 Test Plan: make check Reviewed By: ltamasi Differential Revision: D35086268 Pulled By: riversand963 fbshipit-source-id: 677397b007a53bc25210eac0178d49c9797b5951 --- db/db_impl/db_impl_write.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_impl/db_impl_write.cc b/db/db_impl/db_impl_write.cc index 51edd14b4..6aaff802d 100644 --- a/db/db_impl/db_impl_write.cc +++ b/db/db_impl/db_impl_write.cc @@ -129,7 +129,7 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options, PreReleaseCallback* pre_release_callback) { assert(!seq_per_batch_ || batch_cnt != 0); if (my_batch == nullptr) { - return Status::Corruption("Batch is nullptr!"); + return Status::InvalidArgument("Batch is nullptr!"); } else if (!disable_memtable && WriteBatchInternal::TimestampsUpdateNeeded(*my_batch)) { // If writing to memtable, then we require the caller to set/update the