I want to design a system for user point. The main two points of this system are point and log.
I want to use Cassandra to store the data. Two reason:
The basic data sturcture:
// row
name: user_id,
values: {
point: {
name: point,
values: 1000
},
log: {
name: log,
values: {
log_timestamp: {
name: timestamp,
values: xxxx
},
log_timestamp: {
name: timestamp,
values: xxxx
},
log_timestamp: {
name: timestamp,
values: xxxx
},
……
}
}
}
My question is:
Is there any problem if the log is too many enough?
@lifei
What you want is somehow a table with:
It is indeed very easy to create a table like this:
CREATE TABLE logs
(
userId: int,
log_timestamp long, //timestamp
value text,
PRIMARY KEY (userId,log_timestamp)
);
It is a clustered entity (wide row) with a maximum of 2 billions of log_timestamp/value couples.
For the point counter, unfortunately you have to create another column family to store it because Cassandra does not allow mixing counter value with other types.