/** Add the system procedures to the catalog. */ void addSystemProcsToCatalog(final Catalog catalog, final Database database) throws VoltCompilerException { assert (catalog != null); assert (database != null); // Table of sysproc metadata. final Object[][] procedures = { // SysProcedure Class readonly everysite {LoadMultipartitionTable.class, false, true}, {DatabaseDump.class, true, true}, {RecomputeMarkovs.class, true, true}, {Shutdown.class, false, true}, {NoOp.class, true, false}, {AdHoc.class, false, false}, {GarbageCollection.class, true, true}, {ExecutorStatus.class, true, false}, {GetCatalog.class, true, false}, {SnapshotSave.class, false, false}, {SnapshotRestore.class, false, false}, {SnapshotStatus.class, false, false}, {SnapshotScan.class, false, false}, {SnapshotDelete.class, false, false}, // {"org.voltdb.sysprocs.Quiesce", false, false}, // {"org.voltdb.sysprocs.StartSampler", false, false}, // {"org.voltdb.sysprocs.Statistics", true, false}, // {"org.voltdb.sysprocs.SystemInformation", true, false}, // {"org.voltdb.sysprocs.UpdateApplicationCatalog", false, true}, // {"org.voltdb.sysprocs.UpdateLogging", false, true} }; for (int ii = 0; ii < procedures.length; ++ii) { Class<?> procClass = (Class<?>) procedures[ii][0]; boolean readonly = (Boolean) procedures[ii][1]; boolean everysite = (Boolean) procedures[ii][2]; // short name is "@ClassName" without package final String shortName = "@" + procClass.getSimpleName(); // Make sure it's a VoltSystemProcedure if (ClassUtil.getSuperClasses(procClass).contains(VoltSystemProcedure.class) == false) { String msg = String.format( "Class %s does not extend %s", procClass.getCanonicalName(), VoltSystemProcedure.class.getSimpleName()); throw new VoltCompilerException(msg); } // read annotations final ProcInfo info = procClass.getAnnotation(ProcInfo.class); if (info == null) { throw new VoltCompilerException("Sysproc " + shortName + " is missing annotation."); } // add an entry to the catalog final Procedure procedure = database.getProcedures().add(shortName); procedure.setId(this.getNextProcedureId()); procedure.setClassname(procClass.getCanonicalName()); procedure.setReadonly(readonly); procedure.setSystemproc(true); procedure.setHasjava(true); procedure.setSinglepartition(info.singlePartition()); procedure.setEverysite(everysite); ProcedureCompiler.populateProcedureParameters(this, procClass, procedure); // Stored procedure sysproc classes are present in VoltDB.jar // and not duplicated in the catalog. This was decided // arbitrarily - no one had a strong opinion. // // VoltCompiler.addClassToJar(procClass, compiler); } }