Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release 2022.3.3: added scripts/drop_compound_index.py #163

Merged
merged 7 commits into from
Sep 25, 2023

Conversation

viniarck
Copy link
Member

@viniarck viniarck commented Aug 7, 2023

Summary

Backported from PR #162

Local Tests

Upgraded from 2022.3.1 to 2022.3.3:


rs0 [direct: primary] napps> db.flows.getIndexes()
[
  { v: 2, key: { _id: 1 }, name: '_id_' },
  {
    v: 2,
    key: { flow_id: 1 },
    name: 'flow_id_1',
    background: true,
    unique: true
  },
  {
    v: 2,
    key: { 'flow.cookie': 1 },
    name: 'flow.cookie_1',
    background: true
  },
  { v: 2, key: { state: 1 }, name: 'state_1', background: true },
  {
    v: 2,
    key: {
      switch: 1,
      'flow.cookie': 1,
      state: 1,
      inserted_at: 1,
      updated_at: 1
    },
    name: 'switch_1_flow.cookie_1_state_1_inserted_at_1_updated_at_1',
    background: true
  }
]
rs0 [direct: primary] napps> db.flows.countDocuments()
1003

  • Ran the script, and confirmed the index deletion:
❯ CMD=drop_index python3 drop_compound_index.py
None
rs0 [direct: primary] napps> db.flows.getIndexes()
[
  { v: 2, key: { _id: 1 }, name: '_id_' },
  {
    v: 2,
    key: { flow_id: 1 },
    name: 'flow_id_1',
    background: true,
    unique: true
  },
  {
    v: 2,
    key: { 'flow.cookie': 1 },
    name: 'flow.cookie_1',
    background: true
  },
  { v: 2, key: { state: 1 }, name: 'state_1', background: true }
]
rs0 [direct: primary] napps> 
  • After that, started kytosd again, and the new priority indexes were created as expected:
2023-08-07 13:14:40,734 - INFO [kytos.napps.kytos/flow_manager] (MainThread) Created DB index [('flow.priority', -1)], collection: flows)
2023-08-07 13:14:40,788 - INFO [kytos.napps.kytos/flow_manager] (MainThread) Created DB index [('switch', 1), ('flow.cookie', 1), ('state', 1), ('flow.priority', -1), ('inserted_at', 1
), ('updated_at', 1)], collection: flows)
rs0 [direct: primary] napps> db.flows.getIndexes()
[
  { v: 2, key: { _id: 1 }, name: '_id_' },
  {
    v: 2,
    key: { flow_id: 1 },
    name: 'flow_id_1',
    background: true,
    unique: true
  },
  {
    v: 2,
    key: { 'flow.cookie': 1 },
    name: 'flow.cookie_1',
    background: true
  },
  { v: 2, key: { state: 1 }, name: 'state_1', background: true },
  {
    v: 2,
    key: { 'flow.priority': -1 },
    name: 'flow.priority_-1',
    background: true
  },
  {
    v: 2,
    key: {
      switch: 1,
      'flow.cookie': 1,
      state: 1,
      'flow.priority': -1,
      inserted_at: 1,
      updated_at: 1
    },
    name: 'switch_1_flow.cookie_1_state_1_flow.priority_-1_inserted_at_1_updated_at_1',
    background: true
  }
]
rs0 [direct: primary] napps> db.flows.countDocuments()
1003

Heads up

If you tried to upgrade to 2022.3.2 before and it ended up creating 'flow.priority_1' index, then you also want to delete it by running:

CMD=drop_index INDEX_NAME=flow.priority_1 python3 drop_compound_index.py

End-to-End Tests

A few tests failed, but they are related to kytos-ng/kytos-end-to-end-tests#255:

============================= test session starts ==============================
platform linux -- Python 3.9.2, pytest-7.2.0, pluggy-1.2.0
rootdir: /builds/amlight/kytos-end-to-end-tester/kytos-end-to-end-tests
plugins: rerunfailures-10.2, timeout-2.1.0, anyio-3.6.2
collected 239 items
tests/test_e2e_01_kytos_startup.py ..                                    [  0%]
tests/test_e2e_05_topology.py ..................                         [  8%]
tests/test_e2e_10_mef_eline.py ..........ss.....x.....x................  [ 25%]
tests/test_e2e_11_mef_eline.py ......                                    [ 27%]
tests/test_e2e_12_mef_eline.py .....Xx.                                  [ 30%]
tests/test_e2e_13_mef_eline.py .....xs.s......xs.s.XXxX.xxxx..X......... [ 48%]
...                                                                      [ 49%]
tests/test_e2e_14_mef_eline.py x                                         [ 49%]
tests/test_e2e_15_mef_eline.py ..                                        [ 50%]
tests/test_e2e_20_flow_manager.py .....................                  [ 59%]
tests/test_e2e_21_flow_manager.py ...                                    [ 60%]
tests/test_e2e_22_flow_manager.py ...............                        [ 66%]
tests/test_e2e_23_flow_manager.py ..............                         [ 72%]
tests/test_e2e_30_of_lldp.py ....                                        [ 74%]
tests/test_e2e_31_of_lldp.py ...                                         [ 75%]
tests/test_e2e_32_of_lldp.py ...                                         [ 76%]
tests/test_e2e_40_sdntrace.py ..RRFRRFRRF......                          [ 81%]
tests/test_e2e_41_kytos_auth.py ........                                 [ 84%]
tests/test_e2e_50_maintenance.py ........................                [ 94%]
tests/test_e2e_60_of_multi_table.py .....                                [ 97%]
tests/test_e2e_70_kytos_stats.py .......                                 [100%]
=================================== FAILURES ===================================
RERUN tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_020_run_sdntrace_fail_missing_flow
RERUN tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_020_run_sdntrace_fail_missing_flow
RERUN tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_030_run_sdntrace_for_stored_flows
RERUN tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_030_run_sdntrace_for_stored_flows
RERUN tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_040_run_sdntrace_no_action
RERUN tests/test_e2e_40_sdntrace.py::TestE2ESDNTrace::test_040_run_sdntrace_no_action

@viniarck viniarck requested a review from italovalcy August 7, 2023 16:28
@viniarck viniarck requested a review from a team as a code owner August 7, 2023 16:28
Copy link

@italovalcy italovalcy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great solution @viniarck and sorry for the long delay to review it, but now we have more evidences about the root cause of the original problem (Issue kytos#413)

@viniarck viniarck merged commit 3baff09 into base/2022.3.3 Sep 25, 2023
@viniarck viniarck deleted the chore/db_index_script_2022.3.3 branch September 25, 2023 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants