-
Notifications
You must be signed in to change notification settings - Fork 50
Rename indices back to original during data refresh #415
Conversation
This one is easier since constraints don't have to be globally unique
I tried testing this locally but I can't get the tests to pass 🙁 It seems to be an issue with the tests not being able to hit the upstream db successfully:
Not sure how to resolve this 🤔 |
Hmm, that sounds really similar to #364 @sarayourfriend - do you happen to have a |
It looks like this is also having an issue I was seeing intermittently locally where the |
fwiw I'm experiencing the same hanging, |
I've identified the root cause and I'm addressing it now! |
Woohoo, this is finally ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good. Appreciate the improvements and cleanups for the integration tests.
@@ -67,6 +67,26 @@ def _fixup_env(conf: dict): | |||
conf["services"]["ingestion_server"]["env_file"] = ["env.integration"] | |||
|
|||
|
|||
def _remove_volumes(conf: dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very useful, thanks!
I am getting the same error as Sara and the content of my Auto-generated Docker Compose# This is an auto-generated Docker Compose configuration file.
# Do not modify this file directly. Your changes will be overwritten.
services:
integration_db:
env_file:
- /Users/krysal/Codes/openverse-api/postgres/env.docker
healthcheck:
test: pg_isready -U deploy -d openledger
image: postgres:13.2-alpine
ports:
- 65432:5432
volumes: []
integration_es:
environment:
- xpack.security.enabled=false
- discovery.type=single-node
healthcheck:
interval: 10s
retries: 10
test:
- CMD-SHELL
- curl -si -XGET 'localhost:9200/_cluster/health?pretty' | grep -qE 'yellow|green'
timeout: 60s
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
mem_limit: ${ES_MEM_LIMIT:-4294967296}
ports:
- 60200:9200
ulimits:
nofile:
hard: 65536
soft: 65536
volumes: []
integration_ingestion_server:
build: ../
command: bash -c 'sleep 20 && supervisord -c config/supervisord.conf'
depends_on:
- integration_db
- integration_es
env_file:
- env.integration
image: ingestion_server
ports:
- 60001:8001
stdin_open: true
tty: true
volumes:
- ../:/ingestion_server
integration_upstream_db:
env_file:
- /Users/krysal/Codes/openverse-api/postgres/env.docker
healthcheck:
test: pg_isready -U deploy -d openledger
image: postgres:13.2-alpine
ports:
- 65433:5432
volumes:
- ./mock_data:/mock_data
version: '2.4'
volumes: {} Edit: I spoke too fast, the problem was indeed the presence of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything seems to work correctly. Thanks for the detailed explanation and the order in the tests ⭐️
It would be a good idea to add a note for the .env
file with these tests somewhere (the README maybe?) so as not to forget it.
# Mock schemas | ||
|
||
Files in this directory were created using the following command: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it is good to know the origin and have the query at hand 👍
Co-authored-by: Krystle Salazar <[email protected]>
Fixes
Fixes #362 by @AetherUnbound
Description
This PR modifies the ingestion server so that it renames the indices of the target table back to the original during the go-live table swap. Previously this was not occurring, and so every subsequent run would add a
temp_import_
prefix to the target table (ultimately this would result in something liketemp_import_temp_import_temp_import_unique_url_idx
). The ingestion server now retains information about the original index names and uses them to rename the indices after the old target table has been removed. The integration tests will now also verify that the indices are unchanged after a data refresh.Indices must unique globally across a database, but constraints need not be. While no logic change is necessary, I've also added a constraint check during the integration test similar to the index check.
Since I added volumes in #408, we want to make sure that we remove them for integration testing (even though we're performing
docker-compose down -v
and removing volumes, better safe than sorry!). I've added that step to the integration test setup. The tests are ordered and they're kind of dependent on the previous test succeeding, so I've also added a fail-fast option for when pytest is run.I also simplified the integration tests since the
INGEST_UPSTREAM
tests between image/audio shared so much common logic.Lastly, I added logging of the go-live query before it's actually run. That way we can make debugging easier for ourselves on this next run 😄
Testing Instructions
just ing-testlocal
! It's been flaky sometimes for me so let me know if the first data refresh test times out.Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin