diff --git a/src/com/platform/http/gfs/SetVolume.java b/src/com/platform/http/gfs/SetVolume.java index 19d0e70b..b1242ff3 100644 --- a/src/com/platform/http/gfs/SetVolume.java +++ b/src/com/platform/http/gfs/SetVolume.java @@ -140,6 +140,7 @@ public class SetVolume { Map map = new HashMap(); map.put("volumeName", volumeName); //请求web + this.stopVolume(volumeName); String rest = ht.sendPost("gfs/deleteVolume", map); if (null == rest || "".equals(rest)) { log.error(" --- gluster is disconnect ! \n"); @@ -176,7 +177,7 @@ public class SetVolume { map.put("volumeName", volumeName); map.put("bricks", brickName); //请求web - String rest = ht.sendPost("gfs/addABricks", map); + String rest = ht.sendPost("gfs/addBricks", map); if (null == rest || "".equals(rest)) { log.error(" --- gluster is disconnect ! \n"); return 0; diff --git a/src/com/platform/service/OracleExtractHelper.java b/src/com/platform/service/OracleExtractHelper.java index 5f6a215a..bec4e858 100644 --- a/src/com/platform/service/OracleExtractHelper.java +++ b/src/com/platform/service/OracleExtractHelper.java @@ -292,21 +292,27 @@ public class OracleExtractHelper { + ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabaseName() + ")))\'"; if (null != oc) { - if (hasSameNameDBLink(conn, linkName, Configs.EXTRACT_LOG_LOCALTION + oc.getName()+".log")) { // 如果dblink已经存在,先删除dblink,在创建dblink + if (hasSameNameDBLink(conn, linkName, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()+".log")) { // 如果dblink已经存在,先删除dblink,在创建dblink String deleteSql = "DROP PUBLIC DATABASE LINK " + linkName; //删除 dblink - if (OracleConnector.execOracleSQL(conn, deleteSql, Configs.EXTRACT_LOG_LOCALTION + oc.getName())) { - OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName()); + if (OracleConnector.execOracleSQL(conn, deleteSql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())) { +// OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()); + if(!OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())){ + OracleConnector.execUpdateOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()); + } } else { Configs.CONSOLE_LOGGER.error("删除已有的DBLink失败,无法创建新的DBLink!"); - FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + FileOperateHelper.fileWrite(Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()+".log", "删除已有的DBLink失败,无法创建新的DBLink!"+"\r\n"); } } else { // 否则,创建dblink - OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_LOG_LOCALTION + oc.getName()); +// OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()); + if(!OracleConnector.execOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName())){ + OracleConnector.execUpdateOracleSQL(conn, sql, Configs.EXTRACT_STANDARD_LOG_LOCALTION + oc.getName()); + } } } } diff --git a/src/com/platform/service/impl/MoveDataServiceImpl.java b/src/com/platform/service/impl/MoveDataServiceImpl.java index 9131b508..de250758 100644 --- a/src/com/platform/service/impl/MoveDataServiceImpl.java +++ b/src/com/platform/service/impl/MoveDataServiceImpl.java @@ -164,6 +164,7 @@ public class MoveDataServiceImpl implements IMoveDataService { dataMove.setDstVolumePath(path); dataMove.setDstVolumeIp(ip); } + dataMove.setCompleteStatus("0"); moveList.add(dataMove); } if (moveList.size() > 0) { diff --git a/src/com/platform/service/impl/OracleExtractServiceImpl.java b/src/com/platform/service/impl/OracleExtractServiceImpl.java index b34e2c56..525be17f 100644 --- a/src/com/platform/service/impl/OracleExtractServiceImpl.java +++ b/src/com/platform/service/impl/OracleExtractServiceImpl.java @@ -70,25 +70,25 @@ public class OracleExtractServiceImpl implements IOracleExtractService { return false; } for (OracleConnectorParams collectOracle : datainfos) { - + String replicasName = collectOracle.getName(); + try{ if(null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())){ DataInfoEntity data = new DataInfoEntity(); data.setId(Integer.valueOf(collectOracle.getDataId())); data.setExtractStatus(1); dataInfoDao.updateExtract(data); - String replicasName = collectOracle.getName(); collectOracle.setName("J" + collectOracle.getName().replace("-", "_")); - String cmd = "kubectl label --overwrite rc " + String cmd = "kubectl label --overwrite rc " + replicasName + " isExtract=1"; + //sql日志记录时间: + FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + + collectOracle.getName()+".log", "\r\n 开始汇总 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n"); List rList = Constant.ganymedSSH .execCmdWaitAcquiescent(cmd); StringBuffer sb = new StringBuffer(); for (String string : rList) sb.append(string).append("\n"); Configs.CONSOLE_LOGGER.info(sb.toString()); - //sql日志记录时间: - FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION - + collectOracle.getName()+".log", "\r\n\r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n"); // client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "1"); //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成 oracleExtract.createDBLink(conn, collectOracle); //创建dblink oracleExtract.createTableSpace(conn, collectOracle, oracleModel); //创建表空间 @@ -105,6 +105,17 @@ public class OracleExtractServiceImpl implements IOracleExtractService { data.setExtractStatus(2); dataInfoDao.updateExtract(data); } + }catch(Exception e){ + log.error(Custom4exception.OracleSQL_Except, e); + } + finally{ + //sql日志记录时间: + FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + + collectOracle.getName()+".log", "\r\n 汇总结束 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n"); + String cmd = "kubectl label --overwrite rc " + + replicasName + " isExtract=2"; + Constant.ganymedSSH.execCmdWaitAcquiescent(cmd); + } } isSuccess = true; }catch(Exception e){ @@ -149,6 +160,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService { return false; } for (OracleConnectorParams collectOracle : datainfos) { + String replicasName = collectOracle.getName(); try{ if(null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())){ DataInfoEntity data = new DataInfoEntity(); @@ -157,19 +169,18 @@ public class OracleExtractServiceImpl implements IOracleExtractService { data.setCheckoutFlag(Constant.CHECKOUTFLAG_SIX); data.setStandardExtractStatus("1"); dataInfoDao.update(data); - String replicasName = collectOracle.getName(); collectOracle.setName("CQ" + collectOracle.getName().replace("-", "_")); String cmd = "kubectl annotate --overwrite rc " + replicasName + " standardExtractStatus=1"; + //sql日志记录时间: + FileOperateHelper.fileWrite(Configs.EXTRACT_STANDARD_LOG_LOCALTION + + collectOracle.getName()+".log", "\r\n 开始抽取标准表 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n"); List rList = Constant.ganymedSSH .execCmdWaitAcquiescent(cmd); StringBuffer sb = new StringBuffer(); for (String string : rList) sb.append(string).append("\n"); Configs.CONSOLE_LOGGER.info(sb.toString()); - //sql日志记录时间: - FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION - + collectOracle.getName()+".log", "\r\n\r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n"); // client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "1"); //更新oracle汇总状态,0标示为未汇总,1标示汇总中,2标示汇总完成 oracleExtract.createStandardDBLink(conn, collectOracle); //创建dblink oracleExtract.createTableSpace(conn, collectOracle, oracleModel); //创建表空间 @@ -233,6 +244,14 @@ public class OracleExtractServiceImpl implements IOracleExtractService { }catch(Exception e){ log.error(Custom4exception.OracleSQL_Except, e); } + finally{ + //sql日志记录时间: + FileOperateHelper.fileWrite(Configs.EXTRACT_STANDARD_LOG_LOCALTION + + collectOracle.getName()+".log", "\r\n 抽取标准表结束 \r\n"+ DateForm.date2StringBysecond(new Date()) +"\r\n"); + String cmd = "kubectl annotate --overwrite rc " + + replicasName + " standardExtractStatus=2"; + Constant.ganymedSSH.execCmdWaitAcquiescent(cmd); + } } isSuccess = true; }catch(Exception e){ diff --git a/src/com/platform/service/thread/ThreadMoveData.java b/src/com/platform/service/thread/ThreadMoveData.java index 8da2fd12..6873c4eb 100644 --- a/src/com/platform/service/thread/ThreadMoveData.java +++ b/src/com/platform/service/thread/ThreadMoveData.java @@ -77,20 +77,6 @@ public class ThreadMoveData{ log.error(e); } Map taskMap = new HashMap(); - if (result.size() > 0) { - List list = new ArrayList(); - try { - list = copy.operationTask(); - } catch (Exception e) { - log.error("copy.operationTask()"); - log.error(e); - } - for (TaskOperateData taskOperateData : list) { - taskMap.put(FileOperateHelper.addLastLinuxSeparator(taskOperateData.getSourcePath()) - + "-" + FileOperateHelper.addLastLinuxSeparator(taskOperateData.getDestPath()), - taskOperateData); - } - } for ( DataInfoEntityMoveTmp moveE : result) { switch (moveE.getCompleteStatus()) { //待迁移 @@ -119,6 +105,20 @@ public class ThreadMoveData{ //正则迁移 status = 1:表示正在迁移(如果 web gfs 迁移成功 则 增加一条记录) if(subMove[1].size() > 0){ + //请求进度 + List list = new ArrayList(); + try { + list = copy.operationTask(); + } catch (Exception e) { + log.error("copy.operationTask()"); + log.error(e); + } + for (TaskOperateData taskOperateData : list) { + taskMap.put(FileOperateHelper.addLastLinuxSeparator(taskOperateData.getSourcePath()) + + "-" + FileOperateHelper.addLastLinuxSeparator(taskOperateData.getDestPath()), + taskOperateData); + } + for (DataInfoEntityMoveTmp moveE : subMove[1]) { TaskOperateData taskOne = taskMap.get(FileOperateHelper.addLastLinuxSeparator(moveE.getDataPath()) +"-"+FileOperateHelper.addLastLinuxSeparator(makeDstPath(moveE.getDstPath())));