Skip to content

Sre 2935 #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
dfd9926
Added to circle ci
ikapriz-objectrocket Dec 20, 2018
d991419
Use variables
ikapriz-objectrocket Dec 20, 2018
971eb84
Use variables
ikapriz-objectrocket Dec 20, 2018
026b0a6
Try to create new version
ikapriz-objectrocket Dec 20, 2018
e7e63c2
Try to create new version
ikapriz-objectrocket Dec 20, 2018
ee10cf4
Try to create new version
ikapriz-objectrocket Dec 20, 2018
44ec5d8
Try to create new version
ikapriz-objectrocket Dec 20, 2018
47af8e6
Try to create new version
ikapriz-objectrocket Dec 20, 2018
dbdd505
Try to create new version
ikapriz-objectrocket Dec 20, 2018
3788dc6
Try to create new version
ikapriz-objectrocket Dec 20, 2018
8d1719f
Save directory
ikapriz-objectrocket Dec 20, 2018
6026ab4
Save directory
ikapriz-objectrocket Dec 20, 2018
ace9a27
Tag the build
ikapriz-objectrocket Dec 20, 2018
7cccdea
Added logic to check for exitcode
ikapriz-objectrocket Jan 2, 2019
5b624ce
Added logic to check for exitcode
ikapriz-objectrocket Jan 3, 2019
fdd1abd
Added logic to check for exitcode
ikapriz-objectrocket Jan 3, 2019
dc4c8ae
Added logic to check for exitcode
ikapriz-objectrocket Jan 3, 2019
3d308ba
Added logic to check for exitcode
ikapriz-objectrocket Jan 3, 2019
b42c968
use different container
ikapriz-objectrocket Jan 3, 2019
cf34db5
use different container
ikapriz-objectrocket Jan 3, 2019
e486c3d
use different container
ikapriz-objectrocket Jan 3, 2019
556be88
use different container
ikapriz-objectrocket Jan 3, 2019
428d25b
use different container
ikapriz-objectrocket Jan 3, 2019
16c9650
use different container
ikapriz-objectrocket Jan 3, 2019
0b3d1c9
use different container
ikapriz-objectrocket Jan 3, 2019
0b46800
use different container
ikapriz-objectrocket Jan 3, 2019
16a2162
use different container
ikapriz-objectrocket Jan 3, 2019
de6709e
use different container
ikapriz-objectrocket Jan 3, 2019
17494ed
use different container
ikapriz-objectrocket Jan 3, 2019
795af15
use different container
ikapriz-objectrocket Jan 3, 2019
e5db015
use different container
ikapriz-objectrocket Jan 3, 2019
6002b56
use different container
ikapriz-objectrocket Jan 3, 2019
18f4098
use different container
ikapriz-objectrocket Jan 3, 2019
ac0ebac
use different container
ikapriz-objectrocket Jan 3, 2019
5e9a3df
Increased timeout
ikapriz-objectrocket Jan 3, 2019
7d7e68f
Increased timeout
ikapriz-objectrocket Jan 3, 2019
a230063
Merge pull request #3 from objectrocket/SRE-2645-fix-race-condition
ikapriz-objectrocket Jan 3, 2019
5346fa4
Revert the check for the loops logic as it seems to never be executed
ikapriz-objectrocket Jan 7, 2019
687d621
Merge pull request #4 from objectrocket/SRE-2645-revert-logic
ikapriz-objectrocket Jan 7, 2019
4380fcb
Determine the hanging location
ikapriz-objectrocket Jan 8, 2019
e8fdc1f
Added check for stopped cursor
ikapriz-objectrocket Jan 8, 2019
7f2c18d
Added check for stopped cursor
ikapriz-objectrocket Jan 8, 2019
50136eb
Connect to a single instance not replica
ikapriz-objectrocket Jan 9, 2019
b1aace6
Fix the object
ikapriz-objectrocket Jan 9, 2019
e1376fd
Fix the object
ikapriz-objectrocket Jan 9, 2019
1b51991
Merge pull request #5 from objectrocket/SRE-2645-added-more-loging
ikapriz-objectrocket Jan 14, 2019
dc47655
added more logging
ikapriz-objectrocket Feb 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
- image: objectrocket/circleci-rpm-builder:master
auth:
username: $DOCKER_USER
password: $DOCKER_PASS

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

environment:
PYTHON_BIN: /usr/local/bin/python2.7
working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run:
name: set version and build the rpm
command: |
set -x
version=$(cat VERSION)
echo "${version}.${CIRCLE_BUILD_NUM}" > VERSION
make rpm

git config user.email "dev@objectrocket.com"
git config user.name "objectrocketdev"
git tag -a $(cat VERSION) -m "Tagged by ${CIRCLE_BUILD_URL}" HEAD
rpm -qa | grep ssh
rpm -ql libssh2-1.4.2-2.el6_7.1.x86_64
git push --tags origin

mkdir mongodb_consistent_backup_rpm
cp /root/repo/build/rpm/RPMS/x86_64/mongodb_consistent_backup-$(cat VERSION)-1.el6.x86_64.rpm mongodb_consistent_backup_rpm/

- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}

- store_artifacts:
path: mongodb_consistent_backup_rpm
destination: mongodb_consistent_backup

Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def run(self):
if os.path.isdir(self.dump_dir):
rmtree(self.dump_dir)
os.makedirs(self.dump_dir)
logging.debug("Running mongodump cmd: %s" % " ".join(mongodump_cmd))
logging.info("Running mongodump cmd: %s" % " ".join(mongodump_cmd))
self._process = Popen(mongodump_cmd, stdin=PIPE, stderr=PIPE)
self.wait()
self.exit_code = self._process.returncode
Expand Down
2 changes: 1 addition & 1 deletion mongodb_consistent_backup/Common/DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse_read_pref_tags(tags_str):

class DB:
def __init__(self, uri, config, do_replset=False, read_pref='primaryPreferred', do_rp_tags=False,
do_connect=True, conn_timeout=5000, retries=5):
do_connect=True, conn_timeout=60000, retries=5):
self.uri = uri
self.config = config
self.do_replset = do_replset
Expand Down
2 changes: 2 additions & 0 deletions mongodb_consistent_backup/Oplog/Resolver/Resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,7 @@ def run(self):
self.stopped = True

for shard in self.resolver_state:
logging.info("Getting shard oplog state %s" % (shard))
self.resolver_summary[shard] = self.resolver_state[shard].get()
logging.info("Returning self.resolver_summary")
return self.resolver_summary
5 changes: 3 additions & 2 deletions mongodb_consistent_backup/Oplog/Tailer/TailThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def status(self):

def connect(self):
if not self.db:
self.db = DB(self.uri, self.config, True, 'secondary', True)
self.db = DB(self.uri, self.config, False, 'secondary', True)
return self.db.connection()

def run(self):
Expand Down Expand Up @@ -146,7 +146,7 @@ def run(self):
sleep(1)
finally:
if self._cursor:
logging.debug("Stopping oplog cursor on %s" % self.uri)
logging.info("Stopping oplog cursor on %s" % self.uri)
self._cursor.close()
except OperationError, e:
logging.error("Tailer %s encountered error: %s" % (self.uri, e))
Expand All @@ -169,6 +169,7 @@ def run(self):
self.stopped = True
self.state.set('running', False)
self.timer.stop(self.timer_name)
logging.info("Thread is stopped and marked as stopped %s" % self.uri)

if self.exit_code == 0:
log_msg_extra = "%i oplog changes" % self.count
Expand Down
4 changes: 2 additions & 2 deletions mongodb_consistent_backup/Oplog/Tailer/Tailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def stop(self, kill=False, sleep_secs=3):
logging.warning("Could not get current optime from PRIMARY! Using now as a stop time")
timestamp = Timestamp(int(time()), 0)

# wait for replication to get in sync
while state.get('last_ts') and state.get('last_ts') < timestamp:
# wait for replication to get in sync making sure cursor has not been stopped in a race condition
while state.get('last_ts') and state.get('last_ts') < timestamp and not self.shards[shard]['thread'].stopped:
logging.info('Waiting for %s tailer to reach ts: %s, currrent: %s' % (uri, timestamp, state.get('last_ts')))
sleep(sleep_secs)

Expand Down
4 changes: 2 additions & 2 deletions scripts/mongodb_consistent_backup.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Prefix: /usr

# Use CentOS SCL python27 (https://www.softwarecollections.org/en/scls/rhscl/python27/) on CentOS 6 (RHEL6 untested)
# On build host: 'yum install python27-python python27-python-devel python27-python-virtualenv gcc make libffi-devel openssl-devel'
%{?el6:Requires: python27-python openssl-libs}
%{?el6:BuildRequires: python27-python python27-python-devel python27-python-virtualenv gcc make libffi-devel openssl-devel}
#%{?el6:Requires: openssl-libs}
%{?el6:BuildRequires: gcc make libffi-devel openssl-devel}

# Use base python/virtualenv, which should be 2.7 on CentOS/RHEL 7
# On build host: 'yum install python python-devel python-virtualenv gcc make libffi-devel openssl-devel'
Expand Down