Cassandra的表是否可以配置

huangapple go评论49阅读模式
英文:

cassandra Whether tables can be configured

问题

I want to configure a table in Cassandra like this:

创建一个名为users的表(table):
user_id 字段为 varchar 类型,作为主键(PRIMARY KEY)。
first 字段为 varchar 类型。
last 字段为 varchar 类型。
age 字段为 int 类型。
带有 syncEs=true 的属性。

So I modified the source code to add a syncEs property.

Although it has been stored in tables under system_schema.

But on a 3-node cluster, we still don't get the correct values.

There's only one node that gets the correct value,

Hard to understand the source code of friends, tell me why?

英文:

I want to configure a table in cassandra like this:

CREATE TABLE users (
                 user_id varchar PRIMARY KEY,
                 first varchar,
                 last varchar,
                 age int
               ) WITH syncEs=true;

So I modified the source code to add a syncEs property.

Although it has been stored in tables under system_schema.

But on a 3-node cluster, we still don't get the correct values.

There's only one node that gets the correct value,

Hard to understand the source code of friends, tell me why?

答案1

得分: 1

My guess is that there must be some other place in the code that determines the list of table properties to replicate.

A better solution here might be to make use of the table properties that already exist. For instance, the comment property goes largely unused.

CREATE TABLE users (
user_id varchar PRIMARY KEY,
first varchar,
last varchar,
age int
) WITH comment='syncEs=true';

This works, and you can modify/read this property in the same way that you would any other table property. And this one will replicate.

Otherwise, if you're modifying the source of Cassandra to support custom table properties, you're going to be largely on your own.

英文:

My guess is that there must be some other place in the code that determines the list of table properties to replicate.

A better solution here might be to make use of the table properties that already exist. For instance, the comment property goes largely unused.

CREATE TABLE users (
    user_id varchar PRIMARY KEY,
    first varchar,
    last varchar,
    age int
) WITH comment='syncEs=true';

This works, and you can modify/read this property in the same way that you would any other table property. And this one will replicate.

Otherwise, if you're modifying the source of Cassandra to support custom table properties, you're going to be largely on your own.

huangapple
  • 本文由 发表于 2023年5月13日 13:19:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76241198.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定