GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 0e64ffad authored by juga  's avatar juga 💬

chg: scanner: Stop storing recent_measurement_attempt

because it stores a timestamp for each attempt, which makes state.dat
grow thousand of lines (json).

Closes #40023
parent c8d1cc4f
Pipeline #1784 passed with stage
in 45 minutes and 53 seconds
......@@ -523,7 +523,8 @@ def main_loop(args, conf, controller, relay_list, circuit_builder, result_dump,
# Don't start measuring a relay if sbws is stopping.
if settings.end_event.is_set():
break
relay_list.increment_recent_measurement_attempt()
# 40023, disable to decrease state.dat json lines
# relay_list.increment_recent_measurement_attempt()
target.increment_relay_recent_measurement_attempt()
num_relays += 1
# callback and callback_err must be non-blocking
......
......@@ -32,7 +32,9 @@ def test_state(conf):
assert 1 == state.count("recent_consensus")
assert 1 == state.count("recent_priority_list")
assert 15 == state.count("recent_priority_relay")
assert 15 == state.count("recent_measurement_attempt")
# Because of 40023, it's 0. Change to 15 if we store it again at some point
# assert 15 == state.count("recent_measurement_attempt")
assert not state.count("recent_measurement_attempt")
def test_v3bwfile(conf):
......@@ -42,7 +44,8 @@ def test_v3bwfile(conf):
assert "1" == bwfile.header.recent_consensus_count
assert "1" == bwfile.header.recent_priority_list_count
assert "15" == bwfile.header.recent_priority_relay_count
assert "15" == bwfile.header.recent_measurement_attempt_count
# Because of 40023, there is not this header
# assert "15" == bwfile.header.recent_measurement_attempt_count
for bwline in bwfile.bw_lines:
assert 1 == bwline.relay_in_recent_consensus_count
assert 1 == bwline.relay_recent_priority_list_count
......
"""Unit tests for heartbeat"""
import logging
import pytest
from sbws.lib import heartbeat
from sbws.util.state import State
@pytest.mark.skip(reason="increment_recent_measurement_attempt() disabled")
def test_total_measured_percent(conf, caplog):
state = State(conf["paths"]["state_fname"])
state["recent_priority_list"] = [1, 2, 3]
......
......@@ -4,6 +4,7 @@ import json
import logging
import math
import os.path
import pytest
from unittest import mock
from sbws import __version__ as version
......@@ -588,6 +589,7 @@ def test_recent_consensus_count(root_data_path, datadir):
assert "1" == header.recent_consensus_count
@pytest.mark.skip(reason="increment_recent_measurement_attempt() disabled")
def test_recent_measurement_attempt_count(root_data_path, datadir):
state_fpath = os.path.join(root_data_path, '.sbws/state.dat')
assert 15 == V3BWHeader.recent_measurement_attempt_count_from_file(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment