presto-main/src/main/java/io/prestosql/execution/resourcegroups/StochasticPriorityQueue.java/Node/remove
class Node:        public void remove()
        {
            checkState(parent.isPresent(), "Cannot remove root node");
            checkState(isLeaf(), "Can only remove leaf nodes");
            Node<E> parent = this.parent.get();
            if (parent.getRight().map(node -> node.equals(this)).orElse(false)) {
                parent.right = Optional.empty();
            }
            else {
                checkState(parent.getLeft().map(node -> node.equals(this)).orElse(false), "Inconsistent parent pointer");
                parent.left = Optional.empty();
            }
            while (parent != null) {
                parent.descendants--;
                parent.totalTickets -= tickets;
                parent = parent.parent.orElse(null);
            }
            this.parent = Optional.empty();
        }