1
0
Fork 0

Suppress replication operations from audit output. (#8896)

This commit is contained in:
Dan Larkin-York 2019-05-08 04:16:57 -04:00 committed by Jan
parent 068270fff9
commit efa180c88f
3 changed files with 31 additions and 24 deletions

View File

@ -1540,7 +1540,7 @@ OperationResult transaction::Methods::document(std::string const& collectionName
if (!value.isObject() && !value.isArray()) { if (!value.isObject() && !value.isArray()) {
// must provide a document object or an array of documents // must provide a document object or an array of documents
events::ReadDocument(vocbase().name(), collectionName, value, events::ReadDocument(vocbase().name(), collectionName, value, options,
TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
} }
@ -1552,7 +1552,8 @@ OperationResult transaction::Methods::document(std::string const& collectionName
result = documentLocal(collectionName, value, options); result = documentLocal(collectionName, value, options);
} }
events::ReadDocument(vocbase().name(), collectionName, value, result.errorNumber()); events::ReadDocument(vocbase().name(), collectionName, value, options,
result.errorNumber());
return result; return result;
} }
@ -1672,12 +1673,12 @@ OperationResult transaction::Methods::insert(std::string const& collectionName,
if (!value.isObject() && !value.isArray()) { if (!value.isObject() && !value.isArray()) {
// must provide a document object or an array of documents // must provide a document object or an array of documents
events::CreateDocument(vocbase().name(), collectionName, value, events::CreateDocument(vocbase().name(), collectionName, value, options,
TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
} }
if (value.isArray() && value.length() == 0) { if (value.isArray() && value.length() == 0) {
events::CreateDocument(vocbase().name(), collectionName, value, TRI_ERROR_NO_ERROR); events::CreateDocument(vocbase().name(), collectionName, value, options, TRI_ERROR_NO_ERROR);
return emptyResult(options); return emptyResult(options);
} }
@ -1693,7 +1694,7 @@ OperationResult transaction::Methods::insert(std::string const& collectionName,
events::CreateDocument(vocbase().name(), collectionName, events::CreateDocument(vocbase().name(), collectionName,
((result.ok() && options.returnNew) ? result.slice() : value), ((result.ok() && options.returnNew) ? result.slice() : value),
result.errorNumber()); options, result.errorNumber());
return result; return result;
} }
@ -1971,12 +1972,13 @@ OperationResult transaction::Methods::update(std::string const& collectionName,
if (!newValue.isObject() && !newValue.isArray()) { if (!newValue.isObject() && !newValue.isArray()) {
// must provide a document object or an array of documents // must provide a document object or an array of documents
events::ModifyDocument(vocbase().name(), collectionName, newValue, events::ModifyDocument(vocbase().name(), collectionName, newValue, options,
TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
} }
if (newValue.isArray() && newValue.length() == 0) { if (newValue.isArray() && newValue.length() == 0) {
events::ModifyDocument(vocbase().name(), collectionName, newValue, TRI_ERROR_NO_ERROR); events::ModifyDocument(vocbase().name(), collectionName, newValue, options,
TRI_ERROR_NO_ERROR);
return emptyResult(options); return emptyResult(options);
} }
@ -1989,7 +1991,8 @@ OperationResult transaction::Methods::update(std::string const& collectionName,
result = modifyLocal(collectionName, newValue, optionsCopy, TRI_VOC_DOCUMENT_OPERATION_UPDATE); result = modifyLocal(collectionName, newValue, optionsCopy, TRI_VOC_DOCUMENT_OPERATION_UPDATE);
} }
events::ModifyDocument(vocbase().name(), collectionName, newValue, result.errorNumber()); events::ModifyDocument(vocbase().name(), collectionName, newValue, options,
result.errorNumber());
return result; return result;
} }
@ -2026,12 +2029,13 @@ OperationResult transaction::Methods::replace(std::string const& collectionName,
if (!newValue.isObject() && !newValue.isArray()) { if (!newValue.isObject() && !newValue.isArray()) {
// must provide a document object or an array of documents // must provide a document object or an array of documents
events::ReplaceDocument(vocbase().name(), collectionName, newValue, events::ReplaceDocument(vocbase().name(), collectionName, newValue, options,
TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
} }
if (newValue.isArray() && newValue.length() == 0) { if (newValue.isArray() && newValue.length() == 0) {
events::ReplaceDocument(vocbase().name(), collectionName, newValue, TRI_ERROR_NO_ERROR); events::ReplaceDocument(vocbase().name(), collectionName, newValue, options,
TRI_ERROR_NO_ERROR);
return emptyResult(options); return emptyResult(options);
} }
@ -2045,7 +2049,8 @@ OperationResult transaction::Methods::replace(std::string const& collectionName,
TRI_VOC_DOCUMENT_OPERATION_REPLACE); TRI_VOC_DOCUMENT_OPERATION_REPLACE);
} }
events::ReplaceDocument(vocbase().name(), collectionName, newValue, result.errorNumber()); events::ReplaceDocument(vocbase().name(), collectionName, newValue, options,
result.errorNumber());
return result; return result;
} }
@ -2289,12 +2294,12 @@ OperationResult transaction::Methods::remove(std::string const& collectionName,
if (!value.isObject() && !value.isArray() && !value.isString()) { if (!value.isObject() && !value.isArray() && !value.isString()) {
// must provide a document object or an array of documents // must provide a document object or an array of documents
events::DeleteDocument(vocbase().name(), collectionName, value, events::DeleteDocument(vocbase().name(), collectionName, value, options,
TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID);
} }
if (value.isArray() && value.length() == 0) { if (value.isArray() && value.length() == 0) {
events::DeleteDocument(vocbase().name(), collectionName, value, TRI_ERROR_NO_ERROR); events::DeleteDocument(vocbase().name(), collectionName, value, options, TRI_ERROR_NO_ERROR);
return emptyResult(options); return emptyResult(options);
} }
@ -2306,7 +2311,8 @@ OperationResult transaction::Methods::remove(std::string const& collectionName,
result = removeLocal(collectionName, value, optionsCopy); result = removeLocal(collectionName, value, optionsCopy);
} }
events::DeleteDocument(vocbase().name(), collectionName, value, result.errorNumber()); events::DeleteDocument(vocbase().name(), collectionName, value, options,
result.errorNumber());
return result; return result;
} }

