8000 hand-moved changes from other branch · ezhangle/arangodb@3ddf23d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ddf23d

Browse files
committed
hand-moved changes from other branch
1 parent 0cbded4 commit 3ddf23d

File tree

10 files changed

+45
-19
lines changed

10 files changed

+45
-19
lines changed

arangod/Cluster/RestShardHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ RestShardHandler::RestShardHandler (triagens::rest::HttpRequest* request,
6767
Dispatcher* data)
6868
: RestBaseHandler(request),
6969
_dispatcher(data) {
70-
TRI_ASSERT(_dispatcher != 0);
70+
TRI_ASSERT(_dispatcher != nullptr);
7171
}
7272

7373
// -----------------------------------------------------------------------------

js/apps/system/_admin/aardvark/APP/frontend/js/bootstrap/errors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
"ERROR_QUERY_NOT_FOUND" : { "code" : 1591, "message" : "query ID not found" },
190190
"ERROR_QUERY_IN_USE" : { "code" : 1592, "message" : "query with this ID is in use" },
191191
"ERROR_CURSOR_NOT_FOUND" : { "code" : 1600, "message" : "cursor not found" },
192+
"ERROR_CURSOR_BUSY" : { "code" : 1601, "message" : "cursor is busy" },
192193
"ERROR_TRANSACTION_INTERNAL" : { "code" : 1650, "message" : "internal transaction error" },
193194
"ERROR_TRANSACTION_NESTED" : { "code" : 1651, "message" : "nested transactions detected" },
194195
"ERROR_TRANSACTION_UNREGISTERED_COLLECTION" : { "code" : 1652, "message" : "unregistered collection used in transaction" },

js/common/bootstrap/errors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
"ERROR_QUERY_NOT_FOUND" : { "code" : 1591, "message" : "query ID not found" },
190190
"ERROR_QUERY_IN_USE" : { "code" : 1592, "message" : "query with this ID is in use" },
191191
"ERROR_CURSOR_NOT_FOUND" : { "code" : 1600, "message" : "cursor not found" },
192+
"ERROR_CURSOR_BUSY" : { "code" : 1601, "message" : "cursor is busy" },
192193
"ERROR_TRANSACTION_INTERNAL" : { "code" : 1650, "message" : "internal transaction error" },
193194
"ERROR_TRANSACTION_NESTED" : { "code" : 1651, "message" : "nested transactions detected" },
194195
"ERROR_TRANSACTION_UNREGISTERED_COLLECTION" : { "code" : 1652, "message" : "unregistered collection used in transaction" },

lib/Basics/JsonHelper.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "Basics/Common.h"
3434
#include "Basics/Exceptions.h"
3535
#include "Basics/json.h"
36+
#include "Basics/StringBuffer.h"
3637

