Skip to content

Commit cc160cb

Browse files
committed
MB-51513: Revert "MB-34280: Set max DCP name to 200 characters"
This reverts commit 94b4570. With the restriction of 200 char limit it is possible that upgrading a pre 6.6.5 cluster will fail where previously it would have passed. Change-Id: I9ed740b5bba6225cb1418223485012384491682e Reviewed-on: https://review.couchbase.org/c/kv_engine/+/172485 Reviewed-by: Paolo Cocchi <[email protected]> Tested-by: Build Bot <[email protected]> Tested-by: Jim Walker <[email protected]>
1 parent db53ff0 commit cc160cb

File tree

6 files changed

+1
-121
lines changed

6 files changed

+1
-121
lines changed

daemon/mcbp_validators.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,6 @@ static Status dcp_open_validator(Cookie& cookie) {
546546
"consumer_name must be a string");
547547
return Status::Einval;
548548
}
549-
auto nm = kv.value().get<std::string>();
550-
if (nm.size() > cb::limits::MaxDcpName) {
551-
cookie.setErrorContext(
552-
"consumer_name limit is " +
553-
std::to_string(cb::limits::MaxDcpName) +
554-
" characters");
555-
return Status::Einval;
556-
}
557549
} else {
558550
cookie.setErrorContext("Unsupported JSON property " +
559551
kv.key());
@@ -565,14 +557,6 @@ static Status dcp_open_validator(Cookie& cookie) {
565557
return Status::Einval;
566558
}
567559
}
568-
569-
if (size_t(cookie.getHeader().getKeylen()) > cb::limits::MaxDcpName) {
570-
cookie.setErrorContext("Dcp name limit is " +
571-
std::to_string(cb::limits::MaxDcpName) +
572-
" characters");
573-
return Status::Einval;
574-
}
575-
576560
return verify_common_dcp_restrictions(cookie);
577561
}
578562

docs/dcp/documentation/commands/open-connection.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ Flags are specified as a bitmask in network byte order with the following bits d
4343

4444
When setting the Producer or Consumer flag the sender is telling the server what type of connection will be created. For example, if the Producer type is set then the sender of the Open Connection message will be a Consumer.
4545

46-
The connection name is specified using the key field. When selecting a name the
47-
only requirement is that the name take up no more space than 200 bytes. It is
48-
recommended that the name uses that ASCII character set and uses alpha-numeric
49-
characters. It is highly advantageous for improved supportability Couchbase
50-
Server that the connection names embed as much contextual information as
51-
possible from the client.
46+
The connection name is specified using the key field. When selecting a name the only requirement is that the name take up no more space than 256 bytes. It is recommended that the name uses that ASCII character set and uses alpha-numeric characters. It is highly advantageous for improved supportability Couchbase Server that the connection names embed as much contextual information as possible from the client.
5247

5348
As of version 6.5, the _value_ can be used to specify additional information
5449
about the connection to be opened. If non-empty, the value must be a JSON

