X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fcats%2Fcats.h;h=9431685fe1f34f4fa0faca570ff994c0e3d011e7;hb=d6a2978cea17ce237b4ea9c71853cb96b9f4416f;hp=343e34ab6716b9b52999793e008ae1e2608d9eab;hpb=268edade58ad594ed60bc06428a29ff3d0dfa979;p=bacula%2Fbacula diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 343e34ab67..9431685fe1 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Bacula® is a registered trademark of John Walker. + Bacula® is a registered trademark of Kern Sibbald. The licensor of Bacula is the Free Software Foundation Europe (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. @@ -42,7 +42,7 @@ */ /* - Here is how database versions work. + Here is how database versions work. While I am working on a new release with database changes, the update scripts are in the src/cats directory under the names @@ -59,7 +59,7 @@ will be copied to the updatedb directory with the correct name (in the present case 8 to 9). - Now, in principle, each of the different DB implementations + Now, in principle, each of the different DB implementations can have a different version, but in practice they are all the same (simplifies things). The exception is the internal database, which is no longer used, and hence, no longer changes. @@ -72,7 +72,8 @@ enum { SQL_TYPE_MYSQL = 0, SQL_TYPE_POSTGRESQL = 1, - SQL_TYPE_SQLITE = 2 + SQL_TYPE_SQLITE = 2, + SQL_TYPE_SQLITE3 }; @@ -87,7 +88,7 @@ typedef int (DB_RESULT_HANDLER)(void *, int, char **); #if defined(BUILDING_CATS) #ifdef HAVE_SQLITE -#define BDB_VERSION 10 +#define BDB_VERSION 11 #include @@ -178,14 +179,14 @@ struct B_DB { #define sql_num_fields(x) ((x)->ncolumn) #define SQL_ROW char** -#define sql_batch_start(x,y) my_batch_start(x,y) -#define sql_batch_end(x,y,z) my_batch_end(x,y,z) +#define sql_batch_start(x,y) my_batch_start(x,y) +#define sql_batch_end(x,y,z) my_batch_end(x,y,z) #define sql_batch_insert(x,y,z) my_batch_insert(x,y,z) #define sql_batch_lock_path_query my_sqlite_batch_lock_query #define sql_batch_lock_filename_query my_sqlite_batch_lock_query #define sql_batch_unlock_tables_query my_sqlite_batch_unlock_query #define sql_batch_fill_filename_query my_sqlite_batch_fill_filename_query -#define sql_batch_fill_path_query my_sqlite_batch_fill_path_query +#define sql_batch_fill_path_query my_sqlite_batch_fill_path_query /* In cats/sqlite.c */ void my_sqlite_free_table(B_DB *mdb); @@ -202,12 +203,12 @@ extern const char* my_sqlite_batch_fill_path_query; #else /* S Q L I T E 3 */ - + #ifdef HAVE_SQLITE3 -#define BDB_VERSION 10 +#define BDB_VERSION 11 #include @@ -307,8 +308,8 @@ struct B_DB { #define sql_field_seek(x, y) my_sqlite_field_seek((x), (y)) #define sql_fetch_field(x) my_sqlite_fetch_field(x) #define sql_num_fields(x) ((x)->ncolumn) -#define sql_batch_start(x,y) my_batch_start(x,y) -#define sql_batch_end(x,y,z) my_batch_end(x,y,z) +#define sql_batch_start(x,y) my_batch_start(x,y) +#define sql_batch_end(x,y,z) my_batch_end(x,y,z) #define sql_batch_insert(x,y,z) my_batch_insert(x,y,z) #define SQL_ROW char** #define sql_batch_lock_path_query my_sqlite_batch_lock_query @@ -333,7 +334,7 @@ extern const char* my_sqlite_batch_fill_path_query; #ifdef HAVE_MYSQL -#define BDB_VERSION 10 +#define BDB_VERSION 11 #include @@ -366,6 +367,7 @@ struct B_DB { POOLMEM *cached_path; int cached_path_len; /* length of cached path */ uint32_t cached_path_id; + bool allow_transactions; /* transactions allowed */ int changes; /* changes made to db */ POOLMEM *fname; /* Filename only */ POOLMEM *path; /* Path only */ @@ -395,8 +397,8 @@ struct B_DB { #define SQL_FIELD MYSQL_FIELD #define sql_batch_start(x,y) my_batch_start(x,y) -#define sql_batch_end(x,y,z) my_batch_end(x,y,z) -#define sql_batch_insert(x,y,z) my_batch_insert(x,y,z) +#define sql_batch_end(x,y,z) my_batch_end(x,y,z) +#define sql_batch_insert(x,y,z) my_batch_insert(x,y,z) #define sql_batch_lock_path_query my_mysql_batch_lock_path_query #define sql_batch_lock_filename_query my_mysql_batch_lock_filename_query #define sql_batch_unlock_tables_query my_mysql_batch_unlock_tables_query @@ -415,7 +417,7 @@ extern void my_mysql_free_result(B_DB *mdb); #ifdef HAVE_POSTGRESQL -#define BDB_VERSION 10 +#define BDB_VERSION 11 #include @@ -476,7 +478,7 @@ struct B_DB { POOLMEM *esc_path; /* Escaped path name */ int fnl; /* file name length */ int pnl; /* path name length */ -}; +}; void my_postgresql_free_result(B_DB *mdb); POSTGRESQL_ROW my_postgresql_fetch_row (B_DB *mdb); @@ -513,8 +515,8 @@ extern const char* my_pg_batch_fill_path_query; #define sql_fetch_field(x) my_postgresql_fetch_field(x) #define sql_num_fields(x) ((x)->num_fields) -#define sql_batch_start(x,y) my_postgresql_batch_start(x,y) -#define sql_batch_end(x,y,z) my_postgresql_batch_end(x,y,z) +#define sql_batch_start(x,y) my_postgresql_batch_start(x,y) +#define sql_batch_end(x,y,z) my_postgresql_batch_end(x,y,z) #define sql_batch_insert(x,y,z) my_postgresql_batch_insert(x,y,z) #define sql_batch_lock_path_query my_pg_batch_lock_path_query #define sql_batch_lock_filename_query my_pg_batch_lock_filename_query @@ -529,7 +531,7 @@ extern const char* my_pg_batch_fill_path_query; #ifdef HAVE_DBI -#define BDB_VERSION 10 +#define BDB_VERSION 11 #include @@ -602,7 +604,7 @@ struct B_DB { POOLMEM *esc_path; /* Escaped path name */ int fnl; /* file name length */ int pnl; /* path name length */ -}; +}; void my_dbi_free_result(B_DB *mdb); DBI_ROW my_dbi_fetch_row (B_DB *mdb); @@ -622,15 +624,15 @@ typedef struct ATTR_DBR ATTR_DBR; int my_dbi_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar); char *my_postgresql_copy_escape(char *dest, char *src, size_t len); // typedefs for libdbi work with postgresql copy insert -typedef int (*custom_function_insert_t)(void*, const char*, int); +typedef int (*custom_function_insert_t)(void*, const char*, int); typedef char* (*custom_function_error_t)(void*); typedef int (*custom_function_end_t)(void*, const char*); -extern const char* my_dbi_batch_lock_path_query[3]; -extern const char* my_dbi_batch_lock_filename_query[3]; -extern const char* my_dbi_batch_unlock_tables_query[3]; -extern const char* my_dbi_batch_fill_filename_query[3]; -extern const char* my_dbi_batch_fill_path_query[3]; +extern const char* my_dbi_batch_lock_path_query[4]; +extern const char* my_dbi_batch_lock_filename_query[4]; +extern const char* my_dbi_batch_unlock_tables_query[4]; +extern const char* my_dbi_batch_fill_filename_query[4]; +extern const char* my_dbi_batch_fill_path_query[4]; /* "Generic" names for easier conversion */ #define sql_store_result(x) (x)->result @@ -647,8 +649,8 @@ extern const char* my_dbi_batch_fill_path_query[3]; #define sql_field_seek(x, y) my_dbi_field_seek((x), (y)) #define sql_fetch_field(x) my_dbi_fetch_field(x) #define sql_num_fields(x) ((x)->num_fields) -#define sql_batch_start(x,y) my_dbi_batch_start(x,y) -#define sql_batch_end(x,y,z) my_dbi_batch_end(x,y,z) +#define sql_batch_start(x,y) my_dbi_batch_start(x,y) +#define sql_batch_end(x,y,z) my_dbi_batch_end(x,y,z) #define sql_batch_insert(x,y,z) my_dbi_batch_insert(x,y,z) #define sql_batch_lock_path_query my_dbi_batch_lock_path_query[db_type] #define sql_batch_lock_filename_query my_dbi_batch_lock_filename_query[db_type] @@ -725,32 +727,19 @@ struct B_DB { */ struct B_DB { int dummy; /* for SunOS compiler */ -}; +}; #endif /* __SQL_C */ -/* ============================================================== +/* ============================================================== * - * What follows are definitions that are used "globally" for all + * What follows are definitions that are used "globally" for all * the different SQL engines and both inside and external to the * cats directory. */ extern uint32_t bacula_db_version; -/* - * These are the sizes of the current definitions of database - * Ids. In general, FileId_t can be set to uint64_t and it - * *should* work. Users have reported back that it does work - * for PostgreSQL. For the other types, all places in Bacula - * have been converted, but no one has actually tested it. - * In principle, the only field that really should need to be - * 64 bits is the FileId_t - */ -typedef uint32_t FileId_t; -typedef uint32_t DBId_t; /* general DB id type */ -typedef uint32_t JobId_t; - #define faddr_t long /* @@ -801,6 +790,7 @@ struct JOB_DBR { uint32_t JobErrors; uint32_t JobMissingFiles; uint64_t JobBytes; + uint64_t ReadBytes; int PurgedFiles; int HasBase; @@ -821,6 +811,7 @@ struct JOB_DBR { /* Extra stuff not in DB */ int limit; /* limit records to display */ faddr_t rec_addr; + uint32_t FileIndex; /* added during Verify */ }; /* Job Media information used to create the media records @@ -849,11 +840,9 @@ struct VOL_PARAMS { uint32_t VolIndex; /* Volume seqence no. */ uint32_t FirstIndex; /* First index this Volume */ uint32_t LastIndex; /* Last index this Volume */ - uint32_t StartFile; /* File for start of data */ - uint32_t EndFile; /* End file on Volume */ - uint32_t StartBlock; /* start block on tape */ - uint32_t EndBlock; /* last block */ int32_t Slot; /* Slot */ + uint64_t StartAddr; /* Start address */ + uint64_t EndAddr; /* End address */ // uint32_t Copy; /* identical copy */ // uint32_t Stripe; /* RAIT strip number */ }; @@ -910,6 +899,7 @@ struct POOL_DBR { uint32_t MaxVolFiles; /* Max files on Volume */ uint64_t MaxVolBytes; /* Max bytes on Volume */ DBId_t RecyclePoolId; /* RecyclePool destination when media is purged */ + DBId_t ScratchPoolId; /* ScratchPool source when media is needed */ char PoolType[MAX_NAME_LENGTH]; char LabelFormat[MAX_NAME_LENGTH]; /* Extra stuff not in DB */ @@ -1002,7 +992,7 @@ struct MEDIA_DBR { char cLastWritten[MAX_TIME_LENGTH]; /* LastWritten returned from DB */ char cLabelDate[MAX_TIME_LENGTH]; /* LabelData returned from DB */ char cInitialWrite[MAX_TIME_LENGTH]; /* InitialWrite returned from DB */ - bool set_first_written; + bool set_first_written; bool set_label_date; }; @@ -1052,7 +1042,7 @@ struct db_int64_ctx { #include "sql_cmds.h" /* - * Exported globals from sql.c + * Exported globals from sql.c */ extern int DLL_IMP_EXP db_type; /* SQL engine type index */