2017-06-27 4 views
0

時間とboolフラグを更新するクエリを実行していますが、まったく動作しません。私はこの問題や対処方法を知らない。私はデバッガで何時間も過ごしていますが、うまくいかないことがわかります。Pythonのboolフィールドで奇妙なCassandra 3.9の動作が更新されない

問合せ:

update task 
set start_time = toTimestamp(now()), started = true 
where id = d6283a7e-5b5c-11e7-98da-00059a3c7a00; 

フィールドstartedは時々TrueまたはFalseではありません - しかし、多くの場合、False - ないアイデアなぜですか?

全コード:

@classmethod 
    def _db_start_task(cls, task_id, parent_task_id, farm_settings): 
     assert isinstance(task_id, uuid.UUID) 
     assert isinstance(farm_settings, FarmSettings) 

     logger = logging.getLogger(__name__) 
     session = cls._get_session(farm_settings) 
     query_string = '''\ 
update task 
set start_time = toTimestamp(now()), started = true 
where id = %(task_id)s;''' % { 
'task_id': task_id 
} 
     logger.debug('Query string is: %s.' % query_string) 
     update = SimpleStatement(query_string=query_string, 
           consistency_level=ConsistencyLevel.QUORUM, 
           serial_consistency_level=ConsistencyLevel.SERIAL) 
     warnings.warn('Statement execution problems is not handled.', UserWarning) 
     update_result = session.execute(update, trace=True) 

     warnings.warn('Debug code to remove start.', UserWarning) 
     select = SimpleStatement(query_string='select start_time, started from task where id = %(task_id)s' 
           % { 'task_id': task_id }, 
           consistency_level=ConsistencyLevel.QUORUM, 
           serial_consistency_level=ConsistencyLevel.SERIAL) 
     result_set = session.execute(select) 
     if result_set[0].started == False: 
      logger.critical('Undefined behavior.') 
     warnings.warn('Debug code to remove end.', UserWarning) 

     if parent_task_id is not None: 
      cls._db_count_started_children_tasks(parent_task_id, farm_settings) 

答えて

1

それらの整合性の設定で予期しない動作です。

利用できないエラーが発生し、クラスタがDowngradingConsistencyRetryPolicyなどのものを使用して設定されている可能性があります。

+0

これを確認する必要があります。 – Chameleon