# define mark_access_denied(a)
#endif
-/* dedup_util.c */
-bool is_dedup_ref(DEV_RECORD *rec, bool lazy);
bool is_deduplicable_stream(int stream);
bool is_client_rehydration_friendly_stream(int stream);
-void dedup_get_limits(int64_t *nofile, int64_t *memlock);
#endif /* ORG_LIB_DEDUP_H */
CLOUDCLIOBJS = bcloud.o $(SDCORE_OBJS) $(CLOUD_ALL_LOBJS)
DEDUP_SRCS = \
- bitarray.c dde_cmd.c dde_status.c dde_vacuum.c \
- dedupstored.c dedupengine.c dde_scrub.c \
- dedup_dev.c
+ dedup_dev.c dedupengine.c dedup_interface.c
DEDUP_OBJS = $(DEDUP_SRCS:.c=.o)
DEDUP_LOBJS = $(DEDUP_SRCS:.c=.lo)
LIBBACSD_LT_RELEASE = @LIBBAC_LT_RELEASE@
-TUNEDDEOBJS = bitarray.o dedupengine.o dde_scrub.o tune-dde.o
-
-
# these are the objects that are changed by the .configure process
EXTRAOBJS = @OBJLIST@
bacula-sd-cloud-swift-driver.la: Makefile $(CLOUD_GENERIC_LOBJS)
$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared $(CLOUD_GENERIC_LOBJS) -o $@ -R $(libdir) -rpath $(libdir) -module -export-dynamic -release $(LIBBACSD_LT_RELEASE)
-bacula-sd-dedup-driver.la: Makefile $(DEDUP_LOBJS)
- $(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared $(DEDUP_LOBJS) -o $@ -rpath $(libdir) -module -export-dynamic -release $(LIBBACSD_LT_RELEASE) \
- $(TOKYOCABINET_LIBS)
-
+dedup1/libdedup1.la:
+ (cd dedup1 && make libdedup1.la || exit 1)
+
+bacula-sd-dedup-driver.la: Makefile $(DEDUP_LOBJS) dedup1/libdedup1.la
+ @echo "Making $@ ..."
+ $(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared $(DEDUP_LOBJS) dedup1/libdedup1.la -o $@ -rpath $(plugindir) -module -export-dynamic -release $(LIBBACSD_LT_RELEASE) \
+ $(TOKYOCABINET_LIBS)
+
bacula-sd-aligned-driver.la: Makefile $(ALIGNED_LOBJS)
$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared $(ALIGNED_LOBJS) -o $@ -rpath $(plugindir) \
-module -export-dynamic -release $(LIBBACSD_LT_RELEASE)
$(LIBTOOL_LINK) $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(COPYOBJS) \
$(SD_LIBS) -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-tune-dde: Makefile $(TUNEDDEOBJS) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
- @echo "Linking $@ ..."
- $(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -o $@ $(TUNEDDEOBJS) $(ZLIBS) \
- -lbac -lm $(DLIB) $(LIBS) $(TOKYOCABINET_LIBS) \
- $(GETTEXT_LIBS)
-
cloud_parts_test: Makefile cloud_parts.c
$(RMF) cloud_parts.o
$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) cloud_parts.c
$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bacula-sd-aligned-driver$(DEFAULT_SHARED_OBJECT_TYPE) $(DESTDIR)$(plugindir)
$(RMF) $(DESTDIR)$(plugindir)/bacula-sd-aligned-driver.la
-install-dedup: bacula-sd-dedup-driver.la
+install-dedup: bacula-sd-dedup-driver.la
$(MKDIR) $(DESTDIR)$(plugindir)
$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bacula-sd-dedup-driver$(DEFAULT_SHARED_OBJECT_TYPE) $(DESTDIR)$(plugindir)
$(RMF) $(DESTDIR)$(plugindir)/bacula-sd-dedup-driver.la
@find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
@$(RMF) -r .libs _libs
@$(RMF) *.la
+ (cd dedup1 && make libtool-clean)
clean: libtool-clean
@$(RMF) bacula-sd stored bls bextract bpool btape shmfree core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
@$(RMF) bscan bsdjson bcopy static-bacula-sd acsls-changer
+ (cd dedup1 && make clean)
realclean: clean
@$(RMF) tags bacula-sd.conf acsls-changer.conf
distclean: realclean
if test $(srcdir) = .; then $(MAKE) realclean; fi
(cd $(srcdir); $(RMF) Makefile)
+ (cd dedup1 && make distclean)
devclean: realclean
if test $(srcdir) = .; then $(MAKE) realclean; fi
$(MV) Makefile.bak Makefile; \
echo " ======= Something went wrong with make depend. ======="; \
fi
+ (cd dedup1 && make depend)
# -----------------------------------------------------------------------
# DO NOT DELETE: nice dependency list follows
#include "stored.h"
#include "prepare.h"
+bool is_dedup_server_side(DEVICE *dev, int32_t stream, uint64_t stream_len);
/* Responses sent to the File daemon */
static char OK_data[] = "3000 OK data\n";
#include "bacula.h"
#include "stored.h"
-#include "dedupstored.h"
#include "findlib/find.h"
#include "lib/cmd_parser.h"
#ifndef DEDUP_INTERFACE_H_
#define DEDUP_INTERFACE_H_
-class BufferedMsgSD: public DDEConnectionBackup, public BufferedMsgBase
+bool is_dedup_server_side(DEVICE *dev, int32_t stream, uint64_t stream_len);
+bool is_dedup_ref(DEV_RECORD *rec, bool lazy);
+void list_dedupengines(char *cmd, STATUS_PKT *sp);
+void dedup_get_limits(int64_t *nofile, int64_t *memlock);
+bool dedup_parse_filter(char *fltr);
+void dedup_filter_record(int verbose, DCR *dcr, DEV_RECORD *rec, char *dedup_msg, int len);
+
+/* Interface between DEDUP and SD */
+class DedupStoredInterfaceBase
{
public:
- POOL_MEM block; // used for BNET_CMD_STO_BLOCK
- BufferedMsgSD(DedupEngine *dedupengine, JCR *jcr, BSOCK *sock, const char *a_rec_header, int32_t bufsize, int capacity, int con_capacity);
- virtual ~BufferedMsgSD();
- virtual void *do_read_sock_thread(void);
- virtual int commit(POOLMEM *&errmsg, uint32_t jobid)
- { return DDEConnectionBackup::Commit(errmsg, jobid); };
- virtual bool dedup_store_chunk(DEV_RECORD *rec, const char *rbuf, int rbuflen, char *dedup_ref_buf, char *wdedup_ref_buf, POOLMEM *&errmsg);
-};
-
-
-/*
- * DedupStoredInterface is the JCR->dedup component in charge of handling DEDUP
- * and REHYDRATION on the Storage side
- *
- * When doing backup, only the dedup part is in use, the rehydration part is not
- * used but don't take any resources. The same is true for the opposite.
- *
- */
-class DedupStoredInterface: public DedupStoredInterfaceBase, DDEConnectionRestore
-{
-public:
- enum { di_rehydration_srv=1 };
- JCR *jcr;
-
-private:
- bool _is_rehydration_srvside;
- bool _is_thread_started;
- POOLMEM *msgbuf;
- POOLMEM *eblock;
-
-public:
-
- pthread_mutex_t mutex;
- pthread_cond_t cond;
-
- bool emergency_exit;
- bool is_eod_sent; /* end of backup, EOD has been sent */
-
- /* deduplication */
-
- /* rehydration */
- int client_rec_capacity; /* size of the buffer client on the other side, */
- /* don't send more rec before an ACK */
- int64_t sent_rec_count, recv_ack_count; /* keep count of rec sent and received ACK */
- pthread_t rehydration_thread;
-
- bool do_checksum_after_rehydration; /* compute checksum after the rehydration ? */
- bool use_index_for_recall; /* Use index to restore a block (or use the volume information) */
- int rehydra_check_hash; /* copied from DedupEngine */
- POOL_MEM m_errmsg; /* error buffer used in record_rehydration */
-
- struct DedupReference *circular_ref;
- int circular_ref_count; /* number of ref in the circular buffer */
- int circular_ref_pos; /* where to store the next ref sent to the "other" */
- int circular_ref_search; /* pos of the last hit, start searching from here */
-
- DedupStoredInterface(JCR *jcr, DedupEngine *dedupengine);
- ~DedupStoredInterface();
-
- /* rehydration / restore */
- int start_rehydration(); /* Start rehydration thread */
- void *wait_rehydration(bool emergency=false); /* Stop rehydration thread */
- void *do_rehydration_thread(void); /* Actual thread startup function */
- int handle_rehydration_command(BSOCK *fd);
- bool wait_flowcontrol_rehydration(int free_rec_count, int timeoutms);
- bool do_flowcontrol_rehydration(int free_rec_count, int retry_timeoutms=250);
-
- void warn_rehydration_eod(); /* tell rehydration than EOD was sent */
- int record_rehydration(DCR *dcr, DEV_RECORD *rec, char *buf, POOLMEM *&errmsg, bool despite_of_error, int *chunk_size);
- int add_circular_buf(DCR *dcr, DEV_RECORD *rec);
-
- /* Some tools like bextract may want to test the checksum after a rehydration. */
- void set_checksum_after_rehydration(bool val) {
- do_checksum_after_rehydration = val;
- };
-
- /* Use the index during restore, or the volume information */
- void set_use_index_for_recall(bool val) {
- use_index_for_recall = val;
- };
-
- POOLMEM *get_msgbuf() { return msgbuf; };
- bool is_rehydration_srvside() { return _is_rehydration_srvside; };
- bool is_thread_started() { return _is_thread_started; };
- void set_rehydration_srvside() { _is_rehydration_srvside = true; };
- void unset_rehydration_srvside() { _is_rehydration_srvside = false; };
+ DedupStoredInterfaceBase(JCR *jcr, DedupEngine *dedupengine) {};
+ virtual ~DedupStoredInterfaceBase() {};
+
+ // deduplication
+ virtual int start_deduplication() {return -1;};
+ virtual void *wait_deduplication(bool emergency=false) {return NULL;};
+ virtual void *do_deduplication_thread(void){return NULL;};
+
+ // rehydration
+ virtual int start_rehydration(){return -1;};
+ virtual void *wait_rehydration(bool emergency=false){return NULL;};
+ virtual void *do_rehydration_thread(void){return NULL;};
+ virtual int handle_rehydration_command(BSOCK *fd){return -1;};
+ virtual bool wait_flowcontrol_rehydration(int free_rec_count, int timeoutms){return false;};
+ virtual bool do_flowcontrol_rehydration(int free_rec_count, int retry_timeoutms=250){return false;};
+ virtual void warn_rehydration_eod() {};
+
+ virtual int record_rehydration(DCR *dcr, DEV_RECORD *rec, char *buf, POOLMEM *&errmsg, bool despite_of_error, int *chunk_size){return -1;};
+ virtual int add_circular_buf(DCR *dcr, DEV_RECORD *rec){return -1;};
+ virtual void set_checksum_after_rehydration(bool val) {};
+ virtual void set_use_index_for_recall(bool val) {};
+
+ virtual POOLMEM *get_msgbuf() { return NULL; };
+ virtual void unset_rehydration_srvside() { return; };
+ virtual bool is_rehydration_srvside() { return false; };
+ virtual bool is_thread_started() { return false; };
};
+++ /dev/null
-/*
- Bacula(R) - The Network Backup Solution
-
- Copyright (C) 2000-2020 Kern Sibbald
-
- The original author of Bacula is Kern Sibbald, with contributions
- from many others, a complete list can be found in the file AUTHORS.
-
- You may use this file and others of this release according to the
- license defined in the LICENSE file, which includes the Affero General
- Public License, v3.0 ("AGPLv3") and some additional permissions and
- terms pursuant to its AGPLv3 Section 7.
-
- This notice must be preserved when any source code is
- conveyed and/or propagated.
-
- Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-
-#ifndef DEDUPSTORED_H_
-#define DEDUPSTORED_H_
-
-bool is_dedup_server_side(DEVICE *dev, int32_t stream, uint64_t stream_len);
-bool is_dedup_ref(DEV_RECORD *rec, bool lazy);
-void list_dedupengines(char *cmd, STATUS_PKT *sp);
-void dedup_get_limits(int64_t *nofile, int64_t *memlock);
-bool dedup_parse_filter(char *fltr);
-void dedup_filter_record(int verbose, DCR *dcr, DEV_RECORD *rec, char *dedup_msg, int len);
-
-class DedupEngine;
-
-/* Interface between DEDUP and SD */
-class DedupStoredInterfaceBase
-{
-public:
-
- DedupStoredInterfaceBase(JCR *jcr, DedupEngine *dedupengine) {};
- virtual ~DedupStoredInterfaceBase() {};
-
- // deduplication
- virtual int start_deduplication() {return -1;};
- virtual void *wait_deduplication(bool emergency=false) {return NULL;};
- virtual void *do_deduplication_thread(void){return NULL;};
-
- // rehydration
- virtual int start_rehydration(){return -1;};
- virtual void *wait_rehydration(bool emergency=false){return NULL;};
- virtual void *do_rehydration_thread(void){return NULL;};
- virtual int handle_rehydration_command(BSOCK *fd){return -1;};
- virtual bool wait_flowcontrol_rehydration(int free_rec_count, int timeoutms){return false;};
- virtual bool do_flowcontrol_rehydration(int free_rec_count, int retry_timeoutms=250){return false;};
- virtual void warn_rehydration_eod() {};
-
- virtual int record_rehydration(DCR *dcr, DEV_RECORD *rec, char *buf, POOLMEM *&errmsg, bool despite_of_error, int *chunk_size){return -1;};
- virtual int add_circular_buf(DCR *dcr, DEV_RECORD *rec){return -1;};
- virtual void set_checksum_after_rehydration(bool val) {};
- virtual void set_use_index_for_recall(bool val) {};
-
- virtual POOLMEM *get_msgbuf() { return NULL; };
- virtual void unset_rehydration_srvside() { return; };
- virtual bool is_rehydration_srvside() { return false; };
- virtual bool is_thread_started() { return false; };
-
-};
-
-#endif /* DEDUPSTORED_H_ */
#include "bacula.h"
#include "stored.h"
-#include "dedupstored.h"
+#include "dedup_interface.h"
/* Forward referenced subroutines */
static bool read_record_cb(DCR *dcr, DEV_RECORD *rec);
static bool mac_record_cb(DCR *dcr, DEV_RECORD *rec);
#include "vol_mgr.h"
#include "reserve.h"
#include "protos.h"
-#include "dedupstored.h"
+#include "dedup_interface.h"
#ifdef HAVE_LIBZ
#include <zlib.h> /* compression headers */
#else