new WritableFileWriter(std::move(lfile), opt_env_opt));
new_log =
new log::Writer(std::move(file_writer), new_log_number,
- immutable_db_options_.recycle_log_file_num > 0);
+ immutable_db_options_.recycle_log_file_num > 0,
+ &db_options_);
}
}
new_log_number,
new log::Writer(
std::move(file_writer), new_log_number,
- impl->immutable_db_options_.recycle_log_file_num > 0));
+ impl->immutable_db_options_.recycle_log_file_num > 0,
+ _impl->db_options_));
// set column family handles
for (auto cf : column_families) {
#include <stdint.h>
#include "rocksdb/env.h"
+#include "rocksdb/options.h"
#include "util/coding.h"
#include "util/crc32c.h"
#include "util/file_reader_writer.h"
namespace log {
Writer::Writer(unique_ptr<WritableFileWriter>&& dest,
- uint64_t log_number, bool recycle_log_files)
- : dest_(std::move(dest)),
+ uint64_t log_number, bool recycle_log_files,
+ const DBOptions *opt)
+ : db_options_(opt),
+ dest_(std::move(dest)),
block_offset_(0),
log_number_(log_number),
recycle_log_files_(recycle_log_files) {
crc = crc32c::Mask(crc); // Adjust for storage
EncodeFixed32(buf, crc);
+ if (db_options_)
+ Log(InfoLogLevel::DEBUG_LEVEL, db_options_->info_log,
+ "EmitPhysicalRecord: log %lld offset %lld len %d crc %d",
+ (unsigned long long)log_number_,
+ (unsigned long long)dest_->GetFileSize(),
+ (int)header_size + (int)n,
+ crc);
+
// Write the header and the payload
Status s = dest_->Append(Slice(buf, header_size));
if (s.ok()) {
namespace rocksdb {
class WritableFileWriter;
+class DBOptions;
using std::unique_ptr;
// "*dest" must be initially empty.
// "*dest" must remain live while this Writer is in use.
explicit Writer(unique_ptr<WritableFileWriter>&& dest,
- uint64_t log_number, bool recycle_log_files);
+ uint64_t log_number, bool recycle_log_files,
+ const DBOptions *opt = NULL);
~Writer();
Status AddRecord(const Slice& slice);
uint64_t get_log_number() const { return log_number_; }
private:
+ const DBOptions *db_options_;
unique_ptr<WritableFileWriter> dest_;
size_t block_offset_; // Current offset in block
uint64_t log_number_;