Skip to content
Browse files

Merge branch 'bdb_backup' of https://github.com/jroper/voldemort into…

… jroper-bdb_backup

Conflicts:
	clients/python/voldemort/protocol/voldemort_admin_pb2.py
	src/java/voldemort/client/protocol/admin/AdminClient.java
	src/java/voldemort/client/protocol/pb/VAdminProto.java
	src/proto/voldemort-admin.proto
  • Loading branch information...
2 parents aee112d + fd5dbeb commit 491863359fac1b2c67fe6c1a719ef4c1f569c22d @vinothchandar committed Jan 5, 2012
View
1 CONTRIBUTORS
@@ -12,6 +12,7 @@ Eric Evans
Geir Magnusson Jr.
Ismael Juma
Jakob Homan
+James Roper
Janne Hietamäki
Jay Kreps
Jonathan Traupman
View
64 clients/python/voldemort/protocol/voldemort_admin_pb2.py
@@ -10,7 +10,7 @@
DESCRIPTOR = descriptor.FileDescriptor(
name='voldemort-admin.proto',
package='voldemort',
- serialized_pb='\n\x15voldemort-admin.proto\x12\tvoldemort\x1a\x16voldemort-client.proto\"!\n\x12GetMetadataRequest\x12\x0b\n\x03key\x18\x01 \x02(\x0c\"]\n\x13GetMetadataResponse\x12%\n\x07version\x18\x01 \x01(\x0b\x32\x14.voldemort.Versioned\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"M\n\x15UpdateMetadataRequest\x12\x0b\n\x03key\x18\x01 \x02(\x0c\x12\'\n\tversioned\x18\x02 \x02(\x0b\x32\x14.voldemort.Versioned\"9\n\x16UpdateMetadataResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"7\n\tFileEntry\x12\x11\n\tfile_name\x18\x01 \x02(\t\x12\x17\n\x0f\x66ile_size_bytes\x18\x02 \x02(\x03\"F\n\x0ePartitionEntry\x12\x0b\n\x03key\x18\x01 \x02(\x0c\x12\'\n\tversioned\x18\x02 \x02(\x0b\x32\x14.voldemort.Versioned\"\x8e\x01\n\x1dUpdatePartitionEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x32\n\x0fpartition_entry\x18\x02 \x02(\x0b\x32\x19.voldemort.PartitionEntry\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\"A\n\x1eUpdatePartitionEntriesResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"-\n\x0fVoldemortFilter\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x02(\x0c\"\xaf\x01\n\x18UpdateSlopEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x0b\n\x03key\x18\x02 \x02(\x0c\x12\'\n\x07version\x18\x03 \x02(\x0b\x32\x16.voldemort.VectorClock\x12,\n\x0crequest_type\x18\x04 \x02(\x0e\x32\x16.voldemort.RequestType\x12\r\n\x05value\x18\x05 \x01(\x0c\x12\x11\n\ttransform\x18\x06 \x01(\x0c\"<\n\x19UpdateSlopEntriesResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"d\n\x1a\x46\x65tchPartitionFilesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x37\n\x14replica_to_partition\x18\x02 \x03(\x0b\x32\x19.voldemort.PartitionTuple\"\xd7\x01\n\x1c\x46\x65tchPartitionEntriesRequest\x12\x37\n\x14replica_to_partition\x18\x01 \x03(\x0b\x32\x19.voldemort.PartitionTuple\x12\r\n\x05store\x18\x02 \x02(\t\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\x12\x14\n\x0c\x66\x65tch_values\x18\x04 \x01(\x08\x12\x14\n\x0cskip_records\x18\x05 \x01(\x03\x12\x17\n\x0finitial_cluster\x18\x06 \x01(\t\"\x81\x01\n\x1d\x46\x65tchPartitionEntriesResponse\x12\x32\n\x0fpartition_entry\x18\x01 \x01(\x0b\x32\x19.voldemort.PartitionEntry\x12\x0b\n\x03key\x18\x02 \x01(\x0c\x12\x1f\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x10.voldemort.Error\"\xac\x01\n\x1d\x44\x65letePartitionEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x37\n\x14replica_to_partition\x18\x02 \x03(\x0b\x32\x19.voldemort.PartitionTuple\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\x12\x17\n\x0finitial_cluster\x18\x04 \x01(\t\"P\n\x1e\x44\x65letePartitionEntriesResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"\xcf\x01\n\x1dInitiateFetchAndUpdateRequest\x12\x0f\n\x07node_id\x18\x01 \x02(\x05\x12\r\n\x05store\x18\x02 \x02(\t\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\x12\x37\n\x14replica_to_partition\x18\x04 \x03(\x0b\x32\x19.voldemort.PartitionTuple\x12\x17\n\x0finitial_cluster\x18\x05 \x01(\t\x12\x10\n\x08optimize\x18\x06 \x01(\x08\"1\n\x1b\x41syncOperationStatusRequest\x12\x12\n\nrequest_id\x18\x01 \x02(\x05\"/\n\x19\x41syncOperationStopRequest\x12\x12\n\nrequest_id\x18\x01 \x02(\x05\"=\n\x1a\x41syncOperationStopResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"2\n\x19\x41syncOperationListRequest\x12\x15\n\rshow_complete\x18\x02 \x02(\x08\"R\n\x1a\x41syncOperationListResponse\x12\x13\n\x0brequest_ids\x18\x01 \x03(\x05\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\":\n\x0ePartitionTuple\x12\x14\n\x0creplica_type\x18\x01 \x02(\x05\x12\x12\n\npartitions\x18\x02 \x03(\x05\"e\n\x16PerStorePartitionTuple\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x37\n\x14replica_to_partition\x18\x02 \x03(\x0b\x32\x19.voldemort.PartitionTuple\"\xf8\x01\n\x19RebalancePartitionInfoMap\x12\x12\n\nstealer_id\x18\x01 \x02(\x05\x12\x10\n\x08\x64onor_id\x18\x02 \x02(\x05\x12\x0f\n\x07\x61ttempt\x18\x03 \x02(\x05\x12\x43\n\x18replica_to_add_partition\x18\x04 \x03(\x0b\x32!.voldemort.PerStorePartitionTuple\x12\x46\n\x1breplica_to_delete_partition\x18\x05 \x03(\x0b\x32!.voldemort.PerStorePartitionTuple\x12\x17\n\x0finitial_cluster\x18\x06 \x02(\t\"f\n\x1cInitiateRebalanceNodeRequest\x12\x46\n\x18rebalance_partition_info\x18\x01 \x02(\x0b\x32$.voldemort.RebalancePartitionInfoMap\"m\n#InitiateRebalanceNodeOnDonorRequest\x12\x46\n\x18rebalance_partition_info\x18\x01 \x03(\x0b\x32$.voldemort.RebalancePartitionInfoMap\"\x8a\x01\n\x1c\x41syncOperationStatusResponse\x12\x12\n\nrequest_id\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0e\n\x06status\x18\x03 \x01(\t\x12\x10\n\x08\x63omplete\x18\x04 \x01(\x08\x12\x1f\n\x05\x65rror\x18\x05 \x01(\x0b\x32\x10.voldemort.Error\"\'\n\x16TruncateEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\":\n\x17TruncateEntriesResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"*\n\x0f\x41\x64\x64StoreRequest\x12\x17\n\x0fstoreDefinition\x18\x01 \x02(\t\"3\n\x10\x41\x64\x64StoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"\'\n\x12\x44\x65leteStoreRequest\x12\x11\n\tstoreName\x18\x01 \x02(\t\"6\n\x13\x44\x65leteStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"P\n\x11\x46\x65tchStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\x12\x14\n\x0cpush_version\x18\x03 \x01(\x03\"9\n\x10SwapStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\"P\n\x11SwapStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\x12\x1a\n\x12previous_store_dir\x18\x02 \x01(\t\"@\n\x14RollbackStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x14\n\x0cpush_version\x18\x02 \x02(\x03\"8\n\x15RollbackStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"&\n\x10RepairJobRequest\x12\x12\n\nstore_name\x18\x01 \x01(\t\"4\n\x11RepairJobResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"=\n\x14ROStoreVersionDirMap\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\"/\n\x19GetROMaxVersionDirRequest\x12\x12\n\nstore_name\x18\x01 \x03(\t\"y\n\x1aGetROMaxVersionDirResponse\x12:\n\x11ro_store_versions\x18\x01 \x03(\x0b\x32\x1f.voldemort.ROStoreVersionDirMap\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"3\n\x1dGetROCurrentVersionDirRequest\x12\x12\n\nstore_name\x18\x01 \x03(\t\"}\n\x1eGetROCurrentVersionDirResponse\x12:\n\x11ro_store_versions\x18\x01 \x03(\x0b\x32\x1f.voldemort.ROStoreVersionDirMap\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"/\n\x19GetROStorageFormatRequest\x12\x12\n\nstore_name\x18\x01 \x03(\t\"y\n\x1aGetROStorageFormatResponse\x12:\n\x11ro_store_versions\x18\x01 \x03(\x0b\x32\x1f.voldemort.ROStoreVersionDirMap\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"@\n\x17\x46\x61iledFetchStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\";\n\x18\x46\x61iledFetchStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"\xe6\x01\n\x1bRebalanceStateChangeRequest\x12K\n\x1drebalance_partition_info_list\x18\x01 \x03(\x0b\x32$.voldemort.RebalancePartitionInfoMap\x12\x16\n\x0e\x63luster_string\x18\x02 \x02(\t\x12\x0f\n\x07swap_ro\x18\x03 \x02(\x08\x12\x1f\n\x17\x63hange_cluster_metadata\x18\x04 \x02(\x08\x12\x1e\n\x16\x63hange_rebalance_state\x18\x05 \x02(\x08\x12\x10\n\x08rollback\x18\x06 \x02(\x08\"?\n\x1cRebalanceStateChangeResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"G\n DeleteStoreRebalanceStateRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x0f\n\x07node_id\x18\x02 \x02(\x05\"D\n!DeleteStoreRebalanceStateResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"\x80\x0e\n\x15VoldemortAdminRequest\x12)\n\x04type\x18\x01 \x02(\x0e\x32\x1b.voldemort.AdminRequestType\x12\x33\n\x0cget_metadata\x18\x02 \x01(\x0b\x32\x1d.voldemort.GetMetadataRequest\x12\x39\n\x0fupdate_metadata\x18\x03 \x01(\x0b\x32 .voldemort.UpdateMetadataRequest\x12J\n\x18update_partition_entries\x18\x04 \x01(\x0b\x32(.voldemort.UpdatePartitionEntriesRequest\x12H\n\x17\x66\x65tch_partition_entries\x18\x05 \x01(\x0b\x32\'.voldemort.FetchPartitionEntriesRequest\x12J\n\x18\x64\x65lete_partition_entries\x18\x06 \x01(\x0b\x32(.voldemort.DeletePartitionEntriesRequest\x12K\n\x19initiate_fetch_and_update\x18\x07 \x01(\x0b\x32(.voldemort.InitiateFetchAndUpdateRequest\x12\x46\n\x16\x61sync_operation_status\x18\x08 \x01(\x0b\x32&.voldemort.AsyncOperationStatusRequest\x12H\n\x17initiate_rebalance_node\x18\t \x01(\x0b\x32\'.voldemort.InitiateRebalanceNodeRequest\x12\x42\n\x14\x61sync_operation_stop\x18\n \x01(\x0b\x32$.voldemort.AsyncOperationStopRequest\x12\x42\n\x14\x61sync_operation_list\x18\x0b \x01(\x0b\x32$.voldemort.AsyncOperationListRequest\x12;\n\x10truncate_entries\x18\x0c \x01(\x0b\x32!.voldemort.TruncateEntriesRequest\x12-\n\tadd_store\x18\r \x01(\x0b\x32\x1a.voldemort.AddStoreRequest\x12\x33\n\x0c\x64\x65lete_store\x18\x0e \x01(\x0b\x32\x1d.voldemort.DeleteStoreRequest\x12\x31\n\x0b\x66\x65tch_store\x18\x0f \x01(\x0b\x32\x1c.voldemort.FetchStoreRequest\x12/\n\nswap_store\x18\x10 \x01(\x0b\x32\x1b.voldemort.SwapStoreRequest\x12\x37\n\x0erollback_store\x18\x11 \x01(\x0b\x32\x1f.voldemort.RollbackStoreRequest\x12\x44\n\x16get_ro_max_version_dir\x18\x12 \x01(\x0b\x32$.voldemort.GetROMaxVersionDirRequest\x12L\n\x1aget_ro_current_version_dir\x18\x13 \x01(\x0b\x32(.voldemort.GetROCurrentVersionDirRequest\x12\x44\n\x15\x66\x65tch_partition_files\x18\x14 \x01(\x0b\x32%.voldemort.FetchPartitionFilesRequest\x12@\n\x13update_slop_entries\x18\x16 \x01(\x0b\x32#.voldemort.UpdateSlopEntriesRequest\x12>\n\x12\x66\x61iled_fetch_store\x18\x18 \x01(\x0b\x32\".voldemort.FailedFetchStoreRequest\x12\x43\n\x15get_ro_storage_format\x18\x19 \x01(\x0b\x32$.voldemort.GetROStorageFormatRequest\x12\x46\n\x16rebalance_state_change\x18\x1a \x01(\x0b\x32&.voldemort.RebalanceStateChangeRequest\x12/\n\nrepair_job\x18\x1b \x01(\x0b\x32\x1b.voldemort.RepairJobRequest\x12X\n initiate_rebalance_node_on_donor\x18\x1c \x01(\x0b\x32..voldemort.InitiateRebalanceNodeOnDonorRequest\x12Q\n\x1c\x64\x65lete_store_rebalance_state\x18\x1d \x01(\x0b\x32+.voldemort.DeleteStoreRebalanceStateRequest*\xa1\x05\n\x10\x41\x64minRequestType\x12\x10\n\x0cGET_METADATA\x10\x00\x12\x13\n\x0fUPDATE_METADATA\x10\x01\x12\x1c\n\x18UPDATE_PARTITION_ENTRIES\x10\x02\x12\x1b\n\x17\x46\x45TCH_PARTITION_ENTRIES\x10\x03\x12\x1c\n\x18\x44\x45LETE_PARTITION_ENTRIES\x10\x04\x12\x1d\n\x19INITIATE_FETCH_AND_UPDATE\x10\x05\x12\x1a\n\x16\x41SYNC_OPERATION_STATUS\x10\x06\x12\x1b\n\x17INITIATE_REBALANCE_NODE\x10\x07\x12\x18\n\x14\x41SYNC_OPERATION_STOP\x10\x08\x12\x18\n\x14\x41SYNC_OPERATION_LIST\x10\t\x12\x14\n\x10TRUNCATE_ENTRIES\x10\n\x12\r\n\tADD_STORE\x10\x0b\x12\x10\n\x0c\x44\x45LETE_STORE\x10\x0c\x12\x0f\n\x0b\x46\x45TCH_STORE\x10\r\x12\x0e\n\nSWAP_STORE\x10\x0e\x12\x12\n\x0eROLLBACK_STORE\x10\x0f\x12\x1a\n\x16GET_RO_MAX_VERSION_DIR\x10\x10\x12\x1e\n\x1aGET_RO_CURRENT_VERSION_DIR\x10\x11\x12\x19\n\x15\x46\x45TCH_PARTITION_FILES\x10\x12\x12\x17\n\x13UPDATE_SLOP_ENTRIES\x10\x14\x12\x16\n\x12\x46\x41ILED_FETCH_STORE\x10\x16\x12\x19\n\x15GET_RO_STORAGE_FORMAT\x10\x17\x12\x1a\n\x16REBALANCE_STATE_CHANGE\x10\x18\x12\x0e\n\nREPAIR_JOB\x10\x19\x12$\n INITIATE_REBALANCE_NODE_ON_DONOR\x10\x1a\x12 \n\x1c\x44\x45LETE_STORE_REBALANCE_STATE\x10\x1b\x42-\n\x1cvoldemort.client.protocol.pbB\x0bVAdminProtoH\x01')
+ serialized_pb='\n\x15voldemort-admin.proto\x12\tvoldemort\x1a\x16voldemort-client.proto\"!\n\x12GetMetadataRequest\x12\x0b\n\x03key\x18\x01 \x02(\x0c\"]\n\x13GetMetadataResponse\x12%\n\x07version\x18\x01 \x01(\x0b\x32\x14.voldemort.Versioned\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"M\n\x15UpdateMetadataRequest\x12\x0b\n\x03key\x18\x01 \x02(\x0c\x12\'\n\tversioned\x18\x02 \x02(\x0b\x32\x14.voldemort.Versioned\"9\n\x16UpdateMetadataResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"7\n\tFileEntry\x12\x11\n\tfile_name\x18\x01 \x02(\t\x12\x17\n\x0f\x66ile_size_bytes\x18\x02 \x02(\x03\"F\n\x0ePartitionEntry\x12\x0b\n\x03key\x18\x01 \x02(\x0c\x12\'\n\tversioned\x18\x02 \x02(\x0b\x32\x14.voldemort.Versioned\"\x8e\x01\n\x1dUpdatePartitionEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x32\n\x0fpartition_entry\x18\x02 \x02(\x0b\x32\x19.voldemort.PartitionEntry\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\"A\n\x1eUpdatePartitionEntriesResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"-\n\x0fVoldemortFilter\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x02(\x0c\"\xaf\x01\n\x18UpdateSlopEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x0b\n\x03key\x18\x02 \x02(\x0c\x12\'\n\x07version\x18\x03 \x02(\x0b\x32\x16.voldemort.VectorClock\x12,\n\x0crequest_type\x18\x04 \x02(\x0e\x32\x16.voldemort.RequestType\x12\r\n\x05value\x18\x05 \x01(\x0c\x12\x11\n\ttransform\x18\x06 \x01(\x0c\"<\n\x19UpdateSlopEntriesResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"d\n\x1a\x46\x65tchPartitionFilesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x37\n\x14replica_to_partition\x18\x02 \x03(\x0b\x32\x19.voldemort.PartitionTuple\"\xd7\x01\n\x1c\x46\x65tchPartitionEntriesRequest\x12\x37\n\x14replica_to_partition\x18\x01 \x03(\x0b\x32\x19.voldemort.PartitionTuple\x12\r\n\x05store\x18\x02 \x02(\t\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\x12\x14\n\x0c\x66\x65tch_values\x18\x04 \x01(\x08\x12\x14\n\x0cskip_records\x18\x05 \x01(\x03\x12\x17\n\x0finitial_cluster\x18\x06 \x01(\t\"\x81\x01\n\x1d\x46\x65tchPartitionEntriesResponse\x12\x32\n\x0fpartition_entry\x18\x01 \x01(\x0b\x32\x19.voldemort.PartitionEntry\x12\x0b\n\x03key\x18\x02 \x01(\x0c\x12\x1f\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x10.voldemort.Error\"\xac\x01\n\x1d\x44\x65letePartitionEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\x12\x37\n\x14replica_to_partition\x18\x02 \x03(\x0b\x32\x19.voldemort.PartitionTuple\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\x12\x17\n\x0finitial_cluster\x18\x04 \x01(\t\"P\n\x1e\x44\x65letePartitionEntriesResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"\xcf\x01\n\x1dInitiateFetchAndUpdateRequest\x12\x0f\n\x07node_id\x18\x01 \x02(\x05\x12\r\n\x05store\x18\x02 \x02(\t\x12*\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x1a.voldemort.VoldemortFilter\x12\x37\n\x14replica_to_partition\x18\x04 \x03(\x0b\x32\x19.voldemort.PartitionTuple\x12\x17\n\x0finitial_cluster\x18\x05 \x01(\t\x12\x10\n\x08optimize\x18\x06 \x01(\x08\"1\n\x1b\x41syncOperationStatusRequest\x12\x12\n\nrequest_id\x18\x01 \x02(\x05\"/\n\x19\x41syncOperationStopRequest\x12\x12\n\nrequest_id\x18\x01 \x02(\x05\"=\n\x1a\x41syncOperationStopResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"2\n\x19\x41syncOperationListRequest\x12\x15\n\rshow_complete\x18\x02 \x02(\x08\"R\n\x1a\x41syncOperationListResponse\x12\x13\n\x0brequest_ids\x18\x01 \x03(\x05\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\":\n\x0ePartitionTuple\x12\x14\n\x0creplica_type\x18\x01 \x02(\x05\x12\x12\n\npartitions\x18\x02 \x03(\x05\"e\n\x16PerStorePartitionTuple\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x37\n\x14replica_to_partition\x18\x02 \x03(\x0b\x32\x19.voldemort.PartitionTuple\"\xf8\x01\n\x19RebalancePartitionInfoMap\x12\x12\n\nstealer_id\x18\x01 \x02(\x05\x12\x10\n\x08\x64onor_id\x18\x02 \x02(\x05\x12\x0f\n\x07\x61ttempt\x18\x03 \x02(\x05\x12\x43\n\x18replica_to_add_partition\x18\x04 \x03(\x0b\x32!.voldemort.PerStorePartitionTuple\x12\x46\n\x1breplica_to_delete_partition\x18\x05 \x03(\x0b\x32!.voldemort.PerStorePartitionTuple\x12\x17\n\x0finitial_cluster\x18\x06 \x02(\t\"f\n\x1cInitiateRebalanceNodeRequest\x12\x46\n\x18rebalance_partition_info\x18\x01 \x02(\x0b\x32$.voldemort.RebalancePartitionInfoMap\"m\n#InitiateRebalanceNodeOnDonorRequest\x12\x46\n\x18rebalance_partition_info\x18\x01 \x03(\x0b\x32$.voldemort.RebalancePartitionInfoMap\"\x8a\x01\n\x1c\x41syncOperationStatusResponse\x12\x12\n\nrequest_id\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0e\n\x06status\x18\x03 \x01(\t\x12\x10\n\x08\x63omplete\x18\x04 \x01(\x08\x12\x1f\n\x05\x65rror\x18\x05 \x01(\x0b\x32\x10.voldemort.Error\"\'\n\x16TruncateEntriesRequest\x12\r\n\x05store\x18\x01 \x02(\t\":\n\x17TruncateEntriesResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"*\n\x0f\x41\x64\x64StoreRequest\x12\x17\n\x0fstoreDefinition\x18\x01 \x02(\t\"3\n\x10\x41\x64\x64StoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"\'\n\x12\x44\x65leteStoreRequest\x12\x11\n\tstoreName\x18\x01 \x02(\t\"6\n\x13\x44\x65leteStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"P\n\x11\x46\x65tchStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\x12\x14\n\x0cpush_version\x18\x03 \x01(\x03\"9\n\x10SwapStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\"P\n\x11SwapStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\x12\x1a\n\x12previous_store_dir\x18\x02 \x01(\t\"@\n\x14RollbackStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x14\n\x0cpush_version\x18\x02 \x02(\x03\"8\n\x15RollbackStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"&\n\x10RepairJobRequest\x12\x12\n\nstore_name\x18\x01 \x01(\t\"4\n\x11RepairJobResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"=\n\x14ROStoreVersionDirMap\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\"/\n\x19GetROMaxVersionDirRequest\x12\x12\n\nstore_name\x18\x01 \x03(\t\"y\n\x1aGetROMaxVersionDirResponse\x12:\n\x11ro_store_versions\x18\x01 \x03(\x0b\x32\x1f.voldemort.ROStoreVersionDirMap\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"3\n\x1dGetROCurrentVersionDirRequest\x12\x12\n\nstore_name\x18\x01 \x03(\t\"}\n\x1eGetROCurrentVersionDirResponse\x12:\n\x11ro_store_versions\x18\x01 \x03(\x0b\x32\x1f.voldemort.ROStoreVersionDirMap\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"/\n\x19GetROStorageFormatRequest\x12\x12\n\nstore_name\x18\x01 \x03(\t\"y\n\x1aGetROStorageFormatResponse\x12:\n\x11ro_store_versions\x18\x01 \x03(\x0b\x32\x1f.voldemort.ROStoreVersionDirMap\x12\x1f\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x10.voldemort.Error\"@\n\x17\x46\x61iledFetchStoreRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x11\n\tstore_dir\x18\x02 \x02(\t\";\n\x18\x46\x61iledFetchStoreResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"\xe6\x01\n\x1bRebalanceStateChangeRequest\x12K\n\x1drebalance_partition_info_list\x18\x01 \x03(\x0b\x32$.voldemort.RebalancePartitionInfoMap\x12\x16\n\x0e\x63luster_string\x18\x02 \x02(\t\x12\x0f\n\x07swap_ro\x18\x03 \x02(\x08\x12\x1f\n\x17\x63hange_cluster_metadata\x18\x04 \x02(\x08\x12\x1e\n\x16\x63hange_rebalance_state\x18\x05 \x02(\x08\x12\x10\n\x08rollback\x18\x06 \x02(\x08\"?\n\x1cRebalanceStateChangeResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"G\n DeleteStoreRebalanceStateRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x0f\n\x07node_id\x18\x02 \x02(\x05\"D\n!DeleteStoreRebalanceStateResponse\x12\x1f\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x10.voldemort.Error\"=\n\x13NativeBackupRequest\x12\x12\n\nstore_name\x18\x01 \x02(\t\x12\x12\n\nbackup_dir\x18\x02 \x02(\t\"\xb7\x0e\n\x15VoldemortAdminRequest\x12)\n\x04type\x18\x01 \x02(\x0e\x32\x1b.voldemort.AdminRequestType\x12\x33\n\x0cget_metadata\x18\x02 \x01(\x0b\x32\x1d.voldemort.GetMetadataRequest\x12\x39\n\x0fupdate_metadata\x18\x03 \x01(\x0b\x32 .voldemort.UpdateMetadataRequest\x12J\n\x18update_partition_entries\x18\x04 \x01(\x0b\x32(.voldemort.UpdatePartitionEntriesRequest\x12H\n\x17\x66\x65tch_partition_entries\x18\x05 \x01(\x0b\x32\'.voldemort.FetchPartitionEntriesRequest\x12J\n\x18\x64\x65lete_partition_entries\x18\x06 \x01(\x0b\x32(.voldemort.DeletePartitionEntriesRequest\x12K\n\x19initiate_fetch_and_update\x18\x07 \x01(\x0b\x32(.voldemort.InitiateFetchAndUpdateRequest\x12\x46\n\x16\x61sync_operation_status\x18\x08 \x01(\x0b\x32&.voldemort.AsyncOperationStatusRequest\x12H\n\x17initiate_rebalance_node\x18\t \x01(\x0b\x32\'.voldemort.InitiateRebalanceNodeRequest\x12\x42\n\x14\x61sync_operation_stop\x18\n \x01(\x0b\x32$.voldemort.AsyncOperationStopRequest\x12\x42\n\x14\x61sync_operation_list\x18\x0b \x01(\x0b\x32$.voldemort.AsyncOperationListRequest\x12;\n\x10truncate_entries\x18\x0c \x01(\x0b\x32!.voldemort.TruncateEntriesRequest\x12-\n\tadd_store\x18\r \x01(\x0b\x32\x1a.voldemort.AddStoreRequest\x12\x33\n\x0c\x64\x65lete_store\x18\x0e \x01(\x0b\x32\x1d.voldemort.DeleteStoreRequest\x12\x31\n\x0b\x66\x65tch_store\x18\x0f \x01(\x0b\x32\x1c.voldemort.FetchStoreRequest\x12/\n\nswap_store\x18\x10 \x01(\x0b\x32\x1b.voldemort.SwapStoreRequest\x12\x37\n\x0erollback_store\x18\x11 \x01(\x0b\x32\x1f.voldemort.RollbackStoreRequest\x12\x44\n\x16get_ro_max_version_dir\x18\x12 \x01(\x0b\x32$.voldemort.GetROMaxVersionDirRequest\x12L\n\x1aget_ro_current_version_dir\x18\x13 \x01(\x0b\x32(.voldemort.GetROCurrentVersionDirRequest\x12\x44\n\x15\x66\x65tch_partition_files\x18\x14 \x01(\x0b\x32%.voldemort.FetchPartitionFilesRequest\x12@\n\x13update_slop_entries\x18\x16 \x01(\x0b\x32#.voldemort.UpdateSlopEntriesRequest\x12>\n\x12\x66\x61iled_fetch_store\x18\x18 \x01(\x0b\x32\".voldemort.FailedFetchStoreRequest\x12\x43\n\x15get_ro_storage_format\x18\x19 \x01(\x0b\x32$.voldemort.GetROStorageFormatRequest\x12\x46\n\x16rebalance_state_change\x18\x1a \x01(\x0b\x32&.voldemort.RebalanceStateChangeRequest\x12/\n\nrepair_job\x18\x1b \x01(\x0b\x32\x1b.voldemort.RepairJobRequest\x12X\n initiate_rebalance_node_on_donor\x18\x1c \x01(\x0b\x32..voldemort.InitiateRebalanceNodeOnDonorRequest\x12Q\n\x1c\x64\x65lete_store_rebalance_state\x18\x1d \x01(\x0b\x32+.voldemort.DeleteStoreRebalanceStateRequest\x12\x35\n\rnative_backup\x18\x1e \x01(\x0b\x32\x1e.voldemort.NativeBackupRequest*\xb4\x05\n\x10\x41\x64minRequestType\x12\x10\n\x0cGET_METADATA\x10\x00\x12\x13\n\x0fUPDATE_METADATA\x10\x01\x12\x1c\n\x18UPDATE_PARTITION_ENTRIES\x10\x02\x12\x1b\n\x17\x46\x45TCH_PARTITION_ENTRIES\x10\x03\x12\x1c\n\x18\x44\x45LETE_PARTITION_ENTRIES\x10\x04\x12\x1d\n\x19INITIATE_FETCH_AND_UPDATE\x10\x05\x12\x1a\n\x16\x41SYNC_OPERATION_STATUS\x10\x06\x12\x1b\n\x17INITIATE_REBALANCE_NODE\x10\x07\x12\x18\n\x14\x41SYNC_OPERATION_STOP\x10\x08\x12\x18\n\x14\x41SYNC_OPERATION_LIST\x10\t\x12\x14\n\x10TRUNCATE_ENTRIES\x10\n\x12\r\n\tADD_STORE\x10\x0b\x12\x10\n\x0c\x44\x45LETE_STORE\x10\x0c\x12\x0f\n\x0b\x46\x45TCH_STORE\x10\r\x12\x0e\n\nSWAP_STORE\x10\x0e\x12\x12\n\x0eROLLBACK_STORE\x10\x0f\x12\x1a\n\x16GET_RO_MAX_VERSION_DIR\x10\x10\x12\x1e\n\x1aGET_RO_CURRENT_VERSION_DIR\x10\x11\x12\x19\n\x15\x46\x45TCH_PARTITION_FILES\x10\x12\x12\x17\n\x13UPDATE_SLOP_ENTRIES\x10\x14\x12\x16\n\x12\x46\x41ILED_FETCH_STORE\x10\x16\x12\x19\n\x15GET_RO_STORAGE_FORMAT\x10\x17\x12\x1a\n\x16REBALANCE_STATE_CHANGE\x10\x18\x12\x0e\n\nREPAIR_JOB\x10\x19\x12$\n INITIATE_REBALANCE_NODE_ON_DONOR\x10\x1a\x12 \n\x1c\x44\x45LETE_STORE_REBALANCE_STATE\x10\x1b\x12\x11\n\rNATIVE_BACKUP\x10\x1c\x42-\n\x1cvoldemort.client.protocol.pbB\x0bVAdminProtoH\x01')
_ADMINREQUESTTYPE = descriptor.EnumDescriptor(
name='AdminRequestType',
@@ -122,11 +122,15 @@
name='DELETE_STORE_REBALANCE_STATE', index=25, number=27,
options=None,
type=None),
+ descriptor.EnumValueDescriptor(
+ name='NATIVE_BACKUP', index=26, number=28,
+ options=None,
+ type=None),
],
containing_type=None,
options=None,
- serialized_start=6631,
- serialized_end=7304,
+ serialized_start=6749,
+ serialized_end=7441,
)
@@ -156,6 +160,7 @@
REPAIR_JOB = 25
INITIATE_REBALANCE_NODE_ON_DONOR = 26
DELETE_STORE_REBALANCE_STATE = 27
+NATIVE_BACKUP = 28
@@ -2070,6 +2075,41 @@
)
+_NATIVEBACKUPREQUEST = descriptor.Descriptor(
+ name='NativeBackupRequest',
+ full_name='voldemort.NativeBackupRequest',
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ descriptor.FieldDescriptor(
+ name='store_name', full_name='voldemort.NativeBackupRequest.store_name', index=0,
+ number=1, type=9, cpp_type=9, label=2,
+ has_default_value=False, default_value=unicode("", "utf-8"),
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ options=None),
+ descriptor.FieldDescriptor(
+ name='backup_dir', full_name='voldemort.NativeBackupRequest.backup_dir', index=1,
+ number=2, type=9, cpp_type=9, label=2,
+ has_default_value=False, default_value=unicode("", "utf-8"),
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ options=None),
+ ],
+ extensions=[
+ ],
+ nested_types=[],
+ enum_types=[
+ ],
+ options=None,
+ is_extendable=False,
+ extension_ranges=[],
+ serialized_start=4835,
+ serialized_end=4896,
+)
+
+
_VOLDEMORTADMINREQUEST = descriptor.Descriptor(
name='VoldemortAdminRequest',
full_name='voldemort.VoldemortAdminRequest',
@@ -2266,6 +2306,13 @@
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
+ descriptor.FieldDescriptor(
+ name='native_backup', full_name='voldemort.VoldemortAdminRequest.native_backup', index=27,
+ number=30, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ options=None),
],
extensions=[
],
@@ -2275,8 +2322,8 @@
options=None,
is_extendable=False,
extension_ranges=[],
- serialized_start=4836,
- serialized_end=6628,
+ serialized_start=4899,
+ serialized_end=6746,
)
import voldemort_client_pb2
@@ -2353,6 +2400,7 @@
_VOLDEMORTADMINREQUEST.fields_by_name['repair_job'].message_type = _REPAIRJOBREQUEST
_VOLDEMORTADMINREQUEST.fields_by_name['initiate_rebalance_node_on_donor'].message_type = _INITIATEREBALANCENODEONDONORREQUEST
_VOLDEMORTADMINREQUEST.fields_by_name['delete_store_rebalance_state'].message_type = _DELETESTOREREBALANCESTATEREQUEST
+_VOLDEMORTADMINREQUEST.fields_by_name['native_backup'].message_type = _NATIVEBACKUPREQUEST
class GetMetadataRequest(message.Message):
__metaclass__ = reflection.GeneratedProtocolMessageType
@@ -2678,6 +2726,12 @@ class DeleteStoreRebalanceStateResponse(message.Message):
# @@protoc_insertion_point(class_scope:voldemort.DeleteStoreRebalanceStateResponse)
+class NativeBackupRequest(message.Message):
+ __metaclass__ = reflection.GeneratedProtocolMessageType
+ DESCRIPTOR = _NATIVEBACKUPREQUEST
+
+ # @@protoc_insertion_point(class_scope:voldemort.NativeBackupRequest)
+
class VoldemortAdminRequest(message.Message):
__metaclass__ = reflection.GeneratedProtocolMessageType
DESCRIPTOR = _VOLDEMORTADMINREQUEST
View
38 src/java/voldemort/VoldemortAdminTool.java
@@ -191,6 +191,18 @@ public static void main(String[] args) throws Exception {
.withValuesSeparatedBy(',')
.ofType(Integer.class);
parser.accepts("repair-job", "Clean after rebalancing is done");
+ parser.accepts("native-backup", "Perform a native backup")
+ .withRequiredArg()
+ .describedAs("store-name")
+ .ofType(String.class);
+ parser.accepts("backup-dir")
+ .withRequiredArg()
+ .describedAs("backup-directory")
+ .ofType(String.class);
+ parser.accepts("backup-timeout")
+ .withRequiredArg()
+ .describedAs("minutes to wait for backup completion, default 30 mins")
+ .ofType(Integer.class);
OptionSet options = parser.parse(args);
@@ -206,7 +218,8 @@ public static void main(String[] args) throws Exception {
&& (options.has("add-stores") || options.has("delete-store")
|| options.has("ro-metadata") || options.has("set-metadata")
|| options.has("get-metadata") || options.has("check-metadata") || options.has("key-distribution"))
- || options.has("truncate") || options.has("clear-rebalancing-metadata") || options.has("async"))) {
+ || options.has("truncate") || options.has("clear-rebalancing-metadata")
+ || options.has("async") || options.has("native-backup"))) {
System.err.println("Missing required arguments: " + Joiner.on(", ").join(missing));
printHelp(System.err, parser);
System.exit(1);
@@ -268,11 +281,17 @@ public static void main(String[] args) throws Exception {
if(options.has("repair-job")) {
ops += "l";
}
+ if(options.has("native-backup")) {
+ if(!options.has("backup-dir")) {
+ Utils.croak("A backup directory must be specified with backup-dir option");
+ }
+ ops += "n";
+ }
if(ops.length() < 1) {
Utils.croak("At least one of (delete-partitions, restore, add-node, fetch-entries, "
+ "fetch-keys, add-stores, delete-store, update-entries, get-metadata, ro-metadata, "
- + "set-metadata, check-metadata, key-distribution, clear-rebalancing-metadata, async, repair-job) "
- + "must be specified");
+ + "set-metadata, check-metadata, key-distribution, clear-rebalancing-metadata, async, "
+ + "repair-job, native-backup) must be specified");
}
List<String> storeNames = null;
@@ -421,6 +440,12 @@ public static void main(String[] args) throws Exception {
if(ops.contains("l")) {
executeRepairJob(nodeId, adminClient);
}
+ if(ops.contains("n")) {
+ String backupDir = (String) options.valueOf("backup-dir");
+ String storeName = (String) options.valueOf("native-backup");
+ int timeout = CmdUtils.valueOf(options, "backup-timeout", 30);
+ adminClient.nativeBackup(nodeId, storeName, backupDir, timeout);
+ }
} catch(Exception e) {
e.printStackTrace();
Utils.croak(e.getMessage());
@@ -535,6 +560,8 @@ public static void printHelp(PrintStream stream, OptionParser parser) throws IOE
stream.println("\t\t./bin/voldemort-admin-tool.sh --key-distribution --url [url]");
stream.println("\t4) Clean a node after rebalancing is done");
stream.println("\t\t./bin/voldemort-admin-tool.sh --repair-job --url [url] --node [node-id]");
+ stream.println("\t5) Backup bdb data natively");
+ stream.println("\t\t./bin/voldemort-admin-tool.sh --native-backup [store] --backup-dir [outdir] --backup-timeout [mins] --url [url] --node [node-id]");
parser.printHelpOn(stream);
}
@@ -684,8 +711,9 @@ private static void executeSetMetadata(Integer nodeId,
+ adminClient.getAdminClientCluster()
.getNodeById(currentNodeId)
.getId());
- adminClient.updateRemoteMetadata(currentNodeId, key, Versioned.value(value.toString(),
- updatedVersion));
+ adminClient.updateRemoteMetadata(currentNodeId,
+ key,
+ Versioned.value(value.toString(), updatedVersion));
}
}
View
51 src/java/voldemort/client/protocol/admin/AdminClient.java
@@ -2303,4 +2303,55 @@ private void individualStateChange(int nodeId,
}
}
+ /**
+ * Given a list of partition infos, generates a map of stealer node to list
+ * of partition infos
+ *
+ * @param rebalancePartitionPlanList Complete list of partition plans
+ * @return Flattens it into a map on a per stealer node basis
+ */
+ private HashMap<Integer, List<RebalancePartitionsInfo>> groupPartitionsInfoByStealerNode(List<RebalancePartitionsInfo> rebalancePartitionPlanList) {
+ HashMap<Integer, List<RebalancePartitionsInfo>> stealerNodeToPlan = Maps.newHashMap();
+ if(rebalancePartitionPlanList != null) {
+ for(RebalancePartitionsInfo partitionInfo: rebalancePartitionPlanList) {
+ List<RebalancePartitionsInfo> partitionInfos = stealerNodeToPlan.get(partitionInfo.getStealerId());
+ if(partitionInfos == null) {
+ partitionInfos = Lists.newArrayList();
+ stealerNodeToPlan.put(partitionInfo.getStealerId(), partitionInfos);
+ }
+ partitionInfos.add(partitionInfo);
+ }
+ }
+ return stealerNodeToPlan;
+ }
+
+ /**
+ * Native backup a store
+ *
+ * @param nodeId The node id to backup
+ * @param storeName The name of the store to backup
+ * @param destinationDirPath The destination path
+ * @param minutes to wait for operation to complete
+ */
+ public void nativeBackup(int nodeId, String storeName, String destinationDirPath, int timeOut) {
+
+ VAdminProto.NativeBackupRequest nativeBackupRequest = VAdminProto.NativeBackupRequest.newBuilder()
+ .setStoreName(storeName)
+ .setBackupDir(destinationDirPath)
+ .build();
+ VAdminProto.VoldemortAdminRequest adminRequest = VAdminProto.VoldemortAdminRequest.newBuilder()
+ .setNativeBackup(nativeBackupRequest)
+ .setType(VAdminProto.AdminRequestType.NATIVE_BACKUP)
+ .build();
+ VAdminProto.AsyncOperationStatusResponse.Builder response = sendAndReceive(nodeId,
+ adminRequest,
+ VAdminProto.AsyncOperationStatusResponse.newBuilder());
+
+ if(response.hasError()) {
+ throwException(response.getError());
+ }
+
+ int asyncId = response.getRequestId();
+ waitForCompletion(nodeId, asyncId, timeOut, TimeUnit.MINUTES);
+ }
}
View
551 src/java/voldemort/client/protocol/pb/VAdminProto.java
@@ -36,6 +36,7 @@ public static void registerAllExtensions(
REPAIR_JOB(23, 25),
INITIATE_REBALANCE_NODE_ON_DONOR(24, 26),
DELETE_STORE_REBALANCE_STATE(25, 27),
+ NATIVE_BACKUP(26, 28),
;
@@ -69,6 +70,7 @@ public static AdminRequestType valueOf(int value) {
case 25: return REPAIR_JOB;
case 26: return INITIATE_REBALANCE_NODE_ON_DONOR;
case 27: return DELETE_STORE_REBALANCE_STATE;
+ case 28: return NATIVE_BACKUP;
default: return null;
}
}
@@ -99,7 +101,7 @@ public AdminRequestType findValueByNumber(int number) {
}
private static final AdminRequestType[] VALUES = {
- GET_METADATA, UPDATE_METADATA, UPDATE_PARTITION_ENTRIES, FETCH_PARTITION_ENTRIES, DELETE_PARTITION_ENTRIES, INITIATE_FETCH_AND_UPDATE, ASYNC_OPERATION_STATUS, INITIATE_REBALANCE_NODE, ASYNC_OPERATION_STOP, ASYNC_OPERATION_LIST, TRUNCATE_ENTRIES, ADD_STORE, DELETE_STORE, FETCH_STORE, SWAP_STORE, ROLLBACK_STORE, GET_RO_MAX_VERSION_DIR, GET_RO_CURRENT_VERSION_DIR, FETCH_PARTITION_FILES, UPDATE_SLOP_ENTRIES, FAILED_FETCH_STORE, GET_RO_STORAGE_FORMAT, REBALANCE_STATE_CHANGE, REPAIR_JOB, INITIATE_REBALANCE_NODE_ON_DONOR, DELETE_STORE_REBALANCE_STATE,
+ GET_METADATA, UPDATE_METADATA, UPDATE_PARTITION_ENTRIES, FETCH_PARTITION_ENTRIES, DELETE_PARTITION_ENTRIES, INITIATE_FETCH_AND_UPDATE, ASYNC_OPERATION_STATUS, INITIATE_REBALANCE_NODE, ASYNC_OPERATION_STOP, ASYNC_OPERATION_LIST, TRUNCATE_ENTRIES, ADD_STORE, DELETE_STORE, FETCH_STORE, SWAP_STORE, ROLLBACK_STORE, GET_RO_MAX_VERSION_DIR, GET_RO_CURRENT_VERSION_DIR, FETCH_PARTITION_FILES, UPDATE_SLOP_ENTRIES, FAILED_FETCH_STORE, GET_RO_STORAGE_FORMAT, REBALANCE_STATE_CHANGE, REPAIR_JOB, INITIATE_REBALANCE_NODE_ON_DONOR, DELETE_STORE_REBALANCE_STATE, NATIVE_BACKUP,
};
public static AdminRequestType valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
@@ -19546,6 +19548,337 @@ public Builder clearError() {
// @@protoc_insertion_point(class_scope:voldemort.DeleteStoreRebalanceStateResponse)
}
+ public static final class NativeBackupRequest extends
+ com.google.protobuf.GeneratedMessage {
+ // Use NativeBackupRequest.newBuilder() to construct.
+ private NativeBackupRequest() {
+ initFields();
+ }
+ private NativeBackupRequest(boolean noInit) {}
+
+ private static final NativeBackupRequest defaultInstance;
+ public static NativeBackupRequest getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public NativeBackupRequest getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return voldemort.client.protocol.pb.VAdminProto.internal_static_voldemort_NativeBackupRequest_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return voldemort.client.protocol.pb.VAdminProto.internal_static_voldemort_NativeBackupRequest_fieldAccessorTable;
+ }
+
+ // required string store_name = 1;
+ public static final int STORE_NAME_FIELD_NUMBER = 1;
+ private boolean hasStoreName;
+ private java.lang.String storeName_ = "";
+ public boolean hasStoreName() { return hasStoreName; }
+ public java.lang.String getStoreName() { return storeName_; }
+
+ // required string backup_dir = 2;
+ public static final int BACKUP_DIR_FIELD_NUMBER = 2;
+ private boolean hasBackupDir;
+ private java.lang.String backupDir_ = "";
+ public boolean hasBackupDir() { return hasBackupDir; }
+ public java.lang.String getBackupDir() { return backupDir_; }
+
+ private void initFields() {
+ }
+ public final boolean isInitialized() {
+ if (!hasStoreName) return false;
+ if (!hasBackupDir) return false;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (hasStoreName()) {
+ output.writeString(1, getStoreName());
+ }
+ if (hasBackupDir()) {
+ output.writeString(2, getBackupDir());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (hasStoreName()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(1, getStoreName());
+ }
+ if (hasBackupDir()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(2, getBackupDir());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder> {
+ private voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest result;
+
+ // Construct using voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.newBuilder()
+ private Builder() {}
+
+ private static Builder create() {
+ Builder builder = new Builder();
+ builder.result = new voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest();
+ return builder;
+ }
+
+ protected voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest internalGetResult() {
+ return result;
+ }
+
+ public Builder clear() {
+ if (result == null) {
+ throw new IllegalStateException(
+ "Cannot call clear() after build().");
+ }
+ result = new voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(result);
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.getDescriptor();
+ }
+
+ public voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest getDefaultInstanceForType() {
+ return voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.getDefaultInstance();
+ }
+
+ public boolean isInitialized() {
+ return result.isInitialized();
+ }
+ public voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest build() {
+ if (result != null && !isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return buildPartial();
+ }
+
+ private voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest buildParsed()
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ if (!isInitialized()) {
+ throw newUninitializedMessageException(
+ result).asInvalidProtocolBufferException();
+ }
+ return buildPartial();
+ }
+
+ public voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest buildPartial() {
+ if (result == null) {
+ throw new IllegalStateException(
+ "build() has already been called on this Builder.");
+ }
+ voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest returnMe = result;
+ result = null;
+ return returnMe;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest) {
+ return mergeFrom((voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest other) {
+ if (other == voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.getDefaultInstance()) return this;
+ if (other.hasStoreName()) {
+ setStoreName(other.getStoreName());
+ }
+ if (other.hasBackupDir()) {
+ setBackupDir(other.getBackupDir());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder(
+ this.getUnknownFields());
+ while (true) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ this.setUnknownFields(unknownFields.build());
+ return this;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ this.setUnknownFields(unknownFields.build());
+ return this;
+ }
+ break;
+ }
+ case 10: {
+ setStoreName(input.readString());
+ break;
+ }
+ case 18: {
+ setBackupDir(input.readString());
+ break;
+ }
+ }
+ }
+ }
+
+
+ // required string store_name = 1;
+ public boolean hasStoreName() {
+ return result.hasStoreName();
+ }
+ public java.lang.String getStoreName() {
+ return result.getStoreName();
+ }
+ public Builder setStoreName(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasStoreName = true;
+ result.storeName_ = value;
+ return this;
+ }
+ public Builder clearStoreName() {
+ result.hasStoreName = false;
+ result.storeName_ = getDefaultInstance().getStoreName();
+ return this;
+ }
+
+ // required string backup_dir = 2;
+ public boolean hasBackupDir() {
+ return result.hasBackupDir();
+ }
+ public java.lang.String getBackupDir() {
+ return result.getBackupDir();
+ }
+ public Builder setBackupDir(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasBackupDir = true;
+ result.backupDir_ = value;
+ return this;
+ }
+ public Builder clearBackupDir() {
+ result.hasBackupDir = false;
+ result.backupDir_ = getDefaultInstance().getBackupDir();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:voldemort.NativeBackupRequest)
+ }
+
+ static {
+ defaultInstance = new NativeBackupRequest(true);
+ voldemort.client.protocol.pb.VAdminProto.internalForceInit();
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:voldemort.NativeBackupRequest)
+ }
+
public static final class VoldemortAdminRequest extends
com.google.protobuf.GeneratedMessage {
// Use VoldemortAdminRequest.newBuilder() to construct.
@@ -19762,6 +20095,13 @@ public VoldemortAdminRequest getDefaultInstanceForType() {
public boolean hasDeleteStoreRebalanceState() { return hasDeleteStoreRebalanceState; }
public voldemort.client.protocol.pb.VAdminProto.DeleteStoreRebalanceStateRequest getDeleteStoreRebalanceState() { return deleteStoreRebalanceState_; }
+ // optional .voldemort.NativeBackupRequest native_backup = 30;
+ public static final int NATIVE_BACKUP_FIELD_NUMBER = 30;
+ private boolean hasNativeBackup;
+ private voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest nativeBackup_;
+ public boolean hasNativeBackup() { return hasNativeBackup; }
+ public voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest getNativeBackup() { return nativeBackup_; }
+
private void initFields() {
type_ = voldemort.client.protocol.pb.VAdminProto.AdminRequestType.GET_METADATA;
getMetadata_ = voldemort.client.protocol.pb.VAdminProto.GetMetadataRequest.getDefaultInstance();
@@ -19790,6 +20130,7 @@ private void initFields() {
repairJob_ = voldemort.client.protocol.pb.VAdminProto.RepairJobRequest.getDefaultInstance();
initiateRebalanceNodeOnDonor_ = voldemort.client.protocol.pb.VAdminProto.InitiateRebalanceNodeOnDonorRequest.getDefaultInstance();
deleteStoreRebalanceState_ = voldemort.client.protocol.pb.VAdminProto.DeleteStoreRebalanceStateRequest.getDefaultInstance();
+ nativeBackup_ = voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.getDefaultInstance();
}
public final boolean isInitialized() {
if (!hasType) return false;
@@ -19859,6 +20200,9 @@ public final boolean isInitialized() {
if (hasDeleteStoreRebalanceState()) {
if (!getDeleteStoreRebalanceState().isInitialized()) return false;
}
+ if (hasNativeBackup()) {
+ if (!getNativeBackup().isInitialized()) return false;
+ }
return true;
}
@@ -19946,6 +20290,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
if (hasDeleteStoreRebalanceState()) {
output.writeMessage(29, getDeleteStoreRebalanceState());
}
+ if (hasNativeBackup()) {
+ output.writeMessage(30, getNativeBackup());
+ }
getUnknownFields().writeTo(output);
}
@@ -20063,6 +20410,10 @@ public int getSerializedSize() {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(29, getDeleteStoreRebalanceState());
}
+ if (hasNativeBackup()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(30, getNativeBackup());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -20302,6 +20653,9 @@ public Builder mergeFrom(voldemort.client.protocol.pb.VAdminProto.VoldemortAdmin
if (other.hasDeleteStoreRebalanceState()) {
mergeDeleteStoreRebalanceState(other.getDeleteStoreRebalanceState());
}
+ if (other.hasNativeBackup()) {
+ mergeNativeBackup(other.getNativeBackup());
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -20571,6 +20925,15 @@ public Builder mergeFrom(
setDeleteStoreRebalanceState(subBuilder.buildPartial());
break;
}
+ case 242: {
+ voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.Builder subBuilder = voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.newBuilder();
+ if (hasNativeBackup()) {
+ subBuilder.mergeFrom(getNativeBackup());
+ }
+ input.readMessage(subBuilder, extensionRegistry);
+ setNativeBackup(subBuilder.buildPartial());
+ break;
+ }
}
}
}
@@ -21559,6 +21922,43 @@ public Builder clearDeleteStoreRebalanceState() {
return this;
}
+ // optional .voldemort.NativeBackupRequest native_backup = 30;
+ public boolean hasNativeBackup() {
+ return result.hasNativeBackup();
+ }
+ public voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest getNativeBackup() {
+ return result.getNativeBackup();
+ }
+ public Builder setNativeBackup(voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasNativeBackup = true;
+ result.nativeBackup_ = value;
+ return this;
+ }
+ public Builder setNativeBackup(voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.Builder builderForValue) {
+ result.hasNativeBackup = true;
+ result.nativeBackup_ = builderForValue.build();
+ return this;
+ }
+ public Builder mergeNativeBackup(voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest value) {
+ if (result.hasNativeBackup() &&
+ result.nativeBackup_ != voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.getDefaultInstance()) {
+ result.nativeBackup_ =
+ voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.newBuilder(result.nativeBackup_).mergeFrom(value).buildPartial();
+ } else {
+ result.nativeBackup_ = value;
+ }
+ result.hasNativeBackup = true;
+ return this;
+ }
+ public Builder clearNativeBackup() {
+ result.hasNativeBackup = false;
+ result.nativeBackup_ = voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.getDefaultInstance();
+ return this;
+ }
+
// @@protoc_insertion_point(builder_scope:voldemort.VoldemortAdminRequest)
}
@@ -21842,6 +22242,11 @@ public Builder clearDeleteStoreRebalanceState() {
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_voldemort_DeleteStoreRebalanceStateResponse_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_voldemort_NativeBackupRequest_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_voldemort_NativeBackupRequest_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
internal_static_voldemort_VoldemortAdminRequest_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
@@ -21975,70 +22380,74 @@ public Builder clearDeleteStoreRebalanceState() {
"mort.Error\"G\n DeleteStoreRebalanceStateR" +
"equest\022\022\n\nstore_name\030\001 \002(\t\022\017\n\007node_id\030\002 " +
"\002(\005\"D\n!DeleteStoreRebalanceStateResponse",
- "\022\037\n\005error\030\001 \001(\0132\020.voldemort.Error\"\200\016\n\025Vo" +
- "ldemortAdminRequest\022)\n\004type\030\001 \002(\0162\033.vold" +
- "emort.AdminRequestType\0223\n\014get_metadata\030\002" +
- " \001(\0132\035.voldemort.GetMetadataRequest\0229\n\017u" +
- "pdate_metadata\030\003 \001(\0132 .voldemort.UpdateM" +
- "etadataRequest\022J\n\030update_partition_entri" +
- "es\030\004 \001(\0132(.voldemort.UpdatePartitionEntr" +
- "iesRequest\022H\n\027fetch_partition_entries\030\005 " +
- "\001(\0132\'.voldemort.FetchPartitionEntriesReq" +
- "uest\022J\n\030delete_partition_entries\030\006 \001(\0132(",
- ".voldemort.DeletePartitionEntriesRequest" +
- "\022K\n\031initiate_fetch_and_update\030\007 \001(\0132(.vo" +
- "ldemort.InitiateFetchAndUpdateRequest\022F\n" +
- "\026async_operation_status\030\010 \001(\0132&.voldemor" +
- "t.AsyncOperationStatusRequest\022H\n\027initiat" +
- "e_rebalance_node\030\t \001(\0132\'.voldemort.Initi" +
- "ateRebalanceNodeRequest\022B\n\024async_operati" +
- "on_stop\030\n \001(\0132$.voldemort.AsyncOperation" +
- "StopRequest\022B\n\024async_operation_list\030\013 \001(" +
- "\0132$.voldemort.AsyncOperationListRequest\022",
- ";\n\020truncate_entries\030\014 \001(\0132!.voldemort.Tr" +
- "uncateEntriesRequest\022-\n\tadd_store\030\r \001(\0132" +
- "\032.voldemort.AddStoreRequest\0223\n\014delete_st" +
- "ore\030\016 \001(\0132\035.voldemort.DeleteStoreRequest" +
- "\0221\n\013fetch_store\030\017 \001(\0132\034.voldemort.FetchS" +
- "toreRequest\022/\n\nswap_store\030\020 \001(\0132\033.voldem" +
- "ort.SwapStoreRequest\0227\n\016rollback_store\030\021" +
- " \001(\0132\037.voldemort.RollbackStoreRequest\022D\n" +
- "\026get_ro_max_version_dir\030\022 \001(\0132$.voldemor" +
- "t.GetROMaxVersionDirRequest\022L\n\032get_ro_cu",
- "rrent_version_dir\030\023 \001(\0132(.voldemort.GetR" +
- "OCurrentVersionDirRequest\022D\n\025fetch_parti" +
- "tion_files\030\024 \001(\0132%.voldemort.FetchPartit" +
- "ionFilesRequest\022@\n\023update_slop_entries\030\026" +
- " \001(\0132#.voldemort.UpdateSlopEntriesReques" +
- "t\022>\n\022failed_fetch_store\030\030 \001(\0132\".voldemor" +
- "t.FailedFetchStoreRequest\022C\n\025get_ro_stor" +
- "age_format\030\031 \001(\0132$.voldemort.GetROStorag" +
- "eFormatRequest\022F\n\026rebalance_state_change" +
- "\030\032 \001(\0132&.voldemort.RebalanceStateChangeR",
- "equest\022/\n\nrepair_job\030\033 \001(\0132\033.voldemort.R" +
- "epairJobRequest\022X\n initiate_rebalance_no" +
- "de_on_donor\030\034 \001(\0132..voldemort.InitiateRe" +
- "balanceNodeOnDonorRequest\022Q\n\034delete_stor" +
- "e_rebalance_state\030\035 \001(\0132+.voldemort.Dele" +
- "teStoreRebalanceStateRequest*\241\005\n\020AdminRe" +
- "questType\022\020\n\014GET_METADATA\020\000\022\023\n\017UPDATE_ME" +
- "TADATA\020\001\022\034\n\030UPDATE_PARTITION_ENTRIES\020\002\022\033" +
- "\n\027FETCH_PARTITION_ENTRIES\020\003\022\034\n\030DELETE_PA" +
- "RTITION_ENTRIES\020\004\022\035\n\031INITIATE_FETCH_AND_",
- "UPDATE\020\005\022\032\n\026ASYNC_OPERATION_STATUS\020\006\022\033\n\027" +
- "INITIATE_REBALANCE_NODE\020\007\022\030\n\024ASYNC_OPERA" +
- "TION_STOP\020\010\022\030\n\024ASYNC_OPERATION_LIST\020\t\022\024\n" +
- "\020TRUNCATE_ENTRIES\020\n\022\r\n\tADD_STORE\020\013\022\020\n\014DE" +
- "LETE_STORE\020\014\022\017\n\013FETCH_STORE\020\r\022\016\n\nSWAP_ST" +
- "ORE\020\016\022\022\n\016ROLLBACK_STORE\020\017\022\032\n\026GET_RO_MAX_" +
- "VERSION_DIR\020\020\022\036\n\032GET_RO_CURRENT_VERSION_" +
- "DIR\020\021\022\031\n\025FETCH_PARTITION_FILES\020\022\022\027\n\023UPDA" +
- "TE_SLOP_ENTRIES\020\024\022\026\n\022FAILED_FETCH_STORE\020" +
- "\026\022\031\n\025GET_RO_STORAGE_FORMAT\020\027\022\032\n\026REBALANC",
- "E_STATE_CHANGE\020\030\022\016\n\nREPAIR_JOB\020\031\022$\n INIT" +
- "IATE_REBALANCE_NODE_ON_DONOR\020\032\022 \n\034DELETE" +
- "_STORE_REBALANCE_STATE\020\033B-\n\034voldemort.cl" +
- "ient.protocol.pbB\013VAdminProtoH\001"
+ "\022\037\n\005error\030\001 \001(\0132\020.voldemort.Error\"=\n\023Nat" +
+ "iveBackupRequest\022\022\n\nstore_name\030\001 \002(\t\022\022\n\n" +
+ "backup_dir\030\002 \002(\t\"\267\016\n\025VoldemortAdminReque" +
+ "st\022)\n\004type\030\001 \002(\0162\033.voldemort.AdminReques" +
+ "tType\0223\n\014get_metadata\030\002 \001(\0132\035.voldemort." +
+ "GetMetadataRequest\0229\n\017update_metadata\030\003 " +
+ "\001(\0132 .voldemort.UpdateMetadataRequest\022J\n" +
+ "\030update_partition_entries\030\004 \001(\0132(.voldem" +
+ "ort.UpdatePartitionEntriesRequest\022H\n\027fet" +
+ "ch_partition_entries\030\005 \001(\0132\'.voldemort.F",
+ "etchPartitionEntriesRequest\022J\n\030delete_pa" +
+ "rtition_entries\030\006 \001(\0132(.voldemort.Delete" +
+ "PartitionEntriesRequest\022K\n\031initiate_fetc" +
+ "h_and_update\030\007 \001(\0132(.voldemort.InitiateF" +
+ "etchAndUpdateRequest\022F\n\026async_operation_" +
+ "status\030\010 \001(\0132&.voldemort.AsyncOperationS" +
+ "tatusRequest\022H\n\027initiate_rebalance_node\030" +
+ "\t \001(\0132\'.voldemort.InitiateRebalanceNodeR" +
+ "equest\022B\n\024async_operation_stop\030\n \001(\0132$.v" +
+ "oldemort.AsyncOperationStopRequest\022B\n\024as",
+ "ync_operation_list\030\013 \001(\0132$.voldemort.Asy" +
+ "ncOperationListRequest\022;\n\020truncate_entri" +
+ "es\030\014 \001(\0132!.voldemort.TruncateEntriesRequ" +
+ "est\022-\n\tadd_store\030\r \001(\0132\032.voldemort.AddSt" +
+ "oreRequest\0223\n\014delete_store\030\016 \001(\0132\035.volde" +
+ "mort.DeleteStoreRequest\0221\n\013fetch_store\030\017" +
+ " \001(\0132\034.voldemort.FetchStoreRequest\022/\n\nsw" +
+ "ap_store\030\020 \001(\0132\033.voldemort.SwapStoreRequ" +
+ "est\0227\n\016rollback_store\030\021 \001(\0132\037.voldemort." +
+ "RollbackStoreRequest\022D\n\026get_ro_max_versi",
+ "on_dir\030\022 \001(\0132$.voldemort.GetROMaxVersion" +
+ "DirRequest\022L\n\032get_ro_current_version_dir" +
+ "\030\023 \001(\0132(.voldemort.GetROCurrentVersionDi" +
+ "rRequest\022D\n\025fetch_partition_files\030\024 \001(\0132" +
+ "%.voldemort.FetchPartitionFilesRequest\022@" +
+ "\n\023update_slop_entries\030\026 \001(\0132#.voldemort." +
+ "UpdateSlopEntriesRequest\022>\n\022failed_fetch" +
+ "_store\030\030 \001(\0132\".voldemort.FailedFetchStor" +
+ "eRequest\022C\n\025get_ro_storage_format\030\031 \001(\0132" +
+ "$.voldemort.GetROStorageFormatRequest\022F\n",
+ "\026rebalance_state_change\030\032 \001(\0132&.voldemor" +
+ "t.RebalanceStateChangeRequest\022/\n\nrepair_" +
+ "job\030\033 \001(\0132\033.voldemort.RepairJobRequest\022X" +
+ "\n initiate_rebalance_node_on_donor\030\034 \001(\013" +
+ "2..voldemort.InitiateRebalanceNodeOnDono" +
+ "rRequest\022Q\n\034delete_store_rebalance_state" +
+ "\030\035 \001(\0132+.voldemort.DeleteStoreRebalanceS" +
+ "tateRequest\0225\n\rnative_backup\030\036 \001(\0132\036.vol" +
+ "demort.NativeBackupRequest*\264\005\n\020AdminRequ" +
+ "estType\022\020\n\014GET_METADATA\020\000\022\023\n\017UPDATE_META",
+ "DATA\020\001\022\034\n\030UPDATE_PARTITION_ENTRIES\020\002\022\033\n\027" +
+ "FETCH_PARTITION_ENTRIES\020\003\022\034\n\030DELETE_PART" +
+ "ITION_ENTRIES\020\004\022\035\n\031INITIATE_FETCH_AND_UP" +
+ "DATE\020\005\022\032\n\026ASYNC_OPERATION_STATUS\020\006\022\033\n\027IN" +
+ "ITIATE_REBALANCE_NODE\020\007\022\030\n\024ASYNC_OPERATI" +
+ "ON_STOP\020\010\022\030\n\024ASYNC_OPERATION_LIST\020\t\022\024\n\020T" +
+ "RUNCATE_ENTRIES\020\n\022\r\n\tADD_STORE\020\013\022\020\n\014DELE" +
+ "TE_STORE\020\014\022\017\n\013FETCH_STORE\020\r\022\016\n\nSWAP_STOR" +
+ "E\020\016\022\022\n\016ROLLBACK_STORE\020\017\022\032\n\026GET_RO_MAX_VE" +
+ "RSION_DIR\020\020\022\036\n\032GET_RO_CURRENT_VERSION_DI",
+ "R\020\021\022\031\n\025FETCH_PARTITION_FILES\020\022\022\027\n\023UPDATE" +
+ "_SLOP_ENTRIES\020\024\022\026\n\022FAILED_FETCH_STORE\020\026\022" +
+ "\031\n\025GET_RO_STORAGE_FORMAT\020\027\022\032\n\026REBALANCE_" +
+ "STATE_CHANGE\020\030\022\016\n\nREPAIR_JOB\020\031\022$\n INITIA" +
+ "TE_REBALANCE_NODE_ON_DONOR\020\032\022 \n\034DELETE_S" +
+ "TORE_REBALANCE_STATE\020\033\022\021\n\rNATIVE_BACKUP\020" +
+ "\034B-\n\034voldemort.client.protocol.pbB\013VAdmi" +
+ "nProtoH\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -22477,12 +22886,20 @@ public Builder clearDeleteStoreRebalanceState() {
new java.lang.String[] { "Error", },
voldemort.client.protocol.pb.VAdminProto.DeleteStoreRebalanceStateResponse.class,
voldemort.client.protocol.pb.VAdminProto.DeleteStoreRebalanceStateResponse.Builder.class);
- internal_static_voldemort_VoldemortAdminRequest_descriptor =
+ internal_static_voldemort_NativeBackupRequest_descriptor =
getDescriptor().getMessageTypes().get(54);
+ internal_static_voldemort_NativeBackupRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_voldemort_NativeBackupRequest_descriptor,
+ new java.lang.String[] { "StoreName", "BackupDir", },
+ voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.class,
+ voldemort.client.protocol.pb.VAdminProto.NativeBackupRequest.Builder.class);
+ internal_static_voldemort_VoldemortAdminRequest_descriptor =
+ getDescriptor().getMessageTypes().get(55);
internal_static_voldemort_VoldemortAdminRequest_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_voldemort_VoldemortAdminRequest_descriptor,
- new java.lang.String[] { "Type", "GetMetadata", "UpdateMetadata", "UpdatePartitionEntries", "FetchPartitionEntries", "DeletePartitionEntries", "InitiateFetchAndUpdate", "AsyncOperationStatus", "InitiateRebalanceNode", "AsyncOperationStop", "AsyncOperationList", "TruncateEntries", "AddStore", "DeleteStore", "FetchStore", "SwapStore", "RollbackStore", "GetRoMaxVersionDir", "GetRoCurrentVersionDir", "FetchPartitionFiles", "UpdateSlopEntries", "FailedFetchStore", "GetRoStorageFormat", "RebalanceStateChange", "RepairJob", "InitiateRebalanceNodeOnDonor", "DeleteStoreRebalanceState", },
+ new java.lang.String[] { "Type", "GetMetadata", "UpdateMetadata", "UpdatePartitionEntries", "FetchPartitionEntries", "DeletePartitionEntries", "InitiateFetchAndUpdate", "AsyncOperationStatus", "InitiateRebalanceNode", "AsyncOperationStop", "AsyncOperationList", "TruncateEntries", "AddStore", "DeleteStore", "FetchStore", "SwapStore", "RollbackStore", "GetRoMaxVersionDir", "GetRoCurrentVersionDir", "FetchPartitionFiles", "UpdateSlopEntries", "FailedFetchStore", "GetRoStorageFormat", "RebalanceStateChange", "RepairJob", "InitiateRebalanceNodeOnDonor", "DeleteStoreRebalanceState", "NativeBackup", },
voldemort.client.protocol.pb.VAdminProto.VoldemortAdminRequest.class,
voldemort.client.protocol.pb.VAdminProto.VoldemortAdminRequest.Builder.class);
return null;
View
50 src/java/voldemort/server/protocol/admin/AdminServiceRequestHandler.java
@@ -51,6 +51,7 @@
import voldemort.store.StorageEngine;
import voldemort.store.StoreDefinition;
import voldemort.store.StoreOperationFailureException;
+import voldemort.store.backup.NativeBackupable;
import voldemort.store.metadata.MetadataStore;
import voldemort.store.readonly.FileFetcher;
import voldemort.store.readonly.ReadOnlyStorageConfiguration;
@@ -251,6 +252,9 @@ public StreamRequestHandler handleRequest(final DataInputStream inputStream,
case REPAIR_JOB:
ProtoUtils.writeMessage(outputStream, handleRepairJob(request.getRepairJob()));
break;
+ case NATIVE_BACKUP:
+ ProtoUtils.writeMessage(outputStream, handleNativeBackup(request.getNativeBackup()));
+ break;
default:
throw new VoldemortException("Unkown operation " + request.getType());
}
@@ -1386,4 +1390,50 @@ static ReadOnlyStorageEngine getReadOnlyStorageEngine(MetadataStore metadata,
return storageEngine;
}
+ public VAdminProto.AsyncOperationStatusResponse handleNativeBackup(VAdminProto.NativeBackupRequest request) {
+ final File backupDir = new File(request.getBackupDir());
+ final String storeName = request.getStoreName();
+ int requestId = asyncService.getUniqueRequestId();
+ VAdminProto.AsyncOperationStatusResponse.Builder response = VAdminProto.AsyncOperationStatusResponse.newBuilder()
+ .setRequestId(requestId)
+ .setComplete(false)
+ .setDescription("Native backup")
+ .setStatus("started");
+ try {
+ final StorageEngine storageEngine = getStorageEngine(storeRepository, storeName);
+ final long start = System.currentTimeMillis();
+ if(storageEngine instanceof NativeBackupable) {
+
+ asyncService.submitOperation(requestId, new AsyncOperation(requestId,
+ "Native backup") {
+
+ @Override
+ public void markComplete() {
+ long end = System.currentTimeMillis();
+ status.setStatus("Native backup completed in " + (end - start) + "ms");
+ status.setComplete(true);
+ }
+
+ @Override
+ public void operate() {
+ ((NativeBackupable) storageEngine).nativeBackup(backupDir, status);
+ }
+
+ @Override
+ public void stop() {
+ status.setException(new VoldemortException("Fetcher interrupted"));
+ }
+ });
+ } else {
+ response.setError(ProtoUtils.encodeError(errorCodeMapper,
+ new VoldemortException("Selected store is not native backupable")));
+ }
+
+ } catch(VoldemortException e) {
+ response.setError(ProtoUtils.encodeError(errorCodeMapper, e));
+ logger.error("handleFetchStore failed for request(" + request.toString() + ")", e);
+ }
+
+ return response.build();
+ }
}
View
20 src/java/voldemort/store/backup/NativeBackupable.java
@@ -0,0 +1,20 @@
+package voldemort.store.backup;
+
+import voldemort.server.protocol.admin.AsyncOperationStatus;
+
+import java.io.File;
+
+/**
+ * Storage engines that support native backups, that is, efficient backups to a locally mounted directory that ensure
+ * the integrity of the store, may implement this.
+ */
+public interface NativeBackupable {
+
+ /**
+ * Perform a native backup
+ *
+ * @param toDir The directory to backup to
+ * @param status The async operation status to update/check
+ */
+ public void nativeBackup(File toDir, AsyncOperationStatus status);
+}
View
177 src/java/voldemort/store/bdb/BdbNativeBackup.java
@@ -0,0 +1,177 @@
+package voldemort.store.bdb;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import voldemort.VoldemortException;
+import voldemort.server.protocol.admin.AsyncOperationStatus;
+
+import com.sleepycat.je.DatabaseException;
+import com.sleepycat.je.Environment;
+import com.sleepycat.je.util.DbBackup;
+
+/**
+ * Handles native backups for the BDB storage engine
+ */
+public class BdbNativeBackup {
+
+ public static final String BDB_EXT = ".jdb";
+
+ private final Environment env;
+ private final File databaseDir;
+
+ public BdbNativeBackup(Environment env) {
+ this.env = env;
+ this.databaseDir = env.getHome();
+ }
+
+ public void performBackup(File backupDir, AsyncOperationStatus status) {
+ // Find the file number of the last file in the previous backup
+ // persistently, by either checking the backup archive, or saving
+ // state in a persistent file.
+ Long lastFileInPrevBackup = determineLastFile(backupDir, status);
+
+ try {
+ DbBackup backupHelper;
+
+ if(lastFileInPrevBackup == null) {
+ backupHelper = new DbBackup(env);
+ } else {
+ backupHelper = new DbBackup(env, lastFileInPrevBackup);
+ }
+
+ // Start backup, find out what needs to be copied.
+ backupHelper.startBackup();
+ try {
+ String[] filesForBackup = backupHelper.getLogFilesInBackupSet();
+
+ // Copy the files to archival storage.
+ backupFiles(filesForBackup, backupDir, status);
+ } finally {
+ // Remember to exit backup mode, or all log files won't be
+ // cleaned and disk usage will bloat.
+ backupHelper.endBackup();
+ }
+ } catch(DatabaseException e) {
+ throw new VoldemortException("Error performing native backup", e);
+ }
+ }
+
+ private Long determineLastFile(File backupDir, final AsyncOperationStatus status) {
+ status.setStatus("Determining the last backed up file...");
+ File[] backupFiles = backupDir.listFiles(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ if(!name.endsWith(BDB_EXT)) {
+ return false;
+ }
+ String part = name.substring(0, name.length() - BDB_EXT.length());
@bbansal
bbansal added a note Jan 7, 2012

cant we have files which changed after the last snapshot ?

timestamp1 : 0001.bdb, 0002.bdb .. 000x.bdb
timestamp2: 0001.bdb, 0002.bdb .. 000x.bdb ... 0000y.bdb

I thought 0000x.bdb can still have more appends during timestamp1 -- timestamp2, can we check this for correctness ?

@vinothchandar
Owner
vinothchandar added a note Jan 7, 2012

Hmmm.. I was assuming that start backup call would necessitate the creation of a new log file, while we are in this backup mode. I.e writes happening during the backup, should go to a new file. This seems like a very basic guarantee DbBackup should give. [If not, I am not sure what it is actually doing :)] However will confirm on monday doing some tests. - cheers, vinoth

@vinothchandar
Owner

Confirmed this. writes after the startBackup() call goes to a new jdb file.

@bbansal
bbansal added a note Jan 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ try {
+ Long.parseLong(part);
@vinothchandar
Owner
vinothchandar added a note Jan 6, 2012

This also changed to Long.parseLong(part, 16)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ } catch(NumberFormatException nfe) {
+ status.setStatus("Warning: " + BDB_EXT
+ + " file whose name is not a number, ignoring: " + name);
+ return false;
+ }
+ return true;
+ }
+ });
+ if(backupFiles.length == 0) {
+ status.setStatus("No backup files found, assuming a full backup is required.");
+ return null;
+ }
+ long largest = Long.MIN_VALUE;
+ for(File file: backupFiles) {
+ long value = fileNameToNumber(file.getName());
+ if(value > largest) {
+ largest = value;
+ }
+ }
+ status.setStatus("Last backed up file was " + largest);
+ return largest;
+ }
+
+ private void backupFiles(String[] filesForBackup, File backupDir, AsyncOperationStatus status) {
+ // Determine size of backup
+ long size = 0;
+ for(String name: filesForBackup) {
+ size += new File(databaseDir, name).length();
+ }
+ status.setStatus(String.format("Backing up %d files with a total of %.1fMB",
+ filesForBackup.length,
+ mb(size)));
+
+ // Ensure files are sorted in order, so that if we fail part way
+ // through, we don't lose stuff
+ Arrays.sort(filesForBackup, new Comparator<String>() {
+
+ public int compare(String o1, String o2) {
+ long result = fileNameToNumber(o1) - fileNameToNumber(o2);
+ if(result < 0) {
+ return -1;
+ } else if(result > 0) {
+ return 1;
+ }
+ return 0;
+ }
+ });
+ long total = 0;
+ for(String name: filesForBackup) {
+ File source = new File(databaseDir, name);
+ File dest = new File(backupDir, name);
+ status.setStatus(String.format("% 3d%% Copying %s", total * 100 / size, name));
+ try {
+ copyFile(source, dest);
+ } catch(IOException e) {
+ // If the destination file exists, delete it
+ if(dest.exists()) {
+ dest.delete();
+ }
+ throw new VoldemortException("Error occured while copying "
+ + name
+ + ". Deleting to ensure we don't have a corrupt backup.",
+ e);
+ }
+ total += source.length();
+ }
+
+ }
+
+ // Fast NIO copy method
+ private void copyFile(File sourceFile, File destFile) throws IOException {
+ if(!destFile.exists()) {
+ destFile.createNewFile();
+ }
+
+ FileChannel source = null;
+ FileChannel destination = null;
+ try {
+ source = new FileInputStream(sourceFile).getChannel();
+ destination = new FileOutputStream(destFile).getChannel();
+ destination.transferFrom(source, 0, source.size());
+ } finally {
+ if(source != null) {
+ source.close();
+ }
+ if(destination != null) {
+ destination.close();
+ }
+ }
+ }
+
+ private static long fileNameToNumber(String name) {
+ String part = name.substring(0, name.length() - BDB_EXT.length());
+ return Long.parseLong(part, 16);
+ }
+
+ private static double mb(long value) {
+ return ((double) value) / 1048576;
+ }
+
+}
View
10 src/java/voldemort/store/bdb/BdbStorageEngine.java
@@ -16,6 +16,7 @@
package voldemort.store.bdb;
+import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -28,13 +29,15 @@
import voldemort.serialization.IdentitySerializer;
import voldemort.serialization.Serializer;
import voldemort.serialization.VersionedSerializer;
+import voldemort.server.protocol.admin.AsyncOperationStatus;
import voldemort.store.NoSuchCapabilityException;
import voldemort.store.PersistenceFailureException;
import voldemort.store.StorageEngine;
import voldemort.store.StorageInitializationException;
import voldemort.store.Store;
import voldemort.store.StoreCapabilityType;
import voldemort.store.StoreUtils;
+import voldemort.store.backup.NativeBackupable;
import voldemort.store.bdb.stats.BdbEnvironmentStats;
import voldemort.utils.ByteArray;
import voldemort.utils.ByteUtils;
@@ -56,7 +59,6 @@
import com.sleepycat.je.Environment;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
-import com.sleepycat.je.PreloadConfig;
import com.sleepycat.je.StatsConfig;
import com.sleepycat.je.Transaction;
@@ -65,7 +67,7 @@
*
*
*/
-public class BdbStorageEngine implements StorageEngine<ByteArray, byte[], byte[]> {
+public class BdbStorageEngine implements StorageEngine<ByteArray, byte[], byte[]>, NativeBackupable {
private static final Logger logger = Logger.getLogger(BdbStorageEngine.class);
private static final Hex hexCodec = new Hex();
@@ -571,4 +573,8 @@ protected void moveCursor(DatabaseEntry key, DatabaseEntry value) throws Databas
public boolean isPartitionAware() {
return false;
}
+
+ public void nativeBackup(File toDir, AsyncOperationStatus status) {
+ new BdbNativeBackup(environment).performBackup(toDir, status);
+ }
}
View
7 src/proto/voldemort-admin.proto
@@ -278,6 +278,11 @@ message DeleteStoreRebalanceStateResponse {
optional Error error = 1;
}
+message NativeBackupRequest {
+ required string store_name = 1;
+ required string backup_dir = 2;
+}
+
enum AdminRequestType {
GET_METADATA = 0;
UPDATE_METADATA = 1;
@@ -305,6 +310,7 @@ enum AdminRequestType {
REPAIR_JOB = 25;
INITIATE_REBALANCE_NODE_ON_DONOR = 26;
DELETE_STORE_REBALANCE_STATE = 27;
+ NATIVE_BACKUP = 28;
}
message VoldemortAdminRequest {
@@ -335,4 +341,5 @@ message VoldemortAdminRequest {
optional RepairJobRequest repair_job = 27;
optional InitiateRebalanceNodeOnDonorRequest initiate_rebalance_node_on_donor = 28;
optional DeleteStoreRebalanceStateRequest delete_store_rebalance_state = 29;
+ optional NativeBackupRequest native_backup = 30;
}
View
39 test/unit/voldemort/store/bdb/BdbStorageEngineTest.java
@@ -17,6 +17,7 @@
package voldemort.store.bdb;
import java.io.File;
+import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
@@ -29,6 +30,7 @@
import org.apache.commons.io.FileDeleteStrategy;
import voldemort.TestUtils;
+import voldemort.server.protocol.admin.AsyncOperationStatus;
import voldemort.store.AbstractStorageEngineTest;
import voldemort.store.StorageEngine;
import voldemort.utils.ByteArray;
@@ -209,4 +211,41 @@ public void run() {
executor.shutdown();
assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS));
}
+
+ public void testNativeBackup() throws Exception {
+ File backupToDir = File.createTempFile("bdb-storage", "bkp");
+ backupToDir.delete();
+ backupToDir.mkdir();
+ try {
+ store.nativeBackup(backupToDir, new AsyncOperationStatus(0, "dummy"));
+ // Check that one file was copied
+ assertArrayEquals(backupToDir.list(), new String[]{"00000000.jdb"});
+ long backupFileModified = backupToDir.listFiles()[0].lastModified();
+
+ store.nativeBackup(backupToDir, new AsyncOperationStatus(0, "dummy"));
+ // Check that there are now two files, and the first one hasn't changed
+ assertArrayEquals(backupToDir.list(), new String[]{"00000000.jdb", "00000001.jdb"});
+ assertEquals(backupFileModified, backupToDir.listFiles()[0].lastModified());
+ } finally {
+ deleteDir(backupToDir);
+ }
+
+ }
+
+ private static void assertArrayEquals(Object[] expected, Object[] actual) {
+ String error = Arrays.toString(expected) + " does not equal " + Arrays.toString(actual);
+ assertEquals(error, expected.length, actual.length);
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(error, expected[i], actual[i]);
+ }
+ }
+
+ private boolean deleteDir(File dir) {
+ if (dir.isDirectory()) {
+ for (File file : dir.listFiles()) {
+ deleteDir(file);
+ }
+ }
+ return dir.delete();
+ }
}

3 comments on commit 4918633

@bbansal
bbansal commented on 4918633 Jan 7, 2012

pretty sweet patch will love to get it on the master branch, let me know if I can help with something.

@vinothchandar
Owner

sure will keep you posted..

@vinothchandar
Owner

Hi Bhupesh, FYI,I am going to implement support for incremental backups and logverfiication and pull this in..

Please sign in to comment.
Something went wrong with that request. Please try again.