英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论