我在Cassandra有以下模型:
from threading import Lock
global_lock = Lock()
def function1():
child_process = Process(target=function2)
child_process.daemon = True
child_process.start()
with global_lock:
# Lock acquired
print('function1')
# Lock released
def function2():
with global_lock:
# Lock acquired
print('function2')
# Lock released
function1()
这里描述:
CREATE TABLE segment (
organizationid varchar,
segmentid int,
lengthmm int,
optimal_speed int,
speed_limit int,
wkt varchar,
road_class int,
PRIMARY KEY (organizationid, segmentid)
);
当我运行以下查询时:
CREATE TABLE tkm_fcd_cassandra.segment (
organizationid text,
segmentid int,
lengthmm int,
optimal_speed int,
road_class int,
speed_limit int,
wkt text,
PRIMARY KEY (organizationid, segmentid)
) WITH CLUSTERING ORDER BY (segmentid ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
它给了我以下结果:
select * from segment;
但是当我运行以下查询时:
organizationid | segmentid | lengthmm | optimal_speed | road_class | speed_limit | wkt
----------------------------+-----------+----------+---------------+------------+-------------+---------------------------------------------------------
'57ecdd14766299a02213c463' | 122406 | 49239 | 20 | 5 | 90 | 'LINESTRING (32.813454 39.918419,32.813469 39.917976)'
'57ecdd14766299a02213c463' | 122407 | 49239 | 20 | 5 | 90 | 'LINESTRING (32.813469 39.917976,32.813501 39.917533)'
'57ecdd14766299a02213c463' | 122408 | 49239 | 20 | 5 | 90 | 'LINESTRING (32.813501 39.917533,32.813532 39.917091)'
'57ecdd14766299a02213c463' | 122409 | 49239 | 20 | 5 | 90 | 'LINESTRING (32.813532 39.917091,32.813542 39.91665)'
'57ecdd14766299a02213c463' | 122410 | 49239 | 20 | 5 | 90 | 'LINESTRING (32.813542 39.91665,32.813112 39.916359)'
我有以下结果:
select * from segment where organizationid = '57ecdd14766299a02213c463';
这是我的nodetool状态:
organizationid | segmentid | lengthmm | optimal_speed | road_class | speed_limit | wkt
----------------+-----------+----------+---------------+------------+-------------+-----
(0 rows)
其他信息:
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 192.168.1.101 5.16 MiB 256 100.0% 249c522d-ead0-4370-ac1b-4ad446d4948b rack1
我无法理解为什么当我运行[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4]
条款时Cassandra会给我空结果?
答案 0 :(得分:5)
我看起来你已经在他们周围插入了引号。请尝试以下方法:
select * from segment where organizationid = '\'57ecdd14766299a02213c463\'';
通常输出不会在文本值周围显示'
。