1
0
Fork 0

issue #251: added --javascript.v8-options command line argument

This commit is contained in:
Jan Steemann 2012-10-22 10:19:49 +02:00
parent 6d1201b2ec
commit edb332ed87
4 changed files with 48 additions and 3 deletions

View File

@ -32,6 +32,10 @@ v1.1.beta1 (2012-XX-XX)
- if the length of the HTTP headers is greated than the maximum allowed size (1 MB), - if the length of the HTTP headers is greated than the maximum allowed size (1 MB),
the server will fail with HTTP 431 (request header fields too large) the server will fail with HTTP 431 (request header fields too large)
* issue #251: allow passing arbitrary options to V8 engine using new command line option:
--javascript.v8-options. Using this option, the Harmony features or other settings in
v8 can be enabled if the end user requires them
* issue #248: allow AQL optimiser to pull out completely uncorrelated subqueries to the * issue #248: allow AQL optimiser to pull out completely uncorrelated subqueries to the
top level, resulting in less repeated evaluation of the subquery top level, resulting in less repeated evaluation of the subquery

View File

@ -61,6 +61,7 @@
/// <li>@ref CommandLineArangoRemoveOnDrop "database.remove-on-compacted"</li> /// <li>@ref CommandLineArangoRemoveOnDrop "database.remove-on-compacted"</li>
/// <li>@ref CommandLineArangoJsGcFrequency "javascript.gc-frequency"</li> /// <li>@ref CommandLineArangoJsGcFrequency "javascript.gc-frequency"</li>
/// <li>@ref CommandLineArangoJsGcInterval "javascript.gc-interval"</li> /// <li>@ref CommandLineArangoJsGcInterval "javascript.gc-interval"</li>
/// <li>@ref CommandLineArangoJsV8Options "javascript.v8-options"</li>
/// </ul> /// </ul>
/// </li> /// </li>
/// <li>@ref CommandLineLogging /// <li>@ref CommandLineLogging
@ -222,6 +223,9 @@
/// @anchor CommandLineArangoJsGcInterval /// @anchor CommandLineArangoJsGcInterval
/// @copydetails triagens::arango::ApplicationV8::_gcInterval /// @copydetails triagens::arango::ApplicationV8::_gcInterval
/// ///
/// @anchor CommandLineArangoJsV8Options
/// @copydetails triagens::arango::ApplicationV8::_v8Options;
///
/// @section CommandLineScheduler Command-Line Options for Communication /// @section CommandLineScheduler Command-Line Options for Communication
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// ///

View File

@ -179,6 +179,7 @@ ApplicationV8::ApplicationV8 (string const& binaryPath)
_useActions(true), _useActions(true),
_gcInterval(1000), _gcInterval(1000),
_gcFrequency(10.0), _gcFrequency(10.0),
_v8Options(""),
_startupLoader(), _startupLoader(),
_actionLoader(), _actionLoader(),
_vocbase(0), _vocbase(0),
@ -485,12 +486,10 @@ void ApplicationV8::setupOptions (map<string, basics::ProgramOptionsDescription>
options["JAVASCRIPT Options:help-admin"] options["JAVASCRIPT Options:help-admin"]
("javascript.gc-interval", &_gcInterval, "JavaScript request-based garbage collection interval (each x requests)") ("javascript.gc-interval", &_gcInterval, "JavaScript request-based garbage collection interval (each x requests)")
("javascript.gc-frequency", &_gcFrequency, "JavaScript time-based garbage collection frequency (each x seconds)") ("javascript.gc-frequency", &_gcFrequency, "JavaScript time-based garbage collection frequency (each x seconds)")
;
options["JAVASCRIPT Options:help-admin"]
("javascript.action-directory", &_actionPath, "path to the JavaScript action directory") ("javascript.action-directory", &_actionPath, "path to the JavaScript action directory")
("javascript.modules-path", &_startupModules, "one or more directories separated by (semi-) colons") ("javascript.modules-path", &_startupModules, "one or more directories separated by (semi-) colons")
("javascript.startup-directory", &_startupPath, "path to the directory containing alternate JavaScript startup scripts") ("javascript.startup-directory", &_startupPath, "path to the directory containing alternate JavaScript startup scripts")
("javascript.v8-options", &_v8Options, "options to pass to v8")
; ;
} }
@ -546,6 +545,11 @@ bool ApplicationV8::prepare () {
} }
} }
if (_v8Options.size() > 0) {
LOGGER_INFO << "using V8 options '" << _v8Options << "'";
v8::V8::SetFlagsFromString(_v8Options.c_str(), _v8Options.size());
}
// setup instances // setup instances
_contexts = new V8Context*[_nrInstances]; _contexts = new V8Context*[_nrInstances];

View File

@ -385,6 +385,39 @@ namespace triagens {
double _gcFrequency; double _gcFrequency;
////////////////////////////////////////////////////////////////////////////////
/// @brief optional arguments to pass to v8
///
/// @CMDOPT{\-\-javascript.v8-options @CA{options}}
///
/// Optional arguments to pass to the V8 Javascript engine. The V8 engine will
/// run with default settings unless explicit options are specified using this
/// option. The options passed will be forwarded to the V8 engine which will
/// parse them on its own. Passing invalid options may result in an error being
/// printed on stderr and the option being ignored.
///
/// Options need to be passed in one string, with V8 option names being prefixed
/// with double dashes. Multiple options need to be separated by whitespace.
/// To get a list of all available V8 options, you can use
/// the value @LIT{"--help"} as follows:
/// @code
/// --javascript.v8-options "--help"
/// @endcode
///
/// Another example of specific V8 options being set at startup:
/// @code
/// --javascript.v8-options "--harmony --log"
/// @endcode
///
/// Names and features or usable options depend on the version of V8 being used,
/// and might change in the future if a different version of V8 is being used
/// in ArangoDB. Not all options offered by V8 might be sensible to use in the
/// context of ArangoDB. Use the specific options only if you are sure that
/// they are not harmful for the regular database operation.
////////////////////////////////////////////////////////////////////////////////
string _v8Options;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief V8 startup loader /// @brief V8 startup loader
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////