Skip to content

Commit 6c150ac

Browse files
Alex Seatonpoodlewars
Alex Seaton
authored andcommitted
Release the GIL during parallel writes to avoid deadlock
1 parent 7b4bfd1 commit 6c150ac

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

cpp/arcticdb/version/local_versioned_engine.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ void LocalVersionedEngine::write_parallel_frame(
10201020
bool validate_index,
10211021
bool sort_on_index,
10221022
const std::optional<std::vector<std::string>>& sort_columns) const {
1023+
py::gil_scoped_release release_gil;
10231024
WriteIncompleteOptions options{
10241025
.validate_index=validate_index,
10251026
.write_options=get_write_options(),

python/tests/unit/arcticdb/version_store/test_write.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
import numpy as np
99
import pandas as pd
1010
import pytest
11-
from arcticdb.exceptions import SortingException, NormalizationException
11+
from arcticdb.exceptions import SortingException
1212
from arcticdb.util._versions import IS_PANDAS_TWO
13+
from arcticdb.util.test import assert_frame_equal
1314
from pandas import MultiIndex
1415

1516

@@ -133,3 +134,28 @@ def test_write_non_timestamp_index(lmdb_version_store, index_type, sorted, valid
133134
assert info["sorted"] == "UNKNOWN"
134135

135136

137+
def test_write_unicode(lmdb_version_store):
138+
symbol = "test_write_unicode"
139+
uc = "\u0420\u043e\u0441\u0441\u0438\u044f"
140+
141+
df1 = pd.DataFrame(
142+
index=[pd.Timestamp("2018-01-02"), pd.Timestamp("2018-01-03")],
143+
data={"a": ["123", uc]},
144+
)
145+
lmdb_version_store.write(symbol, df1)
146+
vit = lmdb_version_store.read(symbol)
147+
assert_frame_equal(vit.data, df1)
148+
149+
150+
def test_write_parallel_unicode(lmdb_version_store):
151+
symbol = "test_write_parallel_unicode"
152+
uc = "\u0420\u043e\u0441\u0441\u0438\u044f"
153+
154+
df1 = pd.DataFrame(
155+
index=[pd.Timestamp("2018-01-02"), pd.Timestamp("2018-01-03")],
156+
data={"a": ["123", uc]},
157+
)
158+
lmdb_version_store.write(symbol, df1, parallel=True)
159+
lmdb_version_store.compact_incomplete(symbol, append=False, convert_int_to_float=False)
160+
vit = lmdb_version_store.read(symbol)
161+
assert_frame_equal(vit.data, df1)

0 commit comments

Comments
 (0)