Skip to content

Commit ac0da7c

Browse files
committed
MB-51513: Merge branch 'couchbase/cheshire-cat' into 'couchbase/neo'
* couchbase/cheshire-cat: MB-51513: Revert "MB-34280: Set max DCP name to 200 characters" Change-Id: Id1b62383dc04168046510aa7a5f2dace4e98011d
2 parents 5cbcd28 + cc160cb commit ac0da7c

File tree

6 files changed

+1
-120
lines changed

6 files changed

+1
-120
lines changed

daemon/mcbp_validators.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,6 @@ static Status dcp_open_validator(Cookie& cookie) {
573573
"consumer_name must be a string");
574574
return Status::Einval;
575575
}
576-
auto nm = kv.value().get<std::string>();
577-
if (nm.size() > cb::limits::MaxDcpName) {
578-
cookie.setErrorContext(
579-
"consumer_name limit is " +
580-
std::to_string(cb::limits::MaxDcpName) +
581-
" characters");
582-
return Status::Einval;
583-
}
584576
} else {
585577
cookie.setErrorContext("Unsupported JSON property " +
586578
kv.key());
@@ -592,14 +584,6 @@ static Status dcp_open_validator(Cookie& cookie) {
592584
return Status::Einval;
593585
}
594586
}
595-
596-
if (size_t(cookie.getHeader().getKeylen()) > cb::limits::MaxDcpName) {
597-
cookie.setErrorContext("Dcp name limit is " +
598-
std::to_string(cb::limits::MaxDcpName) +
599-
" characters");
600-
return Status::Einval;
601-
}
602-
603587
return verify_common_dcp_restrictions(cookie);
604588
}
605589

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
@@ -81,9 +81,6 @@ struct ConnCounter {
8181

8282
class ConnHandler : public DcpConnHandlerIface {
8383
public:
84-
/// The maximum length of a DCP stat name
85-
static constexpr size_t MaxDcpStatNameLength = 47;
86-
8784
enum class PausedReason : uint8_t {
8885
BufferLogFull,
8986
Initializing,

engines/ep/tests/module_tests/dcp_test.cc

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -396,91 +396,6 @@ TEST_F(DCPTest, MB30189_addStats) {
396396
nullptr);
397397
}
398398

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