🌐 AI搜索 & 代理 主页
Skip to content

Commit 58fa312

Browse files
committed
Remove StringLeaser from Transaction context
1 parent d77d365 commit 58fa312

16 files changed

+54
-77
lines changed

arangod/Aql/Expression.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "Aql/QueryExpressionContext.h"
3838
#include "Aql/Range.h"
3939
#include "Aql/TypedAstNodes.h"
40+
#include "Basics/ThreadLocalLeaser.h"
4041
#ifdef USE_V8
4142
#include "Aql/V8ErrorHandler.h"
4243
#endif
@@ -711,7 +712,7 @@ AqlValue Expression::executeSimpleExpressionObject(ExpressionContext& ctx,
711712
auto builder = ThreadLocalBuilderLeaser::current.lease();
712713
builder->openObject();
713714

714-
transaction::StringLeaser buffer(&trx);
715+
auto buffer = ThreadLocalStringLeaser::current.lease();
715716
arangodb::velocypack::StringSink adapter(buffer.get());
716717

717718
for (size_t i = 0; i < n; ++i) {

arangod/Aql/Function/CallApplyFunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ AqlValue callApplyBackend(
6565
auto& trx = expressionContext->trx();
6666

6767
std::string ucInvokeFN;
68-
transaction::StringLeaser buffer(&trx);
68+
auto buffer = ThreadLocalStringLeaser::current.lease();
6969
velocypack::StringSink adapter(buffer.get());
7070

7171
aql::functions::appendAsString(trx.vpackOptions(), adapter, invokeFN);

arangod/Aql/Function/DistanceFunctions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "Aql/Functions.h"
3131
#include "Basics/StringUtils.h"
3232
#include "Basics/SupervisedBuffer.h"
33+
#include "Basics/ThreadLocalLeaser.h"
3334
#include "Basics/VelocyPackHelper.h"
3435
#include "Transaction/Helpers.h"
3536
#include "Transaction/Methods.h"
@@ -152,7 +153,7 @@ AqlValue functions::LevenshteinDistance(
152153
AqlValue const& value2 = extractFunctionParameterValue(parameters, 1);
153154

154155
// we use one buffer to stringify both arguments
155-
transaction::StringLeaser buffer(&trx);
156+
auto buffer = ThreadLocalStringLeaser::current.lease();
156157
velocypack::StringSink adapter(buffer.get());
157158

158159
// stringify argument 1

arangod/Aql/Function/EncodingFunctions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ AqlValue functions::ToBase64(ExpressionContext* expr, AstNode const&,
5050
auto& trx = expr->trx();
5151
AqlValue const& value = extractFunctionParameterValue(parameters, 0);
5252

53-
transaction::StringLeaser buffer(&trx);
53+
auto buffer = ThreadLocalStringLeaser::current.lease();
5454
velocypack::StringSink adapter(buffer.get());
5555

5656
appendAsString(trx.vpackOptions(), adapter, value);
@@ -66,7 +66,7 @@ AqlValue functions::ToHex(ExpressionContext* expr, AstNode const&,
6666
auto& trx = expr->trx();
6767
AqlValue const& value = extractFunctionParameterValue(parameters, 0);
6868

69-
transaction::StringLeaser buffer(&trx);
69+
auto buffer = ThreadLocalStringLeaser::current.lease();
7070
velocypack::StringSink adapter(buffer.get());
7171

7272
appendAsString(trx.vpackOptions(), adapter, value);
@@ -83,7 +83,7 @@ AqlValue functions::EncodeURIComponent(ExpressionContext* expr, AstNode const&,
8383
auto& trx = expr->trx();
8484
AqlValue const& value = extractFunctionParameterValue(parameters, 0);
8585

86-
transaction::StringLeaser buffer(&trx);
86+
auto buffer = ThreadLocalStringLeaser::current.lease();
8787
velocypack::StringSink adapter(buffer.get());
8888

8989
appendAsString(trx.vpackOptions(), adapter, value);

arangod/Aql/Function/HashFunctions.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "Aql/Function.h"
2929
#include "Aql/Functions.h"
3030
#include "Basics/StringUtils.h"
31+
#include "Basics/ThreadLocalLeaser.h"
3132
#include "Basics/conversions.h"
3233
#include "Basics/hashes.h"
3334
#include "Ssl/SslInterface.h"
@@ -54,7 +55,7 @@ AqlValue functions::Soundex(ExpressionContext* expr, AstNode const&,
5455
auto& trx = expr->trx();
5556
AqlValue const& value = extractFunctionParameterValue(parameters, 0);
5657

57-
transaction::StringLeaser buffer(&trx);
58+
auto buffer = ThreadLocalStringLeaser::current.lease();
5859
velocypack::StringSink adapter(buffer.get());
5960

6061
appendAsString(trx.vpackOptions(), adapter, value);
@@ -73,7 +74,7 @@ AqlValue functions::Md5(ExpressionContext* exprCtx, AstNode const&,
7374
auto const& vopts = trx->vpackOptions();
7475
AqlValue const& value =
7576
aql::functions::extractFunctionParameterValue(parameters, 0);
76-
transaction::StringLeaser buffer(trx);
77+
auto buffer = ThreadLocalStringLeaser::current.lease();
7778
velocypack::StringSink adapter(buffer.get());
7879

7980
appendAsString(vopts, adapter, value);
@@ -96,7 +97,7 @@ AqlValue functions::Sha1(ExpressionContext* exprCtx, AstNode const&,
9697
auto const& vopts = trx->vpackOptions();
9798
AqlValue const& value =
9899
aql::functions::extractFunctionParameterValue(parameters, 0);
99-
transaction::StringLeaser buffer(trx);
100+
auto buffer = ThreadLocalStringLeaser::current.lease();
100101
velocypack::StringSink adapter(buffer.get());
101102

102103
appendAsString(vopts, adapter, value);
@@ -119,7 +120,7 @@ AqlValue functions::Sha256(ExpressionContext* exprCtx, AstNode const&,
119120
auto const& vopts = trx->vpackOptions();
120121
AqlValue const& value =
121122
aql::functions::extractFunctionParameterValue(parameters, 0);
122-
transaction::StringLeaser buffer(trx);
123+
auto buffer = ThreadLocalStringLeaser::current.lease();
123124
velocypack::StringSink adapter(buffer.get());
124125

125126
appendAsString(vopts, adapter, value);
@@ -142,7 +143,7 @@ AqlValue functions::Sha512(ExpressionContext* exprCtx, AstNode const&,
142143
auto const& vopts = trx->vpackOptions();
143144
AqlValue const& value =
144145
aql::functions::extractFunctionParameterValue(parameters, 0);
145-
transaction::StringLeaser buffer(trx);
146+
auto buffer = ThreadLocalStringLeaser::current.lease();
146147
velocypack::StringSink adapter(buffer.get());
147148

148149
appendAsString(vopts, adapter, value);
@@ -165,7 +166,7 @@ AqlValue functions::Crc32(ExpressionContext* exprCtx, AstNode const&,
165166
auto const& vopts = trx->vpackOptions();
166167
AqlValue const& value =
167168
aql::functions::extractFunctionParameterValue(parameters, 0);
168-
transaction::StringLeaser buffer(trx);
169+
auto buffer = ThreadLocalStringLeaser::current.lease();
169170
velocypack::StringSink adapter(buffer.get());
170171

171172
appendAsString(vopts, adapter, value);
@@ -183,7 +184,7 @@ AqlValue functions::Fnv64(ExpressionContext* exprCtx, AstNode const&,
183184
auto const& vopts = trx->vpackOptions();
184185
AqlValue const& value =
185186
aql::functions::extractFunctionParameterValue(parameters, 0);
186-
transaction::StringLeaser buffer(trx);
187+
auto buffer = ThreadLocalStringLeaser::current.lease();
187188
velocypack::StringSink adapter(buffer.get());
188189

189190
appendAsString(vopts, adapter, value);

arangod/Aql/Function/JsonFunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ AqlValue functions::JsonStringify(ExpressionContext* exprCtx, AstNode const&,
5555
AqlValueMaterializer materializer(vopts);
5656
VPackSlice slice = materializer.slice(value);
5757

58-
transaction::StringLeaser buffer(trx);
58+
auto buffer = ThreadLocalStringLeaser::current.lease();
5959
velocypack::StringSink adapter(buffer.get());
6060

6161
VPackDumper dumper(&adapter, trx->transactionContextPtr()->getVPackOptions());

arangod/Aql/Function/MiscFunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ AqlValue functions::Reverse(ExpressionContext* expressionContext,
191191
return AqlValue(builder->slice(), builder->size());
192192
} else if (value.isString()) {
193193
std::string utf8;
194-
transaction::StringLeaser buf1(trx);
194+
auto buf1 = ThreadLocalStringLeaser::current.lease();
195195
velocypack::StringSink adapter(buf1.get());
196196
appendAsString(vopts, adapter, value);
197197
icu_64_64::UnicodeString uBuf(buf1->data(),

arangod/Aql/Function/ObjectFunctions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ AqlValue functions::Translate(ExpressionContext* expressionContext,
396396
if (key.isString()) {
397397
result = slice.get(key.slice().copyString());
398398
} else {
399-
transaction::StringLeaser buffer(trx);
399+
auto buffer = ThreadLocalStringLeaser::current.lease();
400400
velocypack::StringSink adapter(buffer.get());
401401
functions::stringify(vopts, adapter, key.slice());
402402
result = slice.get(*buffer);
@@ -452,7 +452,7 @@ AqlValue functions::Has(ExpressionContext* expressionContext, AstNode const&,
452452
aql::functions::extractFunctionParameterValue(parameters, 1);
453453
if (!name.isString()) {
454454
auto const& vopts = trx->vpackOptions();
455-
transaction::StringLeaser buffer(trx);
455+
auto buffer = ThreadLocalStringLeaser::current.lease();
456456
velocypack::StringSink adapter(buffer.get());
457457
appendAsString(vopts, adapter, name);
458458
return AqlValue(AqlValueHintBool(value.hasKey(*buffer)));
@@ -787,7 +787,7 @@ AqlValue functions::Zip(ExpressionContext* expressionContext, AstNode const&,
787787

788788
// Buffer will temporarily hold the keys
789789
containers::FlatHashSet<std::string> keysSeen;
790-
transaction::StringLeaser buffer(trx);
790+
auto buffer = ThreadLocalStringLeaser::current.lease();
791791
velocypack::StringSink adapter(buffer.get());
792792

793793
VPackArrayIterator keysIt(keysSlice);

arangod/Aql/Function/RegexFunctions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ AqlValue functions::RegexMatches(ExpressionContext* expressionContext,
8383
bool const caseInsensitive = getBooleanParameter(parameters, 2, false);
8484

8585
// build pattern from parameter #1
86-
transaction::StringLeaser buffer(trx);
86+
auto buffer = ThreadLocalStringLeaser::current.lease();
8787
velocypack::StringSink adapter(buffer.get());
8888

8989
AqlValue const& regex =
@@ -184,7 +184,7 @@ AqlValue functions::RegexSplit(ExpressionContext* expressionContext,
184184
bool const caseInsensitive = getBooleanParameter(parameters, 2, false);
185185

186186
// build pattern from parameter #1
187-
transaction::StringLeaser buffer(trx);
187+
auto buffer = ThreadLocalStringLeaser::current.lease();
188188
velocypack::StringSink adapter(buffer.get());
189189

190190
AqlValue const& regex =
@@ -287,7 +287,7 @@ AqlValue functions::RegexTest(ExpressionContext* expressionContext,
287287
transaction::Methods* trx = &expressionContext->trx();
288288
auto const& vopts = trx->vpackOptions();
289289
bool const caseInsensitive = getBooleanParameter(parameters, 2, false);
290-
transaction::StringLeaser buffer(trx);
290+
auto buffer = ThreadLocalStringLeaser::current.lease();
291291
velocypack::StringSink adapter(buffer.get());
292292

293293
// build pattern from parameter #1
@@ -333,7 +333,7 @@ AqlValue functions::RegexReplace(ExpressionContext* expressionContext,
333333
transaction::Methods* trx = &expressionContext->trx();
334334
auto const& vopts = trx->vpackOptions();
335335
bool const caseInsensitive = getBooleanParameter(parameters, 3, false);
336-
transaction::StringLeaser buffer(trx);
336+
auto buffer = ThreadLocalStringLeaser::current.lease();
337337
velocypack::StringSink adapter(buffer.get());
338338

339339
// build pattern from parameter #1

0 commit comments

Comments
 (0)