Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ This software is provided as-is, without warranty of any kind or commercial supp

### <a id="license"></a>License

This is code is licensed under the Apache License 2.0. Full license is available [here](./LICENSE).
This is code is licensed under the Apache License 2.0. Full license is available [here](./LICENSE)
391 changes: 0 additions & 391 deletions mysql_artifact_v2.0.26.json

This file was deleted.

2 changes: 1 addition & 1 deletion plugin_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ pluginType: STAGED
entryPoint: plugin_runner:plugin
srcDir: src
schemaFile: schema.json
buildNumber: 2.0.26
buildNumber: 2.1.0
27 changes: 22 additions & 5 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@
"prettyName": "DB User",
"description": "DB user for the virtual database",
"default": "delphixdb"
},
},
"vdbPass": {
"type": "string",
"format": "password",
"pattern" : "^[^\"\\'\\s]*$",
"prettyName": "DB Password",
"description": "DB user password for the virtual database",
"description": "DB user password for the virtual database. Double quote, single quote or space characters are not valid.",
"default": "Delphix@123"
},
"baseDir": {
Expand Down Expand Up @@ -199,8 +200,9 @@
"sourcePass": {
"type": "string",
"format": "password",
"pattern" : "^[^\"\\'\\s]*$",
"prettyName": "Source Connection Password",
"description": "* Required if Delphix is taking backups",
"description": "* Required if Delphix is taking backups. Double quote, single quote or space characters are not valid.",
"default": "Delphix@123"
},
"databaseList": {
Expand All @@ -224,15 +226,17 @@
"replicationPass": {
"type": "string",
"format": "password",
"pattern" : "^[^\"\\'\\s]*$",
"prettyName": "Replication User's Password",
"description": "* Required if using Replication Method with LogSync",
"description": "* Required if using Replication Method with LogSync. Double quote, single quote or space characters are not valid.",
"default": "Delphix@123"
},
"stagingPass": {
"type": "string",
"format": "password",
"pattern" : "^[^\"\\'\\s]*$",
"prettyName": "Staging Initialization Password",
"description": "root user password to use while initializing Staging DB.",
"description": "root user password to use while initializing Staging DB. Double quote, single quote or space characters are not valid.",
"default": "Delphix@123"
},
"serverId": {
Expand Down Expand Up @@ -306,5 +310,18 @@
"description": "Time when the snapshot was taken."
}
}
},
"snapshotParametersDefinition": {
"type" : "object",
"additionalProperties" : false,
"required": ["resync"],
"properties" : {
"resync" : {
"type": "boolean",
"default": true,
"prettyName": "Resynchronize dSource",
"description": "Before taking a snapshot will refresh the staging database to update its data. Unselect this option if you wish to snapshot the staging database in its current state."
}
}
}
}
4 changes: 4 additions & 0 deletions src/common/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#
# Copyright (c) 2021, 2023 by Delphix. All rights reserved.
#

import logging
import random
import time
Expand Down
20 changes: 9 additions & 11 deletions src/dboperations/dboperations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#
# Copyright (c) 2021, 2023 by Delphix. All rights reserved.
#

import logging
import random
import time
Expand Down Expand Up @@ -37,7 +41,6 @@ def stop_mysql(port,connection,baseDir,vdbConn,pwd):
if(port_stat == Status.ACTIVE):
logger.debug("DB is Running. Shutting down.")
shutdown_cmd = "%s/bin/mysqladmin %s'%s' --protocol=TCP --port=%s shutdown" % (baseDir,vdbConn,pwd,port)
logger.debug("Shutdown Command: {}".format(shutdown_cmd))
result = libs.run_bash(connection, shutdown_cmd,environment_vars,check=True)
output = result.stdout.strip()
error = result.stderr.strip()
Expand All @@ -46,7 +49,7 @@ def stop_mysql(port,connection,baseDir,vdbConn,pwd):
logger.debug("There was an error trying to shutdown the database : "+error)
raise MySQLShutdownException(error)
else:
logger.debug("Output: "+output)
logger.debug("DB shutdown completed")
time.sleep(25)
if(Status.ACTIVE == get_port_status(port,connection)):
logger.debug("KILL")
Expand Down Expand Up @@ -97,7 +100,6 @@ def get_port_status(port,connection):
except Exception as err:
logger.debug("Port Check Failed for second cmd: "+err.message)
logger.debug("Port Status Response >")
logger.debug(output)

