rocksdb/db/wide/wide_columns_helper.h
Levi Tamasi b00fa5597e Fix the handling of wide-column base values in the max_successive_merges logic (#11913)
Summary:
Pull Request resolved: https://github.com/facebook/rocksdb/pull/11913

The `max_successive_merges` logic currently does not handle wide-column base values correctly, since it uses the `Get` API, which only returns the value of the default column. The patch fixes this by switching to `GetEntity` and passing all columns (if applicable) to the merge operator.

Reviewed By: jaykorean

Differential Revision: D49795097

fbshipit-source-id: 75eb7cc9476226255062cdb3d43ab6bd1cc2faa3
2023-10-02 16:25:25 -07:00

41 lines
1.2 KiB
C++

// Copyright (c) Meta Platforms, Inc. and affiliates.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#pragma once
#include <ostream>
#include <string>
#include "rocksdb/rocksdb_namespace.h"
#include "rocksdb/wide_columns.h"
namespace ROCKSDB_NAMESPACE {
class WideColumnsHelper {
public:
static void DumpWideColumns(const WideColumns& columns, std::ostream& os,
bool hex);
static Status DumpSliceAsWideColumns(const Slice& value, std::ostream& os,
bool hex);
static bool HasDefaultColumn(const WideColumns& columns) {
return !columns.empty() && columns.front().name() == kDefaultWideColumnName;
}
static bool HasDefaultColumnOnly(const WideColumns& columns) {
return columns.size() == 1 &&
columns.front().name() == kDefaultWideColumnName;
}
static const Slice& GetDefaultColumn(const WideColumns& columns) {
assert(HasDefaultColumn(columns));
return columns.front().value();
}
static void SortColumns(WideColumns& columns);
};
} // namespace ROCKSDB_NAMESPACE