Permalink
Browse files

Added 'project' field to the Database catalog object. This is so that…

… we can store the name of the benchmark project in the catalog. This is needed so that we can ensure that the system's components (e.g., WAL, anti-cache) get separate directories in our experiments
  • Loading branch information...
1 parent 21d1259 commit be02b2b9ecac46243c2afd9e677008658c9d907a @apavlo committed Jul 3, 2012
View
@@ -54,6 +54,7 @@ begin Site "A physical execution context for the system"
end
begin Database "A set of schema, procedures and other metadata that together comprise an application"
+ string project "The name of the benchmark project used for this database instance. Can be null"
string schema "Full SQL DDL for the database's schema"
User* users "The set of users"
Group* groups "The set of groups"
@@ -38,6 +38,7 @@ Database::Database(Catalog *catalog, CatalogType *parent, const string &path, co
m_users(catalog, this, path + "/" + "users"), m_groups(catalog, this, path + "/" + "groups"), m_tables(catalog, this, path + "/" + "tables"), m_programs(catalog, this, path + "/" + "programs"), m_procedures(catalog, this, path + "/" + "procedures"), m_connectors(catalog, this, path + "/" + "connectors"), m_snapshotSchedule(catalog, this, path + "/" + "snapshotSchedule")
{
CatalogValue value;
+ m_fields["project"] = value;
m_fields["schema"] = value;
m_childCollections["users"] = &m_users;
m_childCollections["groups"] = &m_groups;
@@ -101,6 +102,7 @@ Database::~Database() {
}
void Database::update() {
+ m_project = m_fields["project"].strValue.c_str();
m_schema = m_fields["schema"].strValue.c_str();
}
@@ -194,6 +196,10 @@ bool Database::removeChild(const std::string &collectionName, const std::string
return false;
}
+const string & Database::project() const {
+ return m_project;
+}
+
const string & Database::schema() const {
return m_schema;
}
@@ -44,6 +44,7 @@ class Database : public CatalogType {
protected:
Database(Catalog * catalog, CatalogType * parent, const std::string &path, const std::string &name);
+ std::string m_project;
std::string m_schema;
CatalogMap<User> m_users;
CatalogMap<Group> m_groups;
@@ -62,6 +63,8 @@ class Database : public CatalogType {
public:
~Database();
+ /** GETTER: The name of the benchmark project used for this database instance. Can be null */
+ const std::string & project() const;
/** GETTER: Full SQL DDL for the database's schema */
const std::string & schema() const;
/** GETTER: The set of users */
@@ -26,6 +26,7 @@
*/
public class Database extends CatalogType {
+ String m_project = new String();
String m_schema = new String();
CatalogMap<User> m_users;
CatalogMap<Group> m_groups;
@@ -37,6 +38,7 @@
void setBaseValues(Catalog catalog, CatalogType parent, String path, String name) {
super.setBaseValues(catalog, parent, path, name);
+ m_fields.put("project", m_project);
m_fields.put("schema", m_schema);
m_users = new CatalogMap<User>(catalog, this, path + "/" + "users", User.class);
m_childCollections.put("users", m_users);
@@ -55,9 +57,15 @@ void setBaseValues(Catalog catalog, CatalogType parent, String path, String name
}
public void update() {
+ m_project = (String) m_fields.get("project");
m_schema = (String) m_fields.get("schema");
}
+ /** GETTER: The name of the benchmark project used for this database instance. Can be null */
+ public String getProject() {
+ return m_project;
+ }
+
/** GETTER: Full SQL DDL for the database's schema */
public String getSchema() {
return m_schema;
@@ -98,6 +106,11 @@ public String getSchema() {
return m_snapshotSchedule;
}
+ /** SETTER: The name of the benchmark project used for this database instance. Can be null */
+ public void setProject(String value) {
+ m_project = value; m_fields.put("project", value);
+ }
+
/** SETTER: Full SQL DDL for the database's schema */
public void setSchema(String value) {
m_schema = value; m_fields.put("schema", value);
@@ -46,6 +46,7 @@
<xsd:complexType name="databaseType">
<xsd:all>
<!-- elements of an all group may appear in any order at most once. -->
+ <xsd:element name="project" type="xsd:string" minOccurs="0"/>
<xsd:element name="users" type="usersType" minOccurs="0"/>
<xsd:element name="groups" type="groupsType" minOccurs="0"/>
<xsd:element name="schemas" type="schemasType"/>
@@ -593,6 +593,11 @@ void compileDatabaseNode(DatabaseType database) throws VoltCompilerException {
// create the database in the catalog
m_catalog.execute("add /clusters[cluster] databases " + databaseName);
Database db = m_catalog.getClusters().get("cluster").getDatabases().get(databaseName);
+ if (database.getProject() != null && database.getProject().isEmpty() == false) {
+ db.setProject(database.getProject());
+ } else {
+ db.setProject("unknown");
+ }
SnapshotType snapshotSettings = database.getSnapshot();
if (snapshotSettings != null) {
@@ -712,6 +712,7 @@ public boolean compile(final VoltCompiler compiler, final String jarPath,
// <database>
final Element database = doc.createElement("database");
database.setAttribute("name", "database");
+ database.setAttribute("project", this.project_name);
project.appendChild(database);
buildDatabaseElement(doc, database);
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.04.13 at 04:19:05 PM EDT
+// Generated on: 2012.07.03 at 09:31:16 AM EDT
//
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.04.13 at 04:19:05 PM EDT
+// Generated on: 2012.07.03 at 09:31:16 AM EDT
//
@@ -25,6 +25,7 @@
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;all>
+ * &lt;element name="project" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="users" type="{}usersType" minOccurs="0"/>
* &lt;element name="groups" type="{}groupsType" minOccurs="0"/>
* &lt;element name="schemas" type="{}schemasType"/>
@@ -49,6 +50,7 @@
})
public class DatabaseType {
+ protected String project;
protected UsersType users;
protected GroupsType groups;
@XmlElement(required = true)
@@ -64,6 +66,30 @@
protected String name;
/**
+ * Gets the value of the project property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getProject() {
+ return project;
+ }
+
+ /**
+ * Sets the value of the project property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setProject(String value) {
+ this.project = value;
+ }
+
+ /**
* Gets the value of the users property.
*
* @return
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.04.13 at 04:19:05 PM EDT
+// Generated on: 2012.07.03 at 09:31:16 AM EDT
//
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2012.04.13 at 04:19:05 PM EDT
+// Generated on: 2012.07.03 at 09:31:16 AM EDT
//
Oops, something went wrong. Retry.

0 comments on commit be02b2b

Please sign in to comment.