forked from datahub-project/datahub
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
Cassandra more work #1
Merged
Merged
Conversation
This file contains 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
* Fix for datastax dao factory initialisation * Add readme for Cassandra quickstart
…o view not underlying table (datahub-project#3262)
matthewc-gr
approved these changes
Sep 21, 2021
alasdairm-gr
approved these changes
Sep 22, 2021
justinas-marozas
added a commit
that referenced
this pull request
Mar 9, 2022
[pull] master from G-Research:master
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Cassandra PR
This PR implements a new EntityService (DatastaxEntityService) and its associated DAO, aspect classes etc. in order to support Datastax's Cassandra for DataHub's document store component.
The implementation (Cassandra Datastax or Ebean SQL) can be set with the
DAO_SERVICE_LAYER
environment variable (e.g. in/docker/datahub-gms/env/docker.cassandra.env
). The other corresponding DB configs that can be set are:DATASTAX_DATASOURCE_USERNAME
(e.g.cassandra
)DATASTAX_DATASOURCE_PASSWORD
(e.g.cassandra
)DATASTAX_HOSTS
(e.g.localhost
)DATASTAX_PORT
(e.g.9042
)DATASTAX_DATACENTER
(e.g.datacenter1
)DATASTAX_KEYSPACE
(e.g.datahubpoc
)DATASTAX_USE_SSL
(e.g.false
)To test out locally, do a build and then run
./docker/dev-with-cassandra.sh
.Motivation
While evaluating DataHub for internal use, we identified that it was important for the query serving to be able to be horizontally scalable, as we've come up with scaling issues for one of our use cases relying on a traditional SQL store that DataHub would replace. Along with the requirement that the database should be highly available and with native support for multi DC replication, this led us to evaluate the use of Cassandra, a horizontally scalable database as part of our data catalog solution.
Technical Notes
Overview
DatastaxEntityServiceTest.java
)EbeanEntityService
and the other Ebean implementationsConditional Updates vs Transactions
Cassandra does not have ACID transactions; it does however have conditional updates which we make use of in
DatastaxAspectDao.batchSaveLatestAspect
andDatastaxAspectDao.condUpsertAspect
to avoid a potential race condition when ingesting new entities (see datahub-project#3231).SCSI Support
Since Cassandra does not support
JOIN
s, it would be difficult to implement SCSI without adding more columns into themetadata_aspect
table, although it's our understanding that if this feature is about to be dropped, this wouldn't be a long-term issue.Paging and Sorting
This mostly relates to the reimplementing of the
listLatestAspects
method. A new column in the DB has been added for the entity type (e.g.corpuser
), populated upon insertion. The alternative to this would be to use a SASI, although there are some sources suggesting that it won't be any more performant (https://www.scnsoft.com/blog/cassandra-performance).Furthermore, the sorting order (ascending by URN) feature has been dropped as it would have to be done in memory (since URN is used as the partition key), and this condition has been relaxed in
testListLatestAspects
.Cassandra's paging has been implemented using the OffsetPager; there does not seem to be a performant way of getting the total number of matches back (e.g. https://www.datastax.com/blog/running-count-expensive-cassandra). Our use case isn't heavily focused on the frontend so there hasn't been much effort expended in optimising this.
Anticipated Further Work
EntityService.ingestProposal
batchGet
methodlistLatestAspects
,listUrns
) use cases