Permalink
Browse files

Revert "Pack Erlang files into a zip archive"

Turns out the Erlang zip-directory-reading code is so slow that
this change doubled launch time.  :(

This reverts commit 5741c00.

Change-Id: I24c6a794f9cdebd22fa06e470a2ec832067130f6
Reviewed-on: http://review.couchbase.org/10257
Tested-by: Farshid Ghods <farshid.ghods@gmail.com>
Reviewed-by: Marty Schoch <marty.schoch@gmail.com>
Reviewed-by: Chris Anderson <jchris@couchbase.com>
  • Loading branch information...
1 parent b8fb84d commit 2da3fce8e64401fcfb1483601e1cb83c9e07a693 @snej snej committed Oct 20, 2011
@@ -172,51 +172,39 @@ - (void) restart {
// Body of the pthread that runs Erlang (and CouchDB)
- (void)erlangThread {
- char* erlang_args[18] = {"beam", "--", "-noinput",
+ char* erlang_args[15] = {"beam", "--", "-noinput",
"-sasl", "errlog_type", "error", // Change "error" to "all" to re-enable progress reports
"-eval", "R = application:start(couch), io:format(\"~w~n\",[R]).",
- "-pa", NULL, ":",
"-root", NULL, "-couch_ini", NULL, NULL, NULL, NULL};
int erlang_argc;
{
- // Alloc some paths to pass in as args to erl_start.
- // erl_root points to the root of the ZIP archive where the .beam files live.
- // erl_extras points to the erlang dir where unzippable files (.js mostly) live.
+ // Alloc some paths to pass in as args to erl_start:
NSAutoreleasePool* pool = [NSAutoreleasePool new];
- char* erl_root = strdup([[_bundlePath stringByAppendingPathComponent:@"couchbasemobile.ez"]
- fileSystemRepresentation]);
- char* erl_extras = strdup([_bundlePath fileSystemRepresentation]);
- erlang_args[9] = erl_extras;
- erlang_args[12] = erl_root;
+ char* erl_root = strdup([[_bundlePath stringByAppendingPathComponent:@"erlang"]
+ fileSystemRepresentation]);
+ erlang_args[9] = erl_root;
// Yes, there are up to four layers of .ini files: Default, iOS, app, local.
- erlang_args[14] = strdup([[_bundlePath stringByAppendingPathComponent:@"default.ini"]
+ erlang_args[11] = strdup([[_bundlePath stringByAppendingPathComponent:@"default.ini"]
fileSystemRepresentation]);
- erlang_args[15] = strdup([[_documentsDirectory stringByAppendingPathComponent:
+ erlang_args[12] = strdup([[_documentsDirectory stringByAppendingPathComponent:
@"default_ios.ini"] fileSystemRepresentation]);
- erlang_argc = 16;
+ erlang_argc = 13;
if (_iniFilePath)
erlang_args[erlang_argc++] = strdup([_iniFilePath fileSystemRepresentation]);
erlang_args[erlang_argc++] = strdup([self.localIniFilePath fileSystemRepresentation]);
// Set some environment variables for Erlang:
char erl_bin[1024];
char erl_inetrc[1024];
- sprintf(erl_bin, "%s/lib/erts-5.7.5/bin", erl_root);
+ sprintf(erl_bin, "%s/erts-5.7.5/bin", erl_root);
sprintf(erl_inetrc, "%s/erl_inetrc", erl_root);
- setenv("ROOTDIR", erl_extras, 1);
+ setenv("ROOTDIR", erl_root, 1);
setenv("BINDIR", erl_bin, 1);
setenv("ERL_INETRC", erl_inetrc, 1);
[pool drain];
}
-
-#if 0
- fprintf(stderr, "Launching Erlang with argv: ");
- for (int i=0; i<erlang_argc; ++i)
- fprintf(stderr, "%s ", erlang_args[i]);
- fprintf(stderr, "\n");
-#endif
erl_start(erlang_argc, erlang_args); // This never returns (unless Erlang exits)
}
@@ -27,10 +27,10 @@ file = $INSTALLDIR/log/couch.log
[view_server_emonk]
num_threads = 2
-mapred_js = $BUNDLEDIR/emonk_mapred.js
+mapred_js = $BUNDLEDIR/erlang/emonk_mapred.js
[app_server_emonk]
-source = $BUNDLEDIR/emonk_app.js
+source = $BUNDLEDIR/erlang/emonk_app.js
[httpd_global_handlers]
favicon.ico = {couch_httpd_misc_handlers, handle_favicon_req, "$INSTALLDIR/utils"}
@@ -55,4 +55,4 @@ _spatial/_list = {couch_httpd_spatial_list, handle_spatial_list_req}
_spatial/_info = {couch_httpd_spatial, handle_design_info_req}
_spatial/_compact = {couch_httpd_spatial, handle_compact_req}
;deprecated API
-_spatiallist = {couch_httpd_spatial_list, handle_spatial_list_req_deprecated}
+_spatiallist = {couch_httpd_spatial_list, handle_spatial_list_req_deprecated}
@@ -7,7 +7,7 @@
set -e # Bail out if any command returns an error
export PATH=$PATH:/usr/local/bin:/opt/local/bin # Erlang is often installed in nonstandard places
-ERLANG_DSTDIR="${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/CouchbaseResources"
+ERLANG_DSTDIR="${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/CouchbaseResources/erlang"
COMPILE=Scripts/compile_erlang_dir.sh
# First copy the checked-in erlang resources into the framework:
@@ -37,10 +37,3 @@ $COMPILE "../../vendor/geocouch/src/vtree" "vtree.erl vtree_bulk.erl vtree_insbe
echo "Stripping .beam files..."
cd "${ERLANG_DSTDIR}"
erl -noinput -eval 'erlang:display(beam_lib:strip_release("."))' -s init stop
-
-# Archive all the Erlang files into a Zip file. (Don't compress the already-gz'd .beam files.)
-rm -f couchbasemobile.ez
-zip --test -r couchbasemobile.ez bin lib erl_inetrc \
- --include '*.beam' '*.app' '*.appup' '*.boot' 'erl_inetrc' \
- -n .beam
-rm -rf bin lib erl_inetrc
@@ -1,5 +1,5 @@
#!/bin/bash
-ERLANG_DSTDIR="${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/CouchbaseResources"
+ERLANG_DSTDIR="${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/CouchbaseResources/erlang"
cd ../../vendor/couchdb/share/server

0 comments on commit 2da3fce

Please sign in to comment.