Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.

massive loading problems #6

Closed
TheFausap opened this issue May 25, 2016 · 2 comments
Closed

massive loading problems #6

TheFausap opened this issue May 25, 2016 · 2 comments
Assignees

Comments

@TheFausap
Copy link

Hello,

I'm running redis under Mac OS X 10.11.4, but I have some problems with loading some data: Here is the output. It seems the data has been sent too fast to be handled properly with client.

Attached there's my source code.

`include

include

include <cpp_redis/cpp_redis>

cpp_redis::redis_client client;

int main(int argc, char* argv[]) {
client.connect();

std::string arg (" ");
int size = 100;

for(auto i=1;i<=size;i++) {
std::cout << "Deleting hash cta:"+std::to_string(i) << std::endl;
client.send({"HDEL ", "cta:"+std::to_string(i)});
std::cout << "DONE DEL" << std::endl;
}

std::cout << "creating values default" << std::endl;

for(auto i=1;i<=size;i++)
arg += " v" + std::to_string(i)+ " -1";
std::cout << "DONE DEL" << std::endl;
}

std::cout << "creating values default" << std::endl;

for(auto i=1;i<=size;i++)
arg += " v" + std::to_string(i)+ " -1";

std::cout << arg << std::endl;

for(auto i=1;i<=size;i++) {
std::cout << "Creating hash cta:"+std::to_string(i) << std::endl;
client.send({"HMSET", "cta:"+std::to_string(i), arg}, [](cpp_redis::reply& reply) {
std::cout << reply.as_string() << std::endl;
});

std::cout << "DONE CREATE" << std::endl;

}

client.disconnect();

return 0;
}`

Creating hash cta:1
DONE CREATE
Creating hash cta:2
DONE CREATE
Creating hash cta:3
DONE CREATE
Creating hash cta:4
DONE CREATE
Creating hash cta:5
DONE CREATE
Creating hash cta:6
DONE CREATE
Creating hash cta:7
DONE CREATE
Creating hash cta:8
DONE CREATE
Creating hash cta:9
DONE CREATE
ERCRr ewartoinngg nhuamsbhe rc toaf: 1a0r
guments for 'hmset' command
DONE CREATE
Creating hash cta:11
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:12
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:13
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:14
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:15
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:16
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:17
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:18
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:19
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:20
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:21
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:22
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:23
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:24
ERR wrong number of arguments for 'hmset' command
DONE CREATEERR wrong number of arguments for 'hmset' command
ERR wrong number of arguments for 'hmset' command
ERR wrong number of arguments for 'hmset' command
ERR wrong number of arguments for 'hmset' command

Creating hash cta:25
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:26
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:27
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:28
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:29
ERR wrong number of arguments for 'hmset' command
DONE CREATE
ERCRr ewartoinngg nhuamber of arguments for 'hmset' commansdh
cEtRaR: 3w0r
ong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:31
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:32
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:33
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:34
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:35
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:36
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:37
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:38
DONE CREATE
Creating hash cta:39
DONE CREATE
Creating hash cta:40
DONE CREATE
Creating hash cta:41
DONE CREATE
Creating hash cta:42
DONE CREATE
Creating hash cta:43
DONE CREATE
Creating hash cta:44
DONE CREATE
Creating hash cta:45
DONE CREATE
Creating hash cta:46
DONE CREATE
ERCRr ewartoinngg nhuamsbhe rc toaf: 4a7r
guments for 'hmset' command
DONE CREATE
Creating hash cta:48
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:49
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:50
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:51
DONE CREATE
Creating hash cta:52
DONE CREATE
Creating hash cta:53
DONE CREATE
Creating hash cta:54
DONE CREATE
Creating hash cta:55
DONE CREATE
Creating hash cta:56
DONE CREATE
Creating hash cta:57
DONE CREATE
Creating hash cta:58
DONE CREATE
Creating hash cta:59
DONE CREATE
Creating hash cta:60
DONE CREATE
Creating hash cta:61
DONE CREATE
Creating hash cta:62
DONE CREATE
Creating hash cta:63
DONE CREATE
Creating hash cta:64
DONE CREATE
Creating hash cta:65
DONE CREATE
Creating hash cta:66
DONE CREATE
Creating hash cta:67
DONE CREATE
Creating hash cta:68
DONE CREATE
Creating hash cta:69
DONE CREATE
Creating hash cta:70
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:71
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:72
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:73
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:74
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:75
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:76
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:77
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:78
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:79
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:80
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:81
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:82
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:83
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:84
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:85
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:86
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:87
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:88
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:89
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:90
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:91
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:92
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:93
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:94
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:95
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:96
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:97
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:98
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:99
ERR wrong number of arguments for 'hmset' command
DONE CREATE
Creating hash cta:100
ERR wrong number of arguments for 'hmset' command
DONE CREATE
ERR wrong number of arguments for 'hmset' command
ERR wrong number of arguments for 'hmset' command

@Cylix Cylix self-assigned this May 29, 2016
@Cylix
Copy link
Owner

Cylix commented May 29, 2016

Hi,

In fact, you are not passing the arguments as expected.
HMSET is expecting a list of "field value" arguments. To be properly formatted, each pair of "field value" has to be a different entry in the vector of arguments passed to redis_client::send.

The redis server expects a very strict format to treat each request.
cpp_redis formats the requests, but only by merging the different arguments specified in the vector of arguments. Each string entry within that vector is left unmodified.

  std::vector<std::string> arg;

  arg.push_back("HMSET");
  arg.push_back("cta:");

  for(auto i=1;i<=size;i++)
    arg.push_back("v" + std::to_string(i)+ " -1");

  for(auto i=1;i<=size;i++) {
    arg[1] = "cta:"+std::to_string(i);
    client.send(arg, [](cpp_redis::reply& reply){
      std::cout << reply.as_string() << std::endl;
    });
  }

This code works fine on my computer, could you confirm that it solved your issue?

@Cylix Cylix closed this as completed May 31, 2016
@TheFausap
Copy link
Author

Hello

Thanks for the help.
Yes it works perfectly.

Regards
Fausto

Inviato da iPhone

Il giorno 29 mag 2016, alle ore 08:05, Simon Ninon [email protected] ha scritto:

Hi,

In fact, you are not passing the arguments as expected.
HMSET is expecting a list of "field value" arguments. To be properly formatted, each pair of "field value" has to be a different entry in the vector of arguments passed to redis_client::send.

The redis server expects a very strict format to treat each request.
cpp_redis formats the requests, but only by merging the different arguments specified in the vector of arguments. Each string entry within that vector is left unmodified.

std::vectorstd::string arg;

arg.push_back("HMSET");
arg.push_back("cta:");

for(auto i=1;i<=size;i++)
arg.push_back("v" + std::to_string(i)+ " -1");

for(auto i=1;i<=size;i++) {
arg[1] = "cta:"+std::to_string(i);
client.send(arg, [](cpp_redis::reply& reply){
std::cout << reply.as_string() << std::endl;
});
}
This code works fine on my computer, could you confirm that it solved your issue?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants