-
Notifications
You must be signed in to change notification settings - Fork 4
Speed up and simplify Solr data loading; fix /status for standalone #278
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
5c7a1a4
Add checked-in Solr configset and parallel data loader with doc-count…
gaurav bb59c41
Switch Solr to standalone mode and self-contained core backups
gaurav 625f8cc
Document the new data-loading process
gaurav c7f6221
Apply suggestion from @gaurav
gaurav 5ba1178
Fix /status when Solr runs in standalone mode
gaurav 6eb52a2
Harden the load guard: count deltas, bound the wait, survive odd file…
gaurav 6c7ffc0
Make the backup build restart-safe and stop gzipping on one core
gaurav cb32758
Keep the schema's single source of truth out of configoverlay.json
gaurav fb83dbb
Check the load guard and the backup roundtrip in CI
gaurav 4eec268
Track the Solr 9.10 line when serving, and refresh the restore docs
gaurav 5e86aac
Activated publishing NameRes Loading on PR for testing.
gaurav 12f49c0
Size the load to the CPUs we actually have, and stop over-sizing the …
gaurav 95b79ba
Resize the data-loading pod and document how to tune it
gaurav 1c82b3d
Keep each stamp file on the volume whose state it describes
gaurav 541a913
Put the loading index on a node-local NVMe ephemeral volume
gaurav c43ca90
Give the loading pod 32 CPUs and 128Gi
gaurav c4cad93
Raise ramBufferSizeMB to 2G for the parallel load
gaurav 4434391
Cache the data-loading image build
gaurav ad0aa98
Point the loading pod at the PR image until this is released
gaurav b21ad58
Document that the pipeline ships inside the image
gaurav 69095b5
Updated Babel version to 2026jul22.
gaurav 2ad61ca
Cut the configset down to what NameRes actually chose
gaurav a9387ac
Take Solr from the official image instead of downloading it
gaurav 0ead597
Fix two bugs that would have failed the load at step 2 and step 3
gaurav 56d361f
Go back to a persistent Solr volume until the namespace can do NVMe
gaurav 92a3a28
Address review: backup ownership, additive-load guard, and doc drift
gaurav c563ded
Removed on:pull_request trigger.
gaurav b17e04b
Correct index-size rationale for 600Gi Solr PVC
gaurav b6458cc
Updated NameRes Data Loading tag to latest.
gaurav 210ff54
Pin queryResultCache to CaffeineCache
gaurav 60c1847
Tolerate whitespace when extracting Solr's numFound
gaurav 6ddb07d
Trim image-fingerprint checks from the k8s loading README
gaurav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,83 +1,95 @@ | ||
| # This Makefile contains all the instructions necessary to | ||
| # download Babel synonym files from a web location, create | ||
| # and load them into a Solr dataset and generate a Solr backup | ||
| # that can be used to start a NameRes instance. | ||
| # download Babel synonym files from a web location, load them into a | ||
| # standalone Solr core (using the checked-in configset under | ||
| # configsets/name_lookup) and generate a self-contained Solr backup that can be | ||
| # used to start a NameRes instance. | ||
| # | ||
| # The backup is the whole Solr core -- config, schema AND index -- so restoring | ||
| # it is just "untar into the Solr home and start Solr" (see ../data-loading/README.md). | ||
|
|
||
| # Configuration | ||
| SYNONYMS_URL=https://stars.renci.org/var/babel_outputs/2025sep1/synonyms/ | ||
|
|
||
| # How much memory should Solr use. | ||
| SOLR_MEM=220G | ||
|
|
||
| # SOLR_DIR should be set up to point to the Solr data directory (usually /var/solr) | ||
| # and SOLR_EXEC should be set up to point to the Solr executable. | ||
| # These will both be set up by the Dockerfile. | ||
| # The checked-in configset used to create the core (contains conf/). | ||
| CONFIGSET=configsets/name_lookup | ||
|
|
||
| # The Solr core name. Do not change without also changing NameRes and the configset. | ||
| CORE=name_lookup | ||
|
|
||
| # Split any synonym file larger than SPLIT_SIZE into chunks of SPLIT_LINES lines. | ||
| # Splitting only helps parallelism, so we only bother with the big files; JSON is | ||
| # one document per line, so we must split on line boundaries, never on bytes. | ||
| SPLIT_SIZE=2G | ||
| SPLIT_LINES=10000000 | ||
|
|
||
| # SOLR_DIR should be set up to point to the Solr data directory (usually /var/solr, | ||
| # which is also the Solr home) and SOLR_EXEC should be set up to point to the Solr | ||
| # executable. These will both be set up by the Dockerfile. | ||
|
|
||
| # All and clean targets. | ||
|
|
||
| .PHONY: all clean | ||
| all: data/setup.done | ||
| echo Solr has now been set up and loaded with the synonym data. | ||
| echo Run 'make start-solr-backup' to start a backup. Run 'make check-solr-backup' to check | ||
| echo if the backup has completed. Once that has completed, run 'make data/backup.done' to | ||
| echo Run 'make data/backup.done' to optimize the index, shut down Solr and | ||
| echo generate a snapshot.backup.tar.gz file that can be used in NameRes. | ||
|
|
||
| clean: | ||
| rm -rf data/* | ||
| mkdir data | ||
|
|
||
| # This is a three step process. | ||
| # | ||
| # Step 1. Download an uncompress synonym files. | ||
| # Step 1. Download and uncompress synonym files, then split the large ones so the | ||
| # parallel loader has more units of work. | ||
| data/synonyms/done: | ||
| mkdir -p data/synonyms | ||
| wget -c -r -l1 -nd -P data/synonyms ${SYNONYMS_URL} | ||
| gunzip data/synonyms/*.txt.gz | ||
| echo Downloaded synonyms from ${SYNONYMS_URL} | ||
| # split -d -l 10000000 data/synonyms/SmallMolecule.txt data/synonyms/SmallMolecule.txt. && rm data/synonyms/SmallMolecule.txt | ||
| split -d -l 10000000 data/synonyms/DrugChemicalConflated.txt data/synonyms/DrugChemicalConflated.txt. && rm data/synonyms/DrugChemicalConflated.txt | ||
| split -d -l 10000000 data/synonyms/GeneProteinConflated.txt data/synonyms/GeneProteinConflated.txt. && rm data/synonyms/GeneProteinConflated.txt | ||
| echo Split DrugChemicalConflated.txt and GeneProteinConflated.txt, and deleted the original files. | ||
| find data/synonyms -maxdepth 1 -type f -name '*.txt' -size +${SPLIT_SIZE} -print | while read -r f; do \ | ||
| echo "Splitting large file $$f (larger than ${SPLIT_SIZE})..."; \ | ||
| split -d -l ${SPLIT_LINES} "$$f" "$$f." && rm "$$f"; \ | ||
| done | ||
|
gaurav marked this conversation as resolved.
Outdated
|
||
| touch $@ | ||
|
|
||
| # Step 3. Start Solr server. | ||
| # Step 2. Start the Solr server (standalone -- no ZooKeeper needed for one node). | ||
| # --user-managed keeps standalone mode explicit (Solr 10 will default to cloud). | ||
| data/solr.pid: | ||
| mkdir -p ${SOLR_DIR}/logs | ||
| ${SOLR_EXEC} -cloud -p 8983 -v -m ${SOLR_MEM} -s ${SOLR_DIR} >> ${SOLR_DIR}/logs/solr.txt 2>> ${SOLR_DIR}/logs/solr.err.txt | ||
| ${SOLR_EXEC} start -p 8983 --user-managed -v -m ${SOLR_MEM} -s ${SOLR_DIR} >> ${SOLR_DIR}/logs/solr.txt 2>> ${SOLR_DIR}/logs/solr.err.txt | ||
| while [ ! -s $@ ]; do \ | ||
| ${SOLR_EXEC} status | grep -Po 'Solr process \K([0-9]+)' > $@; \ | ||
| done | ||
| $(info Solr started with PID file at $@) | ||
| cat $@ | ||
|
|
||
| # Step 4. Load JSON files into Solr server. | ||
| data/setup.done: data/synonyms/done data/solr.pid | ||
| # Step 3. Create the core from the checked-in configset (schema lives there). | ||
| data/core.done: data/solr.pid | ||
| ${SOLR_EXEC} create -c ${CORE} -d ${CONFIGSET} | ||
| touch $@ | ||
|
gaurav marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Step 4. Load the synonym files into the core (parallel; with a doc-count guard). | ||
| data/setup.done: data/synonyms/done data/core.done | ||
| mkdir -p data/logs | ||
| bash setup-and-load-solr.sh "data/synonyms/*.txt*" >> data/logs/setup-and-load-solr.sh.log 2>> data/logs/setup-and-load-solr.sh.err.log && touch $@ | ||
|
|
||
| # Step 5. Start a Solr backup. | ||
| .PHONY: start-solr-backup | ||
| start-solr-backup: data/setup.done | ||
| curl 'http://localhost:8983/solr/name_lookup/replication?command=backup&name=backup' | ||
|
|
||
| # Step 6. Wait for the backup to complete. | ||
| .PHONY: check-solr-backup | ||
| check-solr-backup: | ||
| curl 'http://localhost:8983/solr/name_lookup/replication?command=details' | ||
|
|
||
| # Step 6. Shutdown the Solr instance. | ||
| ### data/stop-solr: | ||
| ### docker exec name_lookup solr stop -p 8983 -verbose | ||
|
|
||
| # Step 7. Generate the backup tarball. | ||
| data/backup.done: | ||
| mkdir -p data/var/solr/data | ||
| mv /var/solr/name_lookup_shard1_replica_n1/data/snapshot.backup data/var/solr/data | ||
| cd data && tar zcvf snapshot.backup.tar.gz var && touch backup.done | ||
| # Step 5. Optimize the index, shut down Solr, and tar the whole core into a | ||
| # self-contained backup. Extracting snapshot.backup.tar.gz into the Solr home | ||
| # yields a ready-to-serve name_lookup/ core -- no restore-time schema setup. | ||
| data/backup.done: data/setup.done | ||
| @echo "Optimizing the index before export (this can take a while on a large index)..." | ||
| curl -sf --show-error 'http://localhost:8983/solr/${CORE}/update?optimize=true' | ||
| # The optimize above commits, so the on-disk index is consistent. `solr stop` | ||
| # can exit non-zero under Docker even on a clean stop (SOLR-16463), so ignore it. | ||
| ${SOLR_EXEC} stop -p 8983 || true | ||
| rm -f data/solr.pid | ||
| tar -C ${SOLR_DIR} -czvf data/snapshot.backup.tar.gz ${CORE} | ||
| touch $@ | ||
|
|
||
| .PHONY: stop-solr | ||
| stop-solr: | ||
| rm data/solr.pid | ||
| ${SOLR_EXEC} stop | ||
| rm -f data/solr.pid | ||
| ${SOLR_EXEC} stop -p 8983 || true | ||
| $(info Solr stopped.) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.