Commit 87a1636d authored by Claes Sjofors's avatar Claes Sjofors

Mysql classvolume databases

parent 0bf0dc63
...@@ -150,4 +150,5 @@ ...@@ -150,4 +150,5 @@
091208 cs wb Default name for created objects in wtt fetched from name of previous sibling. 091208 cs wb Default name for created objects in wtt fetched from name of previous sibling.
091209 cs wb ConnectAttribute method added to SevHist. 091209 cs wb ConnectAttribute method added to SevHist.
091218 cs wb Bugfix for next cix and next oix in ced. 091218 cs wb Bugfix for next cix and next oix in ced.
091218 cs wb Bugfix in wb_vrepdb:child(). 091218 cs wb Bugfix in wb_vrepdb:child().
\ No newline at end of file 100111 cs wb Mysql classvolume databases.
\ No newline at end of file
...@@ -2765,7 +2765,7 @@ WttGtk::WttGtk( ...@@ -2765,7 +2765,7 @@ WttGtk::WttGtk(
wnavnode->volume_attached( wbctx, ldhses, 0); wnavnode->volume_attached( wbctx, ldhses, 0);
} }
if ( wb_type == wb_eType_Directory || wb_type == wb_eType_Volume) { if ( (wb_type == wb_eType_Directory || wb_type == wb_eType_Volume) && ldhses) {
// Start configuration wizard if volume is empty // Start configuration wizard if volume is empty
pwr_tOid oid; pwr_tOid oid;
......
...@@ -1501,6 +1501,15 @@ int wb_dbms_rbody::ins(wb_dbms_txn *txn) ...@@ -1501,6 +1501,15 @@ int wb_dbms_rbody::ins(wb_dbms_txn *txn)
return m_db->m_t_rbody->ins(txn, &m_key, &m_data); return m_db->m_t_rbody->ins(txn, &m_key, &m_data);
} }
int wb_dbms_rbody::ins(wb_dbms_txn *txn, size_t offset, size_t size, void *p)
{
m_data.bSize(size);
m_data.size(size);
m_data.data(p);
return m_db->m_t_rbody->ins(txn, &m_key, &m_data);
}
int wb_dbms_rbody::upd(wb_dbms_txn *txn, size_t offset, size_t size, void *p) int wb_dbms_rbody::upd(wb_dbms_txn *txn, size_t offset, size_t size, void *p)
{ {
m_data.size(sizeof(m_db->m_buf)); m_data.size(sizeof(m_db->m_buf));
...@@ -1537,6 +1546,7 @@ int wb_dbms_rbody::get(wb_dbms_txn *txn, size_t offset, size_t size, void *p) ...@@ -1537,6 +1546,7 @@ int wb_dbms_rbody::get(wb_dbms_txn *txn, size_t offset, size_t size, void *p)
memcpy(p, m_db->m_buf + offset, size); memcpy(p, m_db->m_buf + offset, size);
m_size = m_data.size();
return 0; return 0;
} }
...@@ -1630,6 +1640,15 @@ int wb_dbms_dbody::ins(wb_dbms_txn *txn) ...@@ -1630,6 +1640,15 @@ int wb_dbms_dbody::ins(wb_dbms_txn *txn)
return m_db->m_t_dbody->ins(txn, &m_key, &m_data); return m_db->m_t_dbody->ins(txn, &m_key, &m_data);
} }
int wb_dbms_dbody::ins(wb_dbms_txn *txn, size_t offset, size_t size, void *p)
{
m_data.bSize(size);
m_data.size(size);
m_data.data(p);
return m_db->m_t_rbody->ins(txn, &m_key, &m_data);
}
int wb_dbms_dbody::upd(wb_dbms_txn *txn, size_t offset, size_t size, void *p) int wb_dbms_dbody::upd(wb_dbms_txn *txn, size_t offset, size_t size, void *p)
{ {
m_data.size(sizeof(m_db->m_buf)); m_data.size(sizeof(m_db->m_buf));
...@@ -1663,6 +1682,7 @@ int wb_dbms_dbody::get(wb_dbms_txn *txn, size_t offset, size_t size, void *p) ...@@ -1663,6 +1682,7 @@ int wb_dbms_dbody::get(wb_dbms_txn *txn, size_t offset, size_t size, void *p)
printf("*** dbody::get(offset %zd, size %zd, oix %d), size: %zd\n", offset, size, m_oid.oix, m_data.size()); printf("*** dbody::get(offset %zd, size %zd, oix %d), size: %zd\n", offset, size, m_oid.oix, m_data.size());
memcpy(p, m_db->m_buf + offset, size); memcpy(p, m_db->m_buf + offset, size);
m_size = m_data.size();
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -886,8 +886,10 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -886,8 +886,10 @@ pwr_tStatus lfu_SaveDirectoryVolume(
"Database", (char **) &dbenum, &size); "Database", (char **) &dbenum, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if (( cdh_isClassVolumeClass(cid) && *dbenum == 2) || if (( (cid == pwr_cClass_ClassVolumeConfig ||
( !cdh_isClassVolumeClass(cid) && *dbenum == 1)) { cid == pwr_cClass_DetachedClassVolumeConfig) && *dbenum == 2) ||
( !(cid == pwr_cClass_ClassVolumeConfig ||
cid == pwr_cClass_DetachedClassVolumeConfig) && *dbenum == 1)) {
sts = ldh_GetObjectPar( ldhses, envobjid, "RtBody", sts = ldh_GetObjectPar( ldhses, envobjid, "RtBody",
"Server", (char **) &server, &size); "Server", (char **) &server, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -2635,6 +2637,8 @@ pwr_tStatus lfu_GetVolumeCnf( char *name, pwr_tVid *vid, pwr_tCid *cid, ldh_eVol ...@@ -2635,6 +2637,8 @@ pwr_tStatus lfu_GetVolumeCnf( char *name, pwr_tVid *vid, pwr_tCid *cid, ldh_eVol
*volrep = ldh_eVolRep_Dbms; *volrep = ldh_eVolRep_Dbms;
if ( nr > 5) if ( nr > 5)
strcpy( server, vol_array[5]); strcpy( server, vol_array[5]);
else
strcpy( server, "");
} }
} }
break; break;
...@@ -2648,6 +2652,8 @@ pwr_tStatus lfu_GetVolumeCnf( char *name, pwr_tVid *vid, pwr_tCid *cid, ldh_eVol ...@@ -2648,6 +2652,8 @@ pwr_tStatus lfu_GetVolumeCnf( char *name, pwr_tVid *vid, pwr_tCid *cid, ldh_eVol
*volrep = ldh_eVolRep_Dbms; *volrep = ldh_eVolRep_Dbms;
if ( nr > 5) if ( nr > 5)
strcpy( server, vol_array[5]); strcpy( server, vol_array[5]);
else
strcpy( server, "");
} }
} }
break; break;
......
...@@ -2558,7 +2558,7 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2558,7 +2558,7 @@ void wb_vrepced::printStructFile( bool hpp)
if ( !body_found) { if ( !body_found) {
fp << fp <<
"#ifndef pwr_cClass_" << pgmname << endl << "#ifndef pwr_cClass_" << pgmname << endl <<
"#define pwr_cClass_" << pgmname << " " << o_cdef->cid() << "UL" << endl << endl; "#define pwr_cClass_" << pgmname << " " << cdh_ClassObjidToId( o_cdef->oid()) << "UL" << endl << endl;
body_found = true; body_found = true;
} }
......
...@@ -300,7 +300,7 @@ wb_orep* wb_vrepdbms::object(pwr_tStatus *sts, pwr_tOid oid) ...@@ -300,7 +300,7 @@ wb_orep* wb_vrepdbms::object(pwr_tStatus *sts, pwr_tOid oid)
} }
catch (wb_dbms_error &e) { catch (wb_dbms_error &e) {
*sts = LDH__NOSUCHOBJ; *sts = LDH__NOSUCHOBJ;
printf("vrepdbms: %s\n", e.what().c_str()); // printf("vrepdbms: %s\n", e.what().c_str());
return 0; return 0;
} }
} }
...@@ -329,7 +329,7 @@ wb_orep* wb_vrepdbms::object(pwr_tStatus *sts, wb_name &name) ...@@ -329,7 +329,7 @@ wb_orep* wb_vrepdbms::object(pwr_tStatus *sts, wb_name &name)
} }
catch (wb_dbms_error &e) { catch (wb_dbms_error &e) {
*sts = LDH__NOSUCHOBJ; *sts = LDH__NOSUCHOBJ;
printf("vrepdbms: %s\n", e.what().c_str()); // printf("vrepdbms: %s\n", e.what().c_str());
return 0; return 0;
} }
} }
...@@ -344,7 +344,7 @@ wb_orep* wb_vrepdbms::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &n ...@@ -344,7 +344,7 @@ wb_orep* wb_vrepdbms::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &n
} }
catch (wb_dbms_error &e) { catch (wb_dbms_error &e) {
*sts = LDH__NOSUCHOBJ; *sts = LDH__NOSUCHOBJ;
printf("vrepdbms: %s\n", e.what().c_str()); // printf("vrepdbms: %s\n", e.what().c_str());
return 0; return 0;
} }
} }
...@@ -706,7 +706,6 @@ bool wb_vrepdbms::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name) ...@@ -706,7 +706,6 @@ bool wb_vrepdbms::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name)
n.name(name); n.name(name);
rc = n.ins(txn); rc = n.ins(txn);
if (rc) { if (rc) {
printf("wb_vrepdbms::renameObject, n.ins rc %d\n", rc);
*sts = LDH__NAMALREXI; *sts = LDH__NAMALREXI;
txn->abort(); txn->abort();
m_ohead.clear(); m_ohead.clear();
...@@ -721,9 +720,9 @@ bool wb_vrepdbms::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name) ...@@ -721,9 +720,9 @@ bool wb_vrepdbms::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name)
} }
catch (wb_dbms_error &e) { catch (wb_dbms_error &e) {
txn->subAbort(); txn->subAbort();
printf("wb_vrepdbms::renameObject, exception %s\n", e.what().c_str()); // printf("wb_vrepdbms::renameObject, exception %s\n", e.what().c_str());
m_ohead.clear(); m_ohead.clear();
*sts = LDH__DBERROR; *sts = LDH__NAMALREXI;
return false; return false;
} }
} }
...@@ -2239,7 +2238,12 @@ wb_vrepdbms::updateObject(pwr_tOid oid, pwr_tCid cid) ...@@ -2239,7 +2238,12 @@ wb_vrepdbms::updateObject(pwr_tOid oid, pwr_tCid cid)
time_GetTime( &time); time_GetTime( &time);
if (rbody) { if (rbody) {
rc = rb.upd(m_db->m_txn, 0, rsize, rbody); if ( rsize != rb.m_size) {
rc = rb.del(m_db->m_txn);
rc = rb.ins(m_db->m_txn, 0, rsize, rbody);
}
else
rc = rb.upd(m_db->m_txn, 0, rsize, rbody);
if (rc) if (rc)
printf("wb_vrepdbms:writeBody rb.upd rc %d\n", rc); printf("wb_vrepdbms:writeBody rb.upd rc %d\n", rc);
rc = 0; rc = 0;
...@@ -2249,7 +2253,12 @@ wb_vrepdbms::updateObject(pwr_tOid oid, pwr_tCid cid) ...@@ -2249,7 +2253,12 @@ wb_vrepdbms::updateObject(pwr_tOid oid, pwr_tCid cid)
} }
if (dbody) { if (dbody) {
rc = db.upd(m_db->m_txn, 0, dsize, dbody); if ( dsize != db.m_size) {
rc = db.del(m_db->m_txn);
rc = db.ins(m_db->m_txn, 0, dsize, dbody);
}
else
rc = db.upd(m_db->m_txn, 0, dsize, dbody);
if (rc) if (rc)
printf("wb_vrepdbms:writeBody db.upd rc %d\n", rc); printf("wb_vrepdbms:writeBody db.upd rc %d\n", rc);
free(dbody); free(dbody);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment