示例#1
0
def check_pillows_for_rewind():
    for pillow in get_couch_pillow_instances():
        checkpoint = pillow.checkpoint
        has_rewound, historical_seq = check_for_rewind(checkpoint)
        if has_rewound:
            notify_error(
                message='Found seq number lower than previous for {}. '
                        'This could mean we are in a rewind state'.format(checkpoint.checkpoint_id),
                details={
                    'pillow checkpoint seq': checkpoint.get_current_sequence_id(),
                    'stored seq': historical_seq
                }
            )
示例#2
0
def check_pillows_for_rewind():
    for pillow in get_couch_pillow_instances():
        checkpoint = pillow.checkpoint
        has_rewound, historical_seq = check_for_rewind(checkpoint)
        if has_rewound:
            notify_error(
                message='Found seq number lower than previous for {}. '
                        'This could mean we are in a rewind state'.format(checkpoint.checkpoint_id),
                details={
                    'pillow checkpoint seq': checkpoint.get_current_sequence_id(),
                    'stored seq': historical_seq
                }
            )
示例#3
0
def pillow_seq_store():
    for pillow in get_couch_pillow_instances():
        checkpoint = pillow.checkpoint
        store, created = PillowCheckpointSeqStore.objects.get_or_create(checkpoint_id=checkpoint.checkpoint_id)
        db_seq = checkpoint.get_current_sequence_id()
        store_seq = force_seq_int(store.seq) or 0
        if not created and force_seq_int(db_seq) < store_seq - EPSILON:
            notify_exception(
                None,
                message="Found seq number lower than previous for {}. "
                "This could mean we are in a rewind state".format(store.checkpoint_id),
                details={"pillow checkpoint seq": db_seq, "stored seq": store.seq},
            )
        else:
            store.seq = db_seq
            store.save()
示例#4
0
def pillow_seq_store():
    for pillow in get_couch_pillow_instances():
        checkpoint = pillow.checkpoint
        store, created = PillowCheckpointSeqStore.objects.get_or_create(
            checkpoint_id=checkpoint.checkpoint_id)
        db_seq = checkpoint.get_current_sequence_id()
        store_seq = force_seq_int(store.seq) or 0
        if not created and force_seq_int(db_seq) < store_seq - EPSILON:
            notify_exception(
                None,
                message='Found seq number lower than previous for {}. '
                'This could mean we are in a rewind state'.format(
                    store.checkpoint_id),
                details={
                    'pillow checkpoint seq': db_seq,
                    'stored seq': store.seq
                })
        else:
            store.seq = db_seq
            store.save()