mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 02:18:39 +08:00
In the old mutation logs, a version's mutations are serialized as a buffer. Then the buffer is split into smaller chunks, e.g., 10000 bytes each. When writting chunks to the final mutation log file, these chunks can be flushed out of order. For instance, the (version, chunck_part) can be in the order of (3, 0), (4, 0), (3, 1). As a result, the decoder must read forward to find all chunks of data for a version. Another complication is that the files are organized into blocks, where (3, 1) can be in a subsequent block. This change checks the value size for each version, if the size is smaller than the right size, the decoder will look for the missing chucks in the next block.
65 lines
2.5 KiB
C++
65 lines
2.5 KiB
C++
/*
|
|
* FileConverter.h
|
|
*
|
|
* This source file is part of the FoundationDB open source project
|
|
*
|
|
* Copyright 2013-2019 Apple Inc. and the FoundationDB project authors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef FDBBACKUP_FILECONVERTER_H
|
|
#define FDBBACKUP_FILECONVERTER_H
|
|
#pragma once
|
|
|
|
#include <cinttypes>
|
|
#include "flow/SimpleOpt.h"
|
|
|
|
namespace file_converter {
|
|
|
|
// File format convertion constants
|
|
enum {
|
|
OPT_CONTAINER,
|
|
OPT_BEGIN_VERSION,
|
|
OPT_CRASHONERROR,
|
|
OPT_END_VERSION,
|
|
OPT_TRACE,
|
|
OPT_TRACE_DIR,
|
|
OPT_TRACE_FORMAT,
|
|
OPT_TRACE_LOG_GROUP,
|
|
OPT_INPUT_FILE,
|
|
OPT_HELP
|
|
};
|
|
|
|
CSimpleOpt::SOption gConverterOptions[] = { { OPT_CONTAINER, "-r", SO_REQ_SEP },
|
|
{ OPT_CONTAINER, "--container", SO_REQ_SEP },
|
|
{ OPT_BEGIN_VERSION, "-b", SO_REQ_SEP },
|
|
{ OPT_BEGIN_VERSION, "--begin", SO_REQ_SEP },
|
|
{ OPT_CRASHONERROR, "--crash", SO_NONE },
|
|
{ OPT_END_VERSION, "-e", SO_REQ_SEP },
|
|
{ OPT_END_VERSION, "--end", SO_REQ_SEP },
|
|
{ OPT_TRACE, "--log", SO_NONE },
|
|
{ OPT_TRACE_DIR, "--logdir", SO_REQ_SEP },
|
|
{ OPT_TRACE_FORMAT, "--trace_format", SO_REQ_SEP },
|
|
{ OPT_TRACE_LOG_GROUP, "--loggroup", SO_REQ_SEP },
|
|
{ OPT_INPUT_FILE, "-i", SO_REQ_SEP },
|
|
{ OPT_INPUT_FILE, "--input", SO_REQ_SEP },
|
|
{ OPT_HELP, "-?", SO_NONE },
|
|
{ OPT_HELP, "-h", SO_NONE },
|
|
{ OPT_HELP, "--help", SO_NONE },
|
|
SO_END_OF_OPTIONS };
|
|
|
|
} // namespace file_converter
|
|
|
|
#endif // FDBBACKUP_FILECONVERTER_H
|