Comments (5)
This can happen if you have two jobs running at the same time that both are trying to commit more than one row with the same primary key as each other. That is, if job 1 wants to write to PK 3, and job 2 wants to write to PK 3, that's fine. But if both want to write to PK 3 and PK 7, then they can potentially get in a deadlock if they do that out of order with respect to each other.
For example:
- job 1 writes to PK 3
- job 2 writes to PK 7
- job 1 tries to write to PK 7 and blocks
- job 2 tries to write to PK 3 and blocks
- deadlock
- one job experiences lock wait timeout
You can resolve this two ways:
- don't do that
- sort by primary key in your job before you call .saveToMemSQL
Doing option 2 results in a new sequence of events:
- job 1 writes to PK 3
- job 2 tries to write to PK 3 and blocks
- job 1 writes to PK 7
- job 1 finishes
- job 2 unblocks and writes to PK 3 and PK 7
from singlestore-spark-connector.
@rick-memsql any update on this issue. Looks like a basic problem of handling upserts (Combination of Insert/Update) which Cassandra supports by default.
from singlestore-spark-connector.
Thanks for your detailed explanation.
From the two ways that you suggested.
- Dont do that -> Not possible, we want to update the data, and we are just running batch jobs under DStream. There is no real control for programmer here.
- Sort by primary key -> Since there is no Direct stream APIs for the connectors. we have to go to RDD under DStream and then do this sorting. But in a streaming job this extra set of sorting will increase the time latency into processing. Sorting itself is a costly operation. If we look for sorting an RDD is a bit costly operation indeed.
from singlestore-spark-connector.
It only matters that the keys within one transaction are sorted. So if you can pull 10k keys at a time from the final stage of the job, save those, and repeat, that will work just as well. It will also dramatically reduce sorting time.
from singlestore-spark-connector.
Workaround above should work
from singlestore-spark-connector.
Related Issues (20)
- ALTER TABLE xxx RENAME TO issue with memsql spark connector HOT 2
- Question on merge functionality HOT 2
- load balancing for data ingestion is not working with multi aggregators HOT 3
- V3 is too slow as compared to V2 HOT 29
- control max number of concurrent connections on save HOT 2
- avro Date format exception HOT 3
- load data to memsql table from Hadoop (HDFS) ORC files HOT 2
- support for spark 3.0.x.. HOT 1
- issue with number of partitions when we use spark.read HOT 8
- selective pushdown HOT 4
- SingleStore DB support Array<struct> column types ? HOT 2
- Is it possible to consume singleStore as streaming datasource HOT 1
- memsql connector supports keytab and principal for kerb authn
- Typo SingleStore
- supported features for singlestore-spark-connector_2.11.... HOT 1
- support partial column list when using .write() HOT 2
- Performance issue HOT 5
- Reading using SSL fails on multi-node clusters HOT 6
- Parallel Read from Aggregators not working in Aws Glue HOT 17
- Queries not finishing when partition count on db increased. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from singlestore-spark-connector.