File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
model-client/src/commonMain/kotlin/org/modelix/model/client2 Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,13 @@ class ModelClientV2(
253
253
254
254
private suspend fun uploadObjects (repository : RepositoryId , objects : Sequence <Pair <String , String >>) {
255
255
LOG .debug { " ${clientId.toString(16 )} .pushObjects($repository )" }
256
- objects.chunked(100_000 ).forEach { chunk ->
256
+ objects.chunked(100_000 ).forEach { unsortedChunk ->
257
+ // Entries are sorted to avoid deadlocks on the server side between transactions.
258
+ // Since ignite locks individual entries, this is equivalent to a lock ordering.
259
+ // This is also fixed on the server side, but there might an old version of the server running that doesn't
260
+ // contain this fix. This client-side sorting could be removed in a future version when all servers
261
+ // are upgraded.
262
+ val chunk = unsortedChunk.sortedBy { it.first }
257
263
httpClient.put {
258
264
url {
259
265
takeFrom(baseUrl)
You can’t perform that action at this time.
0 commit comments