stefan-egli commented on code in PR #753: URL: https://github.com/apache/jackrabbit-oak/pull/753#discussion_r1022866535
########## oak-run/src/main/js/oak-mongo.js: ########## @@ -452,6 +452,70 @@ var oak = (function(global){ } }; + /** + * Removes all unmerged branches on the document with the given path and + * clusterId. This method will only remove unmerged branches when the + * clusterId is inactive. + * + * @memberof oak + * @method removeUnmergedBranches + * @param {string} path the path of a document + * @param {number} clusterId collision markers for this clusterId will be removed. + * @param {number} [limit=1000000] maximum number of unmerged branches to remove. + * @returns {object} the result of the MongoDB update. + */ + api.removeUnmergedBranches = function(path, clusterId, limit) { + if (path === undefined) { + print("No path specified"); + return; + } + if (clusterId === undefined) { + print("No clusterId specified"); + return; + } + if (limit === undefined) { + limit = 1000000; + } + // refuse to remove when clusterId is marked active + var clusterNode = db.clusterNodes.findOne({_id: clusterId.toString()}); + if (clusterNode && clusterNode.state == "ACTIVE") { + print("Cluster node with id " + clusterId + " is active!"); + print("Can only remove unmerged branches for inactive cluster node."); + return; + } Review Comment: +1, sounds good -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org