View File

@ -43,15 +43,15 @@ void DropIndex(std::string const& db, std::string const& col,
void CreateView(std::string const& db, std::string const& name, int result) {} void CreateView(std::string const& db, std::string const& name, int result) {}
void DropView(std::string const& db, std::string const& name, int result) {} void DropView(std::string const& db, std::string const& name, int result) {}
void CreateDocument(std::string const& db, std::string const& collection, void CreateDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int) {} VPackSlice const& document, OperationOptions const& options, int) {}
void DeleteDocument(std::string const& db, std::string const& collection, void DeleteDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int) {} VPackSlice const& document, OperationOptions const& options, int) {}
void ReadDocument(std::string const& db, std::string const& collection, void ReadDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int) {} VPackSlice const& document, OperationOptions const& options, int) {}
void ReplaceDocument(std::string const& db, std::string const& collection, void ReplaceDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int) {} VPackSlice const& document, OperationOptions const& options, int) {}
void ModifyDocument(std::string const& db, std::string const& collection, void ModifyDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int) {} VPackSlice const& document, OperationOptions const& options, int) {}
void IllegalDocumentOperation(GeneralRequest const&, int result) {} void IllegalDocumentOperation(GeneralRequest const&, int result) {}
void QueryDocument(std::string const& db, std::string const&, std::string const&, int code) {} void QueryDocument(std::string const& db, std::string const&, std::string const&, int code) {}
void QueryDocument(std::string const& db, VPackSlice const&, int code) {} void QueryDocument(std::string const& db, VPackSlice const&, int code) {}

View File

@ -29,6 +29,7 @@
#include <velocypack/velocypack-aliases.h> #include <velocypack/velocypack-aliases.h>
#include "Rest/CommonDefines.h" #include "Rest/CommonDefines.h"
#include "Utils/OperationOptions.h"
#include "VocBase/LogicalCollection.h" #include "VocBase/LogicalCollection.h"
namespace arangodb { namespace arangodb {
@ -55,15 +56,15 @@ void DropIndex(std::string const& db, std::string const& col,
void CreateView(std::string const& db, std::string const& name, int result); void CreateView(std::string const& db, std::string const& name, int result);
void DropView(std::string const& db, std::string const& name, int result); void DropView(std::string const& db, std::string const& name, int result);
void CreateDocument(std::string const& db, std::string const& collection, void CreateDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int); VPackSlice const& document, OperationOptions const& options, int);
void DeleteDocument(std::string const& db, std::string const& collection, void DeleteDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int); VPackSlice const& document, OperationOptions const& options, int);
void ReadDocument(std::string const& db, std::string const& collection, void ReadDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int); VPackSlice const& document, OperationOptions const& options, int);
void ReplaceDocument(std::string const& db, std::string const& collection, void ReplaceDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int); VPackSlice const& document, OperationOptions const& options, int);
void ModifyDocument(std::string const& db, std::string const& collection, void ModifyDocument(std::string const& db, std::string const& collection,
VPackSlice const& document, int); VPackSlice const& document, OperationOptions const& options, int);
void IllegalDocumentOperation(GeneralRequest const&, int result); void IllegalDocumentOperation(GeneralRequest const&, int result);
void QueryDocument(std::string const& db, std::string const&, std::string const&, int code); void QueryDocument(std::string const& db, std::string const&, std::string const&, int code);
void QueryDocument(std::string const& db, VPackSlice const&, int code); void QueryDocument(std::string const& db, VPackSlice const&, int code);