Improve error message when opening file for truncation (#4454)

Summary:
The old error message was misleading because it led people to believe the truncation operation failed.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4454

Differential Revision: D10203575

Pulled By: riversand963

fbshipit-source-id: c76482a132566635cb55d4c73d45c461f295ec43
main
Yanqin Jin 6 years ago committed by Facebook Github Bot
parent ce1fc5af09
commit b41b2d431e
  1. 4
      util/fault_injection_test_env.cc

@ -33,8 +33,8 @@ Status Truncate(Env* env, const std::string& filename, uint64_t length) {
const EnvOptions options; const EnvOptions options;
Status s = env->NewSequentialFile(filename, &orig_file, options); Status s = env->NewSequentialFile(filename, &orig_file, options);
if (!s.ok()) { if (!s.ok()) {
fprintf(stderr, "Cannot truncate file %s: %s\n", filename.c_str(), fprintf(stderr, "Cannot open file %s for truncation: %s\n",
s.ToString().c_str()); filename.c_str(), s.ToString().c_str());
return s; return s;
} }

Loading…
Cancel
Save