From 44eae59dc067b51ab5c3eddbaf8b6b34d4d16f58 Mon Sep 17 00:00:00 2001 From: jsteemann Date: Tue, 28 Aug 2018 01:00:40 +0200 Subject: [PATCH] remove functions that are not called anymore --- arangod/Cluster/v8-cluster.cpp | 25 --------- arangod/V8Server/v8-collection.cpp | 51 ------------------- .../@arangodb/sync-replication-debug.js | 43 ---------------- 3 files changed, 119 deletions(-) delete mode 100644 js/server/modules/@arangodb/sync-replication-debug.js diff --git a/arangod/Cluster/v8-cluster.cpp b/arangod/Cluster/v8-cluster.cpp index 16d429b72a..c337f22e2a 100644 --- a/arangod/Cluster/v8-cluster.cpp +++ b/arangod/Cluster/v8-cluster.cpp @@ -1158,27 +1158,6 @@ static void JS_JavaScriptPathServerState( TRI_V8_TRY_CATCH_END } -#ifdef DEBUG_SYNC_REPLICATION -//////////////////////////////////////////////////////////////////////////////// -/// @brief set arangoserver state to initialized -//////////////////////////////////////////////////////////////////////////////// - -static void JS_EnableSyncReplicationDebug( - v8::FunctionCallbackInfo const& args) { - TRI_V8_TRY_CATCH_BEGIN(isolate); - v8::HandleScope scope(isolate); - - if (args.Length() != 0) { - TRI_V8_THROW_EXCEPTION_USAGE("enableSyncReplicationDebug()"); - } - - ServerState::instance()->setInitialized(); - ServerState::instance()->setId("repltest"); - AgencyComm::syncReplDebug = true; - TRI_V8_TRY_CATCH_END -} -#endif - //////////////////////////////////////////////////////////////////////////////// /// @brief return whether the cluster is initialized //////////////////////////////////////////////////////////////////////////////// @@ -2089,10 +2068,6 @@ void TRI_InitV8Cluster(v8::Isolate* isolate, v8::Handle context) { JS_IdOfPrimaryServerState); TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "javaScriptPath"), JS_JavaScriptPathServerState); -#ifdef DEBUG_SYNC_REPLICATION - TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "enableSyncReplicationDebug"), - JS_EnableSyncReplicationDebug); -#endif TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "initialized"), JS_InitializedServerState); TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "isCoordinator"), diff --git a/arangod/V8Server/v8-collection.cpp b/arangod/V8Server/v8-collection.cpp index 89ba2a48ca..ae1d3864ed 100644 --- a/arangod/V8Server/v8-collection.cpp +++ b/arangod/V8Server/v8-collection.cpp @@ -1101,53 +1101,6 @@ static void JS_GetLeader(v8::FunctionCallbackInfo const& args) { TRI_V8_TRY_CATCH_END } -#ifdef DEBUG_SYNC_REPLICATION - -//////////////////////////////////////////////////////////////////////////////// -/// @brief was docuBlock getFollowers -//////////////////////////////////////////////////////////////////////////////// - -static void JS_AddFollower(v8::FunctionCallbackInfo const& args) { - TRI_V8_TRY_CATCH_BEGIN(isolate); - v8::HandleScope scope(isolate); - - auto& vocbase = GetContextVocBase(isolate); - - if (vocbase.isDropped()) { - TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_DATABASE_NOT_FOUND); - } - - if (args.Length() < 1) { - TRI_V8_THROW_EXCEPTION_USAGE("addFollower()"); - } - - ServerID const serverId = TRI_ObjectToString(args[0]); - - if (ServerState::instance()->isDBServer()) { - arangodb::LogicalCollection const* v8Collection = - TRI_UnwrapClass(args.Holder(), - WRP_VOCBASE_COL_TYPE); - - if (v8Collection == nullptr) { - TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection"); - } - - std::string collectionName = v8Collection->name(); - auto collection = v8Collection->vocbase().lookupCollection(collectionName); - - if (collection == nullptr) { - TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND); - } - - collection->followers()->add(serverId); - } - - TRI_V8_RETURN_TRUE(); - TRI_V8_TRY_CATCH_END -} - -#endif - //////////////////////////////////////////////////////////////////////////////// /// @brief was docuBlock removeFollower //////////////////////////////////////////////////////////////////////////////// @@ -2856,10 +2809,6 @@ void TRI_InitV8Collections(v8::Handle context, JS_SetTheLeader, true); TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "getLeader"), JS_GetLeader, true); -#ifdef DEBUG_SYNC_REPLICATION - TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "addFollower"), - JS_AddFollower, true); -#endif TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "removeFollower"), JS_RemoveFollower, true); TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "getFollowers"), diff --git a/js/server/modules/@arangodb/sync-replication-debug.js b/js/server/modules/@arangodb/sync-replication-debug.js deleted file mode 100644 index 931abef466..0000000000 --- a/js/server/modules/@arangodb/sync-replication-debug.js +++ /dev/null @@ -1,43 +0,0 @@ -/* jshint strict: false */ -/* global ArangoServerState */ - -// ////////////////////////////////////////////////////////////////////////////// -// / DISCLAIMER -// / -// / Copyright 2017 ArangoDB GmbH, Cologne, Germany -// / -// / Licensed under the Apache License, Version 2.0 (the "License") -// / you may not use this file except in compliance with the License. -// / You may obtain a copy of the License at -// / -// / http://www.apache.org/licenses/LICENSE-2.0 -// / -// / Unless required by applicable law or agreed to in writing, software -// / distributed under the License is distributed on an "AS IS" BASIS, -// / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// / See the License for the specific language governing permissions and -// / limitations under the License. -// / -// / Copyright holder is triAGENS GmbH, Cologne, Germany -// / -// / @author Andreas Streichardt -// ////////////////////////////////////////////////////////////////////////////// - -exports.setup = function() { - global.ArangoServerState.enableSyncReplicationDebug(); - ArangoServerState.setRole('PRIMARY'); - global.ArangoAgency.set = function() { return true; }; - global.ArangoAgency.write = function() { return true; }; - global.ArangoAgency.increaseVersion = function() { return true; }; - global.ArangoAgency.get = function(path) { - let value = {}; - let pathSegments = path.split('/'); - let keyValue = 1; - value.arango = pathSegments.reverse().reduce((v, key) => { - let kv = {}; - kv[key] = v; - return kv; - }, keyValue); - return value; - }; -};