@@ -217,6 +217,15 @@ class KeywordCommandBase : public Commander {
217217};
218218
219219class CommandTSCreateBase : public KeywordCommandBase {
220+ public:
221+ Status Execute ([[maybe_unused]] engine::Context &ctx, Server *srv, [[maybe_unused]] Connection *conn,
222+ [[maybe_unused]] std::string *output) override {
223+ if (srv->GetConfig ()->cluster_enabled && getCreateOption ().labels .size ()) {
224+ return {Status::RedisExecErr, " Specifying LABELS is not supported in cluster mode" };
225+ }
226+ return Status::OK ();
227+ }
228+
220229 protected:
221230 const TSCreateOption &getCreateOption () const { return create_option_; }
222231
@@ -308,6 +317,9 @@ class CommandTSCreate : public CommandTSCreateBase {
308317 return CommandTSCreateBase::Parse (args);
309318 }
310319 Status Execute (engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
320+ auto sc = CommandTSCreateBase::Execute (ctx, srv, conn, output);
321+ if (!sc.IsOK ()) return sc;
322+
311323 auto timeseries_db = TimeSeries (srv->storage , conn->GetNamespace ());
312324 auto s = timeseries_db.Create (ctx, args_[1 ], getCreateOption ());
313325 if (!s.ok () && s.IsInvalidArgument ()) return {Status::RedisExecErr, errKeyAlreadyExists};
@@ -387,6 +399,9 @@ class CommandTSAdd : public CommandTSCreateBase {
387399 return CommandTSCreateBase::Parse (args);
388400 }
389401 Status Execute (engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
402+ auto sc = CommandTSCreateBase::Execute (ctx, srv, conn, output);
403+ if (!sc.IsOK ()) return sc;
404+
390405 auto timeseries_db = TimeSeries (srv->storage , conn->GetNamespace ());
391406 const auto &option = getCreateOption ();
392407
@@ -851,6 +866,9 @@ class CommandTSMGet : public CommandTSMGetBase {
851866 return CommandTSMGetBase::Parse (args);
852867 }
853868 Status Execute (engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
869+ if (srv->GetConfig ()->cluster_enabled ) {
870+ return {Status::RedisExecErr, " TS.MGet is not supported in cluster mode" };
871+ }
854872 auto timeseries_db = TimeSeries (srv->storage , conn->GetNamespace ());
855873 std::vector<TSMGetResult> results;
856874 auto s = timeseries_db.MGet (ctx, getMGetOption (), is_return_latest_, &results);
@@ -898,6 +916,9 @@ class CommandTSMRange : public CommandTSRangeBase, public CommandTSMGetBase {
898916 return Status::OK ();
899917 }
900918 Status Execute (engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
919+ if (srv->GetConfig ()->cluster_enabled ) {
920+ return {Status::RedisExecErr, " TS.MRANGE is not supported in cluster mode" };
921+ }
901922 auto timeseries_db = TimeSeries (srv->storage , conn->GetNamespace ());
902923 std::vector<TSMRangeResult> results;
903924 auto s = timeseries_db.MRange (ctx, option_, &results);
@@ -995,6 +1016,9 @@ class CommandTSIncrByDecrBy : public CommandTSCreateBase {
9951016 return CommandTSCreateBase::Parse (args);
9961017 }
9971018 Status Execute (engine::Context &ctx, Server *srv, Connection *conn, std::string *output) override {
1019+ auto sc = CommandTSCreateBase::Execute (ctx, srv, conn, output);
1020+ if (!sc.IsOK ()) return sc;
1021+
9981022 auto timeseries_db = TimeSeries (srv->storage , conn->GetNamespace ());
9991023 const auto &option = getCreateOption ();
10001024
0 commit comments