3738
namespace triagens {
3839
namespace basics {
@@ -971,8 +972,20 @@ namespace triagens {
971972
if (_json != nullptr) {
972973
return JsonHelper::toString(_json);
973974
}
974-
else {
975-
return std::string("");
975+
return std::string("");
976+
}
977+
978+
////////////////////////////////////////////////////////////////////////////////
979+
/// @brief appends JSON to a string buffer
980+
////////////////////////////////////////////////////////////////////////////////
981+
982+
void dump (triagens::basics::StringBuffer& buffer) const {
983+
if (_json != nullptr) {
984+
int res = TRI_StringifyJson(buffer.stringBuffer(), _json);
985+
986+
if (res != TRI_ERROR_NO_ERROR) {
987+
throw JsonException("Json: out of memory");
988+
}
976989
}
977990
}
978991

lib/Basics/errors.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ ERROR_QUERY_IN_USE,1592,"query with this ID is in use", "Will be raised when an
245245
################################################################################
246246

247247
ERROR_CURSOR_NOT_FOUND,1600,"cursor not found","Will be raised when a cursor is requested via its id but a cursor with that id cannot be found."
248+
ERROR_CURSOR_BUSY,1601,"cursor is busy","Will be raised when a cursor is requested via its id but a concurrent request is still using the cursor."
248249

249250
################################################################################
250251
## ArangoDB transaction errors

lib/Basics/voc-errors.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ void TRI_InitialiseErrorMessages () {
185185
REG_ERROR(ERROR_QUERY_NOT_FOUND, "query ID not found");
186186
REG_ERROR(ERROR_QUERY_IN_USE, "query with this ID is in use");
187187
REG_ERROR(ERROR_CURSOR_NOT_FOUND, "cursor not found");
188+
REG_ERROR(ERROR_CURSOR_BUSY, "cursor is busy");
188189
REG_ERROR(ERROR_TRANSACTION_INTERNAL, "internal transaction error");
189190
REG_ERROR(ERROR_TRANSACTION_NESTED, "nested transactions detected");
190191
REG_ERROR(ERROR_TRANSACTION_UNREGISTERED_COLLECTION, "unregistered collection used in transaction");

lib/Basics/voc-errors.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@
458458
/// - 1600: @LIT{cursor not found}
459459
/// Will be raised when a cursor is requested via its id but a cursor with
460460
/// that id cannot be found.
461+
/// - 1601: @LIT{cursor is busy}
462+
/// Will be raised when a cursor is requested via its id but a concurrent
463+
/// request is still using the cursor.
461464
/// - 1650: @LIT{internal transaction error}
462465
/// Will be raised when a wrong usage of transactions is detected. this is an
463466
/// internal error and indicates a bug in ArangoDB.
@@ -2509,6 +2512,17 @@ void TRI_InitialiseErrorMessages ();
25092512

25102513
#define TRI_ERROR_CURSOR_NOT_FOUND (1600)
25112514

2515+
////////////////////////////////////////////////////////////////////////////////
2516+
/// @brief 1601: ERROR_CURSOR_BUSY
2517+
///
2518+
/// cursor is busy
2519+
///
2520+
/// Will be raised when a cursor is requested via its id but a concurrent
2521+
/// request is still using the cursor.
2522+
////////////////////////////////////////////////////////////////////////////////
2523+
2524+
#define TRI_ERROR_CURSOR_BUSY (1601)
2525+
25122526
////////////////////////////////////////////////////////////////////////////////
25132527
/// @brief 1650: ERROR_TRANSACTION_INTERNAL
25142528
///

lib/GeneralServer/GeneralServerJob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ namespace triagens {
200200
abandon = _abandon;
201201
}
202202

203-
if (! abandon && _server != 0) {
203+
if (! abandon && _server != nullptr) {
204204
_server->jobDone(this);
205205
}
206206

lib/HttpServer/HttpHandler.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,17 @@ using namespace triagens::rest;
4848

4949
HttpHandler::HttpHandler (HttpRequest* request)
5050
: _request(request),
51-
_response(0),
52-
_server(0) {
51+
_response(nullptr),
52+
_server(nullptr) {
5353
}
5454

5555
////////////////////////////////////////////////////////////////////////////////
5656
/// @brief destructs a handler
5757
////////////////////////////////////////////////////////////////////////////////
5858

5959
HttpHandler::~HttpHandler () {
60-
if (_request != 0) {
61-
delete _request;
62-
}
63-
64-
if (_response != 0) {
65-
delete _response;
66-
}
60+
delete _request;
61+
delete _response;
6762
}
6863

6964
// -----------------------------------------------------------------------------
@@ -84,7 +79,7 @@ HttpResponse* HttpHandler::getResponse () const {
8479

8580
HttpResponse* HttpHandler::stealResponse () {
8681
HttpResponse* tmp = _response;
87-
_response = 0;
82+
_response = nullptr;
8883
return tmp;
8984
}
9085

@@ -94,7 +89,7 @@ HttpResponse* HttpHandler::stealResponse () {
9489

9590
HttpRequest* HttpHandler::stealRequest () {
9691
HttpRequest* tmp = _request;
97-
_request = 0;
92+
_request = nullptr;
9893
return tmp;
9994
}
10095

@@ -111,19 +106,19 @@ Job* HttpHandler::createJob (AsyncJobServer* server,
111106
HttpServer* httpServer = dynamic_cast<HttpServer*>(server);
112107

113108
// check if we are an HTTP server at all
114-
if (httpServer != 0) {
109+
if (httpServer != nullptr) {
115110
return new GeneralServerJob<HttpServer, HttpHandlerFactory::GeneralHandler>(httpServer, this, isDetached);
116111
}
117112

118113
// check if we are an HTTPs server at all
119114
HttpsServer* httpsServer = dynamic_cast<HttpsServer*>(server);
120115

121-
if (httpsServer != 0) {
116+
if (httpsServer != nullptr) {
122117
return new GeneralServerJob<HttpsServer, HttpHandlerFactory::GeneralHandler>(httpsServer, this, isDetached);
123118
}
124119

125120
LOG_WARNING("cannot convert AsyncJobServer into a HttpServer");
126-
return 0;
121+
return nullptr;
127122
}
128123

129124
// -----------------------------------------------------------------------------

lib/Rest/HttpResponse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ HttpResponse::HttpResponseCode HttpResponse::responseCode (int code) {
198198
TRI_ASSERT(code != TRI_ERROR_NO_ERROR);
199199

200200
switch (code) {
201+
case TRI_ERROR_BAD_PARAMETER:
201202
case TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD:
202203
case TRI_ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED:
203204
case TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID:
204-
case TRI_ERROR_BAD_PARAMETER:
205205
case TRI_ERROR_CLUSTER_MUST_NOT_CHANGE_SHARDING_ATTRIBUTES:
206206
case TRI_ERROR_CLUSTER_MUST_NOT_SPECIFY_KEY:
207207
return BAD;

0 commit comments

Comments
 (0)
0