engines/ep/src/connhandler.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ struct ConnCounter {
7272

7373
class ConnHandler : public DcpConnHandlerIface {
7474
public:
75-
/// The maximum length of a DCP stat name
76-
static constexpr size_t MaxDcpStatNameLength = 47;
77-
7875
enum class PausedReason : uint8_t {
7976
BufferLogFull,
8077
Initializing,

engines/ep/tests/module_tests/dcp_test.cc

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -401,92 +401,6 @@ TEST_F(DCPTest, MB30189_addStats) {
401401
&mockStats);
402402
}
403403

404-
TEST_F(DCPTest, MB34280) {
405-
create_dcp_producer();
406-
const std::string name = producer->getName();
407-
const std::size_t max = ConnHandler::MaxDcpStatNameLength;
408-
409-
auto validator = [&max](const std::string& name, std::string key) {
410-
auto idx = key.find(name);
411-
ASSERT_EQ(0, idx) << "Key: [" << key << "] does not start with ["
412-
<< name << "]";
413-
if (key.at(idx + name.length()) == ':') {
414-
idx++;
415-
}
416-
417-
auto v = key.substr(idx + name.length());
418-
EXPECT_GT(max, v.size())
419-
<< "DCP stat key [" << v << "] exceeds the max limit of " << max
420-
<< " characters";
421-
};
422-
423-
// Verify that the normal DCP producer stats don't exceed the max dcp stat
424-
// name
425-
producer->addStats(
426-
[&name, validator](std::string_view key,
427-
std::string_view value,
428-
gsl::not_null<const void*> cookie) {
429-
validator(name, std::string{key.data(), key.size()});
430-
},
431-
cookie);
432-
433-
// Verify that the normal DCP consumer stats don't exceed the max dcp stat
434-
// name
435-
const std::string consumer_name = "test_consumer";
436-
std::unique_ptr<DcpConsumer> consumer = std::make_unique<DcpConsumer>(
437-
*engine, cookie, consumer_name, consumer_name);
438-
consumer->addStats(
439-
[name = consumer_name, validator](
440-
std::string_view key,
441-
std::string_view value,
442-
gsl::not_null<const void*> cookie) {
443-
validator(name, std::string{key.data(), key.size()});
444-
},
445-
cookie);
446-
447-
// Verify that the vbucket stream related DCP stats don't exceed the max
448-
// dcp stat name
449-
setup_dcp_stream(0,
450-
IncludeValue::Yes,
451-
IncludeXattrs::Yes,
452-
{{"enable_sync_writes", "true"},
453-
{"consumer_name", "test_consumer"}});
454-
455-
stream->addStats(
456-
[&name, &max](std::string_view key,
457-
std::string_view value,
458-
gsl::not_null<const void*> cookie) {
459-
std::string k{key.data(), key.size()};
460-
auto idx = k.find(name);
461-
ASSERT_EQ(0, idx) << "Key: [" << key
462-
<< "] does not start with [" << name << "]";
463-
if (k.at(idx + name.length()) == ':') {
464-
idx++;
465-
}
466-
k = k.substr(idx + name.length());
467-
468-
// The stream operates on vbucket 0, lets use 1024 instead
469-
idx = k.find("_0_");
470-
ASSERT_NE(std::string::npos, idx)
471-
<< "DCP stream stat [" << k
472-
<< "] does not contain _0_ for vbucket 0";
473-
auto v = k.substr(0, idx);
474-
v.append("_1024_");
475-
v.append(k.substr(idx + 3));
476-
EXPECT_GT(max, v.size()) << "DCP stat key [" << v
477-
<< "] exceeds the max limit of " << max
478-
<< " characters";
479-
},
480-
cookie);
481-
482-
EXPECT_EQ(cb::engine_errc::no_such_key, destroy_dcp_stream());
483-
484-
stream.reset();
485-
vb0.reset();
486-
producer.reset();
487-
consumer.reset();
488-
}
489-
490404
std::string decompressValue(std::string compressedValue) {
491405
cb::compression::Buffer buffer;
492406
if (!cb::compression::inflate(cb::compression::Algorithm::Snappy,

include/memcached/limits.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,4 @@ constexpr std::size_t TotalBuckets = cb::ArenaMallocMaxClients;
2424
/// users in a document
2525
constexpr std::size_t PrivilegedBytes = 1024 * 1024;
2626

27-
/// The maximum length of a DCP connection
28-
constexpr std::size_t MaxDcpName = 200;
29-
3027
} // namespace cb::limits

tests/mcbp/mcbp_dcp_test.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ TEST_P(DcpOpenValidatorTest, Value) {
7272
EXPECT_EQ(cb::mcbp::Status::Einval, validate());
7373
}
7474

75-
TEST_P(DcpOpenValidatorTest, MB34280_NameTooLongKeylen) {
76-
auto blen = request.getBodylen() - request.getKeylen();
77-
request.setKeylen(201);
78-
request.setBodylen(blen + 201);
79-
EXPECT_EQ(cb::mcbp::Status::Einval, validate());
80-
}
81-
8275
TEST_P(DcpOpenValidatorTest, Pitr) {
8376
cb::mcbp::RequestBuilder builder({blob, sizeof(blob)}, true);
8477
using cb::mcbp::request::DcpOpenPayload;

0 commit comments

Comments
 (0)