if output== "":
logger.debug("MySQL DB is NOT RUNNING at Port:"+myport)
Expand Down Expand Up @@ -130,7 +132,6 @@ def start_mysql(installPath,baseDir,mountPath,port,serverId,connection):
if(port_stat == Status.INACTIVE):
logger.debug("DB is not running. Starting the MySQL DB")
start_cmd=get_start_cmd(installPath,baseDir,mountPath,port,serverId)
logger.debug("Startup Command: {}".format(start_cmd))
result = libs.run_bash(connection, start_cmd,environment_vars,check=True)
output = result.stdout.strip()
error = result.stderr.strip()
Expand All @@ -139,7 +140,7 @@ def start_mysql(installPath,baseDir,mountPath,port,serverId,connection):
logger.debug("There was an error trying to start the DB : "+error)
raise MySQLStartupException(error)
else:
logger.debug("Output: "+output)
logger.debug("DB Started")
time.sleep(25)
if(Status.ACTIVE == get_port_status(port,connection)):
logger.debug("DB Started Successfully")
Expand Down Expand Up @@ -168,12 +169,11 @@ def start_slave(connection,installPath,port,connString,username,pwd,hostIp):
raise Exception("One of the required params for MySQL Connection is empty")
else:
start_slave_cmd=CommandFactory.start_replication(connection,installPath,port,connString,username,pwd,hostIp)
logger.debug("Connection String with {}".format(start_slave_cmd))
try:
logger.debug("Starting Slave")
result = libs.run_bash(connection, start_slave_cmd,environment_vars,check=True)
output = result.stdout.strip()
logger.debug("Start Slave Output: {}".format(output))
logger.debug("Start Slave Completed")
except Exception as err:
logger.debug("Starting Slave Failed: "+err.message)
raise err
Expand All @@ -187,17 +187,16 @@ def stop_slave(connection,installPath,port,connString,username,pwd,hostIp):
raise Exception("One of the required params for MySQL Connection is empty")
else:
stop_slave_cmd=CommandFactory.stop_replication(connection,installPath,port,connString,username,pwd,hostIp)
logger.debug("Connection String with {}".format(stop_slave_cmd))
try:
logger.debug("Stopping Replication")
result = libs.run_bash(connection, stop_slave_cmd,environment_vars,check=True)
_output=result.stdout.strip()
_bashErrMsg=result.stderr.strip()
_bashErrCode=result.exit_code
if _bashErrCode!=0:
logger.debug("Stopping Slave was not succesful")
logger.debug("Stopping Slave was not successful")
raise Exception(_bashErrMsg)
logger.debug("Start Slave Response: {}".format(_output))
logger.debug("Stop Replication successful")
except Exception as err:
logger.debug("Stop Replication Failed Due To: "+err.message)
logger.debug("Ignoring and continuing")
Expand All @@ -213,7 +212,6 @@ def get_connection_cmd(installPath,port,connString,username,pwd,hostIp):
raise ValueError("One of the required params for MySQL Connection is empty")
else:
connection_cmd=CommandFactory.connect_to_mysql(installPath,port,connString,username,pwd,hostIp)
logger.debug("connaction_cmd >"+connection_cmd)
return connection_cmd

def get_start_cmd(installPath,baseDir,mountPath,port,serverId):
Expand Down
16 changes: 8 additions & 8 deletions src/plugin_runner.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#
# Copyright (c) 2021, 2023 by Delphix. All rights reserved.
#

import pkgutil
import logging
import sys
Expand Down Expand Up @@ -75,16 +79,16 @@ def stop_staging(staged_source, repository, source_config):
pluginops.stop_staging(staged_source, repository, source_config)

@plugin.linked.pre_snapshot()
def linked_pre_snapshot(staged_source, repository, source_config, snapshot_parameters):
def linked_pre_snapshot(staged_source, repository, source_config, optional_snapshot_parameters):
logger.debug("linked_pre_snapshot > Start ")
# Start Staging if not already running.
pluginops.linked_pre_snapshot(staged_source, repository, source_config, snapshot_parameters)
pluginops.linked_pre_snapshot(staged_source, repository, source_config, optional_snapshot_parameters)
logger.debug(" linked_pre_snapshot > End ")

@plugin.linked.post_snapshot()
def linked_post_snapshot(staged_source,repository,source_config,snapshot_parameters):
def linked_post_snapshot(staged_source,repository,source_config,optional_snapshot_parameters):
logger.debug("linked_post_snapshot - Start ")
snapshot = pluginops.linked_post_snapshot(staged_source,repository,source_config,snapshot_parameters)
snapshot = pluginops.linked_post_snapshot(staged_source,repository,source_config,optional_snapshot_parameters)
linked_status(staged_source, repository, source_config)
logger.debug("linked_post_snapshot - End ")
return snapshot
Expand All @@ -105,9 +109,6 @@ def configure(virtual_source, snapshot, repository):
def reconfigure(virtual_source, repository, source_config, snapshot):
logger.debug("virtual.reconfigure > Start")
start(virtual_source, repository, source_config)
logger.debug(source_config)
logger.debug("Snapshot")
logger.debug(snapshot)
#srcConfig = configure(virtual_source,snapshot,repository)
logger.debug("virtual.reconfigure > End")
virtual_status(virtual_source, repository, source_config)
Expand Down Expand Up @@ -140,7 +141,6 @@ def virtual_post_snapshot(virtual_source, repository, source_config):
snapshot.snap_backup_path=""
snapshot.snap_time=utils.get_current_time()
logger.debug("SnapShot Definition Created")
logger.debug(snapshot)
return snapshot

@plugin.virtual.start()
Expand Down
Loading