diff --git a/src/frontend/edu/brown/hstore/AntiCacheManager.java b/src/frontend/edu/brown/hstore/AntiCacheManager.java index e05a9eb38d..8662b7849b 100644 --- a/src/frontend/edu/brown/hstore/AntiCacheManager.java +++ b/src/frontend/edu/brown/hstore/AntiCacheManager.java @@ -32,6 +32,7 @@ import com.google.protobuf.RpcCallback; import edu.brown.catalog.CatalogUtil; +import edu.brown.hstore.Hstoreservice.HStoreService; import edu.brown.hstore.Hstoreservice.Status; import edu.brown.hstore.conf.HStoreConf; import edu.brown.hstore.internal.UtilityWorkMessage.TableStatsRequestMessage; @@ -263,9 +264,15 @@ public Runnable getMemoryMonitorThread() { protected void processingCallback(QueueEntry next) { assert(next.ts.isInitialized()) : String.format("Unexpected uninitialized transaction handle: %s", next); - assert(next.partition == next.ts.getBasePartition()) : - String.format("The base partition for %s is %d but we want to fetch a block for partition %d: %s", - next.ts, next.ts.getBasePartition(), next.partition, next); + if(next.partition != next.ts.getBasePartition()) { // distributed txn + LOG.debug(String.format("The base partition for %s is %d but we want to fetch a block for partition %d: %s", + next.ts, next.ts.getBasePartition(), next.partition, next)); + System.out.println(String.format("The base partition for %s is %d but we want to fetch a block for partition %d: %s", + next.ts, next.ts.getBasePartition(), next.partition, next)); + // if we are the remote site then we should go ahead and continue processing + // if no then we should simply requeue the entry? + + } LOG.debug("Processing " + next); // We need to get the EE handle for the partition that this txn @@ -339,15 +346,27 @@ protected void removeCallback(QueueEntry next) { * - The list of blockIds that need to be read in for the table */ public boolean queue(LocalTransaction ts, int partition, Table catalog_tbl, short block_ids[], int tuple_offsets[]) { - - // if (hstore_conf.site.anticache_profiling) { - assert(ts.getPendingError() != null) : - String.format("Missing original %s for %s", EvictedTupleAccessException.class.getSimpleName(), ts); - assert(ts.getPendingError() instanceof EvictedTupleAccessException) : - String.format("Unexpected error for %s: %s", ts, ts.getPendingError().getClass().getSimpleName()); - this.profilers[partition].restarted_txns++; - this.profilers[partition].addEvictedAccess(ts, (EvictedTupleAccessException)ts.getPendingError()); - // } + System.out.println(ts.getBasePartition()+"*********"+partition); + if(ts.getBasePartition()!=partition){ // different partition generated the exception + int site_id = hstore_site.getCatalogContext().getSiteIdForPartitionId(partition); + return hstore_site.getCoordinator().sendUnevictDataMessage(site_id); + // should we enqueue the transaction on our side? + // if yes then we need to prevent the queue item from being picked up + // and prevent it from bombing the partition error + // if no then simply return? + + // how to take care of LRU? + + } + + if (hstore_conf.site.anticache_profiling) { + assert(ts.getPendingError() != null) : + String.format("Missing original %s for %s", EvictedTupleAccessException.class.getSimpleName(), ts); + assert(ts.getPendingError() instanceof EvictedTupleAccessException) : + String.format("Unexpected error for %s: %s", ts, ts.getPendingError().getClass().getSimpleName()); + this.profilers[partition].restarted_txns++; + this.profilers[partition].addEvictedAccess(ts, (EvictedTupleAccessException)ts.getPendingError()); + } QueueEntry e = new QueueEntry(ts, partition, catalog_tbl, block_ids, tuple_offsets); diff --git a/src/frontend/edu/brown/hstore/HStoreCoordinator.java b/src/frontend/edu/brown/hstore/HStoreCoordinator.java index 0bc379fb8c..dd5f349cff 100644 --- a/src/frontend/edu/brown/hstore/HStoreCoordinator.java +++ b/src/frontend/edu/brown/hstore/HStoreCoordinator.java @@ -65,6 +65,8 @@ import edu.brown.hstore.Hstoreservice.TransactionReduceResponse; import edu.brown.hstore.Hstoreservice.TransactionWorkRequest; import edu.brown.hstore.Hstoreservice.TransactionWorkResponse; +import edu.brown.hstore.Hstoreservice.UnevictDataRequest; +import edu.brown.hstore.Hstoreservice.UnevictDataResponse; import edu.brown.hstore.Hstoreservice.WorkFragment; import edu.brown.hstore.callbacks.ShutdownPrepareCallback; import edu.brown.hstore.callbacks.LocalFinishCallback; @@ -245,6 +247,25 @@ public void run(HeartbeatResponse response) { } }; + // ---------------------------------------------------------------------------- + // UNEVICT CALLBACK + // ---------------------------------------------------------------------------- + + private final RpcCallback unevictCallback = new RpcCallback() { + @Override + public void run(UnevictDataResponse response) { + if (response.getStatus() == Status.OK) { + if (trace.val) + LOG.trace(String.format("%s %s -> %s [%s]", + response.getClass().getSimpleName(), + HStoreThreadManager.formatSiteName(response.getSenderSite()), + HStoreThreadManager.formatSiteName(local_site_id), + response.getStatus())); + assert(response.getSenderSite() != local_site_id); + } + } + }; + // ---------------------------------------------------------------------------- // INITIALIZATION // ---------------------------------------------------------------------------- @@ -795,6 +816,21 @@ public void transactionDebug(RpcController controller, TransactionDebugRequest r done.run(response); } + @Override + public void unevictData(RpcController controller, + UnevictDataRequest request, + RpcCallback done) { + if (debug.val) + LOG.debug(String.format("Received %s from HStoreSite %s", + request.getClass().getSimpleName(), + HStoreThreadManager.formatSiteName(request.getSenderSite()))); + UnevictDataResponse.Builder builder = UnevictDataResponse.newBuilder() + .setSenderSite(local_site_id) + .setStatus(Status.OK); + done.run(builder.build()); + + } + } // END CLASS @@ -1273,6 +1309,35 @@ public void sendHeartbeat() { } } // FOR } + + // ---------------------------------------------------------------------------- + // UNEVICT DATA + // ---------------------------------------------------------------------------- + + /** + * Send a message to a remote site to unevict data + * @return + */ + public boolean sendUnevictDataMessage(int remote_site_id) { + UnevictDataRequest request = UnevictDataRequest.newBuilder() + .setSenderSite(this.local_site_id) + .setLastTransactionId(-1) // FIXME + .build(); + try { + this.channels[remote_site_id].unevictData(new ProtoRpcController(), request, this.unevictCallback); + if (trace.val) + LOG.trace(String.format("Sent %s to %s", + request.getClass().getSimpleName(), + HStoreThreadManager.formatSiteName(remote_site_id))); + return true; + } catch (RuntimeException ex) { + // Silently ignore these errors... + ex.printStackTrace(); + System.out.println("&&&&&&&&&&"); + return false; + } + + } // ---------------------------------------------------------------------------- // TIME SYNCHRONZIATION diff --git a/src/protorpc/edu/brown/hstore/Hstoreservice.java b/src/protorpc/edu/brown/hstore/Hstoreservice.java index e09a9964f8..084fbee088 100644 --- a/src/protorpc/edu/brown/hstore/Hstoreservice.java +++ b/src/protorpc/edu/brown/hstore/Hstoreservice.java @@ -14408,6 +14408,666 @@ public Builder clearStatus() { // @@protoc_insertion_point(class_scope:edu.brown.hstore.HeartbeatResponse) } + public static final class UnevictDataRequest extends + com.google.protobuf.GeneratedMessage { + // Use UnevictDataRequest.newBuilder() to construct. + private UnevictDataRequest() { + initFields(); + } + private UnevictDataRequest(boolean noInit) {} + + private static final UnevictDataRequest defaultInstance; + public static UnevictDataRequest getDefaultInstance() { + return defaultInstance; + } + + public UnevictDataRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return edu.brown.hstore.Hstoreservice.internal_static_edu_brown_hstore_UnevictDataRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return edu.brown.hstore.Hstoreservice.internal_static_edu_brown_hstore_UnevictDataRequest_fieldAccessorTable; + } + + // required int32 sender_site = 1; + public static final int SENDER_SITE_FIELD_NUMBER = 1; + private boolean hasSenderSite; + private int senderSite_ = 0; + public boolean hasSenderSite() { return hasSenderSite; } + public int getSenderSite() { return senderSite_; } + + // required int64 last_transaction_id = 2; + public static final int LAST_TRANSACTION_ID_FIELD_NUMBER = 2; + private boolean hasLastTransactionId; + private long lastTransactionId_ = 0L; + public boolean hasLastTransactionId() { return hasLastTransactionId; } + public long getLastTransactionId() { return lastTransactionId_; } + + private void initFields() { + } + public final boolean isInitialized() { + if (!hasSenderSite) return false; + if (!hasLastTransactionId) return false; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasSenderSite()) { + output.writeInt32(1, getSenderSite()); + } + if (hasLastTransactionId()) { + output.writeInt64(2, getLastTransactionId()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasSenderSite()) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, getSenderSite()); + } + if (hasLastTransactionId()) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, getLastTransactionId()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest 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 edu.brown.hstore.Hstoreservice.UnevictDataRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataRequest 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(edu.brown.hstore.Hstoreservice.UnevictDataRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private edu.brown.hstore.Hstoreservice.UnevictDataRequest result; + + // Construct using edu.brown.hstore.Hstoreservice.UnevictDataRequest.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new edu.brown.hstore.Hstoreservice.UnevictDataRequest(); + return builder; + } + + protected edu.brown.hstore.Hstoreservice.UnevictDataRequest internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new edu.brown.hstore.Hstoreservice.UnevictDataRequest(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return edu.brown.hstore.Hstoreservice.UnevictDataRequest.getDescriptor(); + } + + public edu.brown.hstore.Hstoreservice.UnevictDataRequest getDefaultInstanceForType() { + return edu.brown.hstore.Hstoreservice.UnevictDataRequest.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public edu.brown.hstore.Hstoreservice.UnevictDataRequest build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private edu.brown.hstore.Hstoreservice.UnevictDataRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public edu.brown.hstore.Hstoreservice.UnevictDataRequest buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + edu.brown.hstore.Hstoreservice.UnevictDataRequest returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof edu.brown.hstore.Hstoreservice.UnevictDataRequest) { + return mergeFrom((edu.brown.hstore.Hstoreservice.UnevictDataRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(edu.brown.hstore.Hstoreservice.UnevictDataRequest other) { + if (other == edu.brown.hstore.Hstoreservice.UnevictDataRequest.getDefaultInstance()) return this; + if (other.hasSenderSite()) { + setSenderSite(other.getSenderSite()); + } + if (other.hasLastTransactionId()) { + setLastTransactionId(other.getLastTransactionId()); + } + 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 8: { + setSenderSite(input.readInt32()); + break; + } + case 16: { + setLastTransactionId(input.readInt64()); + break; + } + } + } + } + + + // required int32 sender_site = 1; + public boolean hasSenderSite() { + return result.hasSenderSite(); + } + public int getSenderSite() { + return result.getSenderSite(); + } + public Builder setSenderSite(int value) { + result.hasSenderSite = true; + result.senderSite_ = value; + return this; + } + public Builder clearSenderSite() { + result.hasSenderSite = false; + result.senderSite_ = 0; + return this; + } + + // required int64 last_transaction_id = 2; + public boolean hasLastTransactionId() { + return result.hasLastTransactionId(); + } + public long getLastTransactionId() { + return result.getLastTransactionId(); + } + public Builder setLastTransactionId(long value) { + result.hasLastTransactionId = true; + result.lastTransactionId_ = value; + return this; + } + public Builder clearLastTransactionId() { + result.hasLastTransactionId = false; + result.lastTransactionId_ = 0L; + return this; + } + + // @@protoc_insertion_point(builder_scope:edu.brown.hstore.UnevictDataRequest) + } + + static { + defaultInstance = new UnevictDataRequest(true); + edu.brown.hstore.Hstoreservice.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:edu.brown.hstore.UnevictDataRequest) + } + + public static final class UnevictDataResponse extends + com.google.protobuf.GeneratedMessage { + // Use UnevictDataResponse.newBuilder() to construct. + private UnevictDataResponse() { + initFields(); + } + private UnevictDataResponse(boolean noInit) {} + + private static final UnevictDataResponse defaultInstance; + public static UnevictDataResponse getDefaultInstance() { + return defaultInstance; + } + + public UnevictDataResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return edu.brown.hstore.Hstoreservice.internal_static_edu_brown_hstore_UnevictDataResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return edu.brown.hstore.Hstoreservice.internal_static_edu_brown_hstore_UnevictDataResponse_fieldAccessorTable; + } + + // required int32 sender_site = 1; + public static final int SENDER_SITE_FIELD_NUMBER = 1; + private boolean hasSenderSite; + private int senderSite_ = 0; + public boolean hasSenderSite() { return hasSenderSite; } + public int getSenderSite() { return senderSite_; } + + // required .edu.brown.hstore.Status status = 2; + public static final int STATUS_FIELD_NUMBER = 2; + private boolean hasStatus; + private edu.brown.hstore.Hstoreservice.Status status_; + public boolean hasStatus() { return hasStatus; } + public edu.brown.hstore.Hstoreservice.Status getStatus() { return status_; } + + private void initFields() { + status_ = edu.brown.hstore.Hstoreservice.Status.OK; + } + public final boolean isInitialized() { + if (!hasSenderSite) return false; + if (!hasStatus) return false; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasSenderSite()) { + output.writeInt32(1, getSenderSite()); + } + if (hasStatus()) { + output.writeEnum(2, getStatus().getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasSenderSite()) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, getSenderSite()); + } + if (hasStatus()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, getStatus().getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse 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 edu.brown.hstore.Hstoreservice.UnevictDataResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static edu.brown.hstore.Hstoreservice.UnevictDataResponse 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(edu.brown.hstore.Hstoreservice.UnevictDataResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private edu.brown.hstore.Hstoreservice.UnevictDataResponse result; + + // Construct using edu.brown.hstore.Hstoreservice.UnevictDataResponse.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new edu.brown.hstore.Hstoreservice.UnevictDataResponse(); + return builder; + } + + protected edu.brown.hstore.Hstoreservice.UnevictDataResponse internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new edu.brown.hstore.Hstoreservice.UnevictDataResponse(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDescriptor(); + } + + public edu.brown.hstore.Hstoreservice.UnevictDataResponse getDefaultInstanceForType() { + return edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public edu.brown.hstore.Hstoreservice.UnevictDataResponse build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private edu.brown.hstore.Hstoreservice.UnevictDataResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public edu.brown.hstore.Hstoreservice.UnevictDataResponse buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + edu.brown.hstore.Hstoreservice.UnevictDataResponse returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof edu.brown.hstore.Hstoreservice.UnevictDataResponse) { + return mergeFrom((edu.brown.hstore.Hstoreservice.UnevictDataResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(edu.brown.hstore.Hstoreservice.UnevictDataResponse other) { + if (other == edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDefaultInstance()) return this; + if (other.hasSenderSite()) { + setSenderSite(other.getSenderSite()); + } + if (other.hasStatus()) { + setStatus(other.getStatus()); + } + 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 8: { + setSenderSite(input.readInt32()); + break; + } + case 16: { + int rawValue = input.readEnum(); + edu.brown.hstore.Hstoreservice.Status value = edu.brown.hstore.Hstoreservice.Status.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + setStatus(value); + } + break; + } + } + } + } + + + // required int32 sender_site = 1; + public boolean hasSenderSite() { + return result.hasSenderSite(); + } + public int getSenderSite() { + return result.getSenderSite(); + } + public Builder setSenderSite(int value) { + result.hasSenderSite = true; + result.senderSite_ = value; + return this; + } + public Builder clearSenderSite() { + result.hasSenderSite = false; + result.senderSite_ = 0; + return this; + } + + // required .edu.brown.hstore.Status status = 2; + public boolean hasStatus() { + return result.hasStatus(); + } + public edu.brown.hstore.Hstoreservice.Status getStatus() { + return result.getStatus(); + } + public Builder setStatus(edu.brown.hstore.Hstoreservice.Status value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasStatus = true; + result.status_ = value; + return this; + } + public Builder clearStatus() { + result.hasStatus = false; + result.status_ = edu.brown.hstore.Hstoreservice.Status.OK; + return this; + } + + // @@protoc_insertion_point(builder_scope:edu.brown.hstore.UnevictDataResponse) + } + + static { + defaultInstance = new UnevictDataResponse(true); + edu.brown.hstore.Hstoreservice.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:edu.brown.hstore.UnevictDataResponse) + } + public static final class TimeSyncRequest extends com.google.protobuf.GeneratedMessage { // Use TimeSyncRequest.newBuilder() to construct. @@ -15213,6 +15873,11 @@ public abstract void heartbeat( edu.brown.hstore.Hstoreservice.HeartbeatRequest request, com.google.protobuf.RpcCallback done); + public abstract void unevictData( + com.google.protobuf.RpcController controller, + edu.brown.hstore.Hstoreservice.UnevictDataRequest request, + com.google.protobuf.RpcCallback done); + public abstract void timeSync( com.google.protobuf.RpcController controller, edu.brown.hstore.Hstoreservice.TimeSyncRequest request, @@ -15335,6 +16000,14 @@ public void heartbeat( impl.heartbeat(controller, request, done); } + @Override + public void unevictData( + com.google.protobuf.RpcController controller, + edu.brown.hstore.Hstoreservice.UnevictDataRequest request, + com.google.protobuf.RpcCallback done) { + impl.unevictData(controller, request, done); + } + @Override public void timeSync( com.google.protobuf.RpcController controller, @@ -15394,6 +16067,8 @@ public final com.google.protobuf.Message callBlockingMethod( case 13: return impl.heartbeat(controller, (edu.brown.hstore.Hstoreservice.HeartbeatRequest)request); case 14: + return impl.unevictData(controller, (edu.brown.hstore.Hstoreservice.UnevictDataRequest)request); + case 15: return impl.timeSync(controller, (edu.brown.hstore.Hstoreservice.TimeSyncRequest)request); default: throw new java.lang.AssertionError("Can't get here."); @@ -15438,6 +16113,8 @@ public final com.google.protobuf.Message callBlockingMethod( case 13: return edu.brown.hstore.Hstoreservice.HeartbeatRequest.getDefaultInstance(); case 14: + return edu.brown.hstore.Hstoreservice.UnevictDataRequest.getDefaultInstance(); + case 15: return edu.brown.hstore.Hstoreservice.TimeSyncRequest.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); @@ -15482,6 +16159,8 @@ public final com.google.protobuf.Message callBlockingMethod( case 13: return edu.brown.hstore.Hstoreservice.HeartbeatResponse.getDefaultInstance(); case 14: + return edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDefaultInstance(); + case 15: return edu.brown.hstore.Hstoreservice.TimeSyncResponse.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); @@ -15561,6 +16240,11 @@ public abstract void heartbeat( edu.brown.hstore.Hstoreservice.HeartbeatRequest request, com.google.protobuf.RpcCallback done); + public abstract void unevictData( + com.google.protobuf.RpcController controller, + edu.brown.hstore.Hstoreservice.UnevictDataRequest request, + com.google.protobuf.RpcCallback done); + public abstract void timeSync( com.google.protobuf.RpcController controller, edu.brown.hstore.Hstoreservice.TimeSyncRequest request, @@ -15659,6 +16343,11 @@ public final void callMethod( done)); return; case 14: + this.unevictData(controller, (edu.brown.hstore.Hstoreservice.UnevictDataRequest)request, + com.google.protobuf.RpcUtil.specializeCallback( + done)); + return; + case 15: this.timeSync(controller, (edu.brown.hstore.Hstoreservice.TimeSyncRequest)request, com.google.protobuf.RpcUtil.specializeCallback( done)); @@ -15706,6 +16395,8 @@ public final void callMethod( case 13: return edu.brown.hstore.Hstoreservice.HeartbeatRequest.getDefaultInstance(); case 14: + return edu.brown.hstore.Hstoreservice.UnevictDataRequest.getDefaultInstance(); + case 15: return edu.brown.hstore.Hstoreservice.TimeSyncRequest.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); @@ -15750,6 +16441,8 @@ public final void callMethod( case 13: return edu.brown.hstore.Hstoreservice.HeartbeatResponse.getDefaultInstance(); case 14: + return edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDefaultInstance(); + case 15: return edu.brown.hstore.Hstoreservice.TimeSyncResponse.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); @@ -15982,12 +16675,27 @@ public void heartbeat( edu.brown.hstore.Hstoreservice.HeartbeatResponse.getDefaultInstance())); } + public void unevictData( + com.google.protobuf.RpcController controller, + edu.brown.hstore.Hstoreservice.UnevictDataRequest request, + com.google.protobuf.RpcCallback done) { + channel.callMethod( + getDescriptor().getMethods().get(14), + controller, + request, + edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDefaultInstance(), + com.google.protobuf.RpcUtil.generalizeCallback( + done, + edu.brown.hstore.Hstoreservice.UnevictDataResponse.class, + edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDefaultInstance())); + } + public void timeSync( com.google.protobuf.RpcController controller, edu.brown.hstore.Hstoreservice.TimeSyncRequest request, com.google.protobuf.RpcCallback done) { channel.callMethod( - getDescriptor().getMethods().get(14), + getDescriptor().getMethods().get(15), controller, request, edu.brown.hstore.Hstoreservice.TimeSyncResponse.getDefaultInstance(), @@ -16074,6 +16782,11 @@ public edu.brown.hstore.Hstoreservice.HeartbeatResponse heartbeat( edu.brown.hstore.Hstoreservice.HeartbeatRequest request) throws com.google.protobuf.ServiceException; + public edu.brown.hstore.Hstoreservice.UnevictDataResponse unevictData( + com.google.protobuf.RpcController controller, + edu.brown.hstore.Hstoreservice.UnevictDataRequest request) + throws com.google.protobuf.ServiceException; + public edu.brown.hstore.Hstoreservice.TimeSyncResponse timeSync( com.google.protobuf.RpcController controller, edu.brown.hstore.Hstoreservice.TimeSyncRequest request) @@ -16255,12 +16968,24 @@ public edu.brown.hstore.Hstoreservice.HeartbeatResponse heartbeat( } + public edu.brown.hstore.Hstoreservice.UnevictDataResponse unevictData( + com.google.protobuf.RpcController controller, + edu.brown.hstore.Hstoreservice.UnevictDataRequest request) + throws com.google.protobuf.ServiceException { + return (edu.brown.hstore.Hstoreservice.UnevictDataResponse) channel.callBlockingMethod( + getDescriptor().getMethods().get(14), + controller, + request, + edu.brown.hstore.Hstoreservice.UnevictDataResponse.getDefaultInstance()); + } + + public edu.brown.hstore.Hstoreservice.TimeSyncResponse timeSync( com.google.protobuf.RpcController controller, edu.brown.hstore.Hstoreservice.TimeSyncRequest request) throws com.google.protobuf.ServiceException { return (edu.brown.hstore.Hstoreservice.TimeSyncResponse) channel.callBlockingMethod( - getDescriptor().getMethods().get(14), + getDescriptor().getMethods().get(15), controller, request, edu.brown.hstore.Hstoreservice.TimeSyncResponse.getDefaultInstance()); @@ -16429,6 +17154,16 @@ public edu.brown.hstore.Hstoreservice.TimeSyncResponse timeSync( private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_edu_brown_hstore_HeartbeatResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_edu_brown_hstore_UnevictDataRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_edu_brown_hstore_UnevictDataRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_edu_brown_hstore_UnevictDataResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_edu_brown_hstore_UnevictDataResponse_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_edu_brown_hstore_TimeSyncRequest_descriptor; private static @@ -16548,54 +17283,61 @@ public edu.brown.hstore.Hstoreservice.TimeSyncResponse timeSync( "\020HeartbeatRequest\022\023\n\013sender_site\030\001 \002(\005\022\033" + "\n\023last_transaction_id\030\002 \002(\003\"R\n\021Heartbeat" + "Response\022\023\n\013sender_site\030\001 \002(\005\022(\n\006status\030", - "\002 \002(\0162\030.edu.brown.hstore.Status\"4\n\017TimeS" + - "yncRequest\022\023\n\013sender_site\030\001 \002(\005\022\014\n\004t0_s\030" + - "\002 \002(\003\"Q\n\020TimeSyncResponse\022\023\n\013sender_site" + - "\030\001 \002(\005\022\014\n\004t0_s\030\002 \002(\003\022\014\n\004t0_r\030\003 \002(\003\022\014\n\004t1" + - "_s\030\004 \002(\003*\320\001\n\006Status\022\006\n\002OK\020\000\022\016\n\nABORT_USE" + - "R\020\001\022\022\n\016ABORT_GRACEFUL\020\002\022\024\n\020ABORT_UNEXPEC" + - "TED\020\003\022\031\n\025ABORT_CONNECTION_LOST\020\004\022\024\n\020ABOR" + - "T_MISPREDICT\020\005\022\021\n\rABORT_RESTART\020\006\022\020\n\014ABO" + - "RT_REJECT\020\007\022\027\n\023ABORT_EVICTEDACCESS\020\010\022\025\n\021" + - "ABORT_SPECULATIVE\020\t2\372\013\n\rHStoreService\022f\n", - "\017TransactionInit\022(.edu.brown.hstore.Tran" + - "sactionInitRequest\032).edu.brown.hstore.Tr" + - "ansactionInitResponse\022f\n\017TransactionWork" + - "\022(.edu.brown.hstore.TransactionWorkReque" + - "st\032).edu.brown.hstore.TransactionWorkRes" + - "ponse\022x\n\023TransactionPrefetch\022+.edu.brown" + - ".hstore.TransactionPrefetchResult\0324.edu." + - "brown.hstore.TransactionPrefetchAcknowle" + - "dgement\022c\n\016TransactionMap\022\'.edu.brown.hs" + - "tore.TransactionMapRequest\032(.edu.brown.h", - "store.TransactionMapResponse\022l\n\021Transact" + - "ionReduce\022*.edu.brown.hstore.Transaction" + - "ReduceRequest\032+.edu.brown.hstore.Transac" + - "tionReduceResponse\022o\n\022TransactionPrepare" + - "\022+.edu.brown.hstore.TransactionPrepareRe" + - "quest\032,.edu.brown.hstore.TransactionPrep" + - "areResponse\022l\n\021TransactionFinish\022*.edu.b" + - "rown.hstore.TransactionFinishRequest\032+.e" + - "du.brown.hstore.TransactionFinishRespons" + - "e\022r\n\023TransactionRedirect\022,.edu.brown.hst", - "ore.TransactionRedirectRequest\032-.edu.bro" + - "wn.hstore.TransactionRedirectResponse\022i\n" + - "\020TransactionDebug\022).edu.brown.hstore.Tra" + - "nsactionDebugRequest\032*.edu.brown.hstore." + - "TransactionDebugResponse\022Q\n\010SendData\022!.e" + - "du.brown.hstore.SendDataRequest\032\".edu.br" + - "own.hstore.SendDataResponse\022W\n\nInitializ" + - "e\022#.edu.brown.hstore.InitializeRequest\032$" + - ".edu.brown.hstore.InitializeResponse\022f\n\017" + - "ShutdownPrepare\022(.edu.brown.hstore.Shutd", - "ownPrepareRequest\032).edu.brown.hstore.Shu" + - "tdownPrepareResponse\022Q\n\010Shutdown\022!.edu.b" + - "rown.hstore.ShutdownRequest\032\".edu.brown." + - "hstore.ShutdownResponse\022T\n\tHeartbeat\022\".e" + - "du.brown.hstore.HeartbeatRequest\032#.edu.b" + - "rown.hstore.HeartbeatResponse\022Q\n\010TimeSyn" + - "c\022!.edu.brown.hstore.TimeSyncRequest\032\".e" + - "du.brown.hstore.TimeSyncResponse" + "\002 \002(\0162\030.edu.brown.hstore.Status\"F\n\022Unevi" + + "ctDataRequest\022\023\n\013sender_site\030\001 \002(\005\022\033\n\023la" + + "st_transaction_id\030\002 \002(\003\"T\n\023UnevictDataRe" + + "sponse\022\023\n\013sender_site\030\001 \002(\005\022(\n\006status\030\002 " + + "\002(\0162\030.edu.brown.hstore.Status\"4\n\017TimeSyn" + + "cRequest\022\023\n\013sender_site\030\001 \002(\005\022\014\n\004t0_s\030\002 " + + "\002(\003\"Q\n\020TimeSyncResponse\022\023\n\013sender_site\030\001" + + " \002(\005\022\014\n\004t0_s\030\002 \002(\003\022\014\n\004t0_r\030\003 \002(\003\022\014\n\004t1_s" + + "\030\004 \002(\003*\320\001\n\006Status\022\006\n\002OK\020\000\022\016\n\nABORT_USER\020" + + "\001\022\022\n\016ABORT_GRACEFUL\020\002\022\024\n\020ABORT_UNEXPECTE", + "D\020\003\022\031\n\025ABORT_CONNECTION_LOST\020\004\022\024\n\020ABORT_" + + "MISPREDICT\020\005\022\021\n\rABORT_RESTART\020\006\022\020\n\014ABORT" + + "_REJECT\020\007\022\027\n\023ABORT_EVICTEDACCESS\020\010\022\025\n\021AB" + + "ORT_SPECULATIVE\020\t2\326\014\n\rHStoreService\022f\n\017T" + + "ransactionInit\022(.edu.brown.hstore.Transa" + + "ctionInitRequest\032).edu.brown.hstore.Tran" + + "sactionInitResponse\022f\n\017TransactionWork\022(" + + ".edu.brown.hstore.TransactionWorkRequest" + + "\032).edu.brown.hstore.TransactionWorkRespo" + + "nse\022x\n\023TransactionPrefetch\022+.edu.brown.h", + "store.TransactionPrefetchResult\0324.edu.br" + + "own.hstore.TransactionPrefetchAcknowledg" + + "ement\022c\n\016TransactionMap\022\'.edu.brown.hsto" + + "re.TransactionMapRequest\032(.edu.brown.hst" + + "ore.TransactionMapResponse\022l\n\021Transactio" + + "nReduce\022*.edu.brown.hstore.TransactionRe" + + "duceRequest\032+.edu.brown.hstore.Transacti" + + "onReduceResponse\022o\n\022TransactionPrepare\022+" + + ".edu.brown.hstore.TransactionPrepareRequ" + + "est\032,.edu.brown.hstore.TransactionPrepar", + "eResponse\022l\n\021TransactionFinish\022*.edu.bro" + + "wn.hstore.TransactionFinishRequest\032+.edu" + + ".brown.hstore.TransactionFinishResponse\022" + + "r\n\023TransactionRedirect\022,.edu.brown.hstor" + + "e.TransactionRedirectRequest\032-.edu.brown" + + ".hstore.TransactionRedirectResponse\022i\n\020T" + + "ransactionDebug\022).edu.brown.hstore.Trans" + + "actionDebugRequest\032*.edu.brown.hstore.Tr" + + "ansactionDebugResponse\022Q\n\010SendData\022!.edu" + + ".brown.hstore.SendDataRequest\032\".edu.brow", + "n.hstore.SendDataResponse\022W\n\nInitialize\022" + + "#.edu.brown.hstore.InitializeRequest\032$.e" + + "du.brown.hstore.InitializeResponse\022f\n\017Sh" + + "utdownPrepare\022(.edu.brown.hstore.Shutdow" + + "nPrepareRequest\032).edu.brown.hstore.Shutd" + + "ownPrepareResponse\022Q\n\010Shutdown\022!.edu.bro" + + "wn.hstore.ShutdownRequest\032\".edu.brown.hs" + + "tore.ShutdownResponse\022T\n\tHeartbeat\022\".edu" + + ".brown.hstore.HeartbeatRequest\032#.edu.bro" + + "wn.hstore.HeartbeatResponse\022Z\n\013UnevictDa", + "ta\022$.edu.brown.hstore.UnevictDataRequest" + + "\032%.edu.brown.hstore.UnevictDataResponse\022" + + "Q\n\010TimeSync\022!.edu.brown.hstore.TimeSyncR" + + "equest\032\".edu.brown.hstore.TimeSyncRespon" + + "se" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -16858,8 +17600,24 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( new java.lang.String[] { "SenderSite", "Status", }, edu.brown.hstore.Hstoreservice.HeartbeatResponse.class, edu.brown.hstore.Hstoreservice.HeartbeatResponse.Builder.class); - internal_static_edu_brown_hstore_TimeSyncRequest_descriptor = + internal_static_edu_brown_hstore_UnevictDataRequest_descriptor = getDescriptor().getMessageTypes().get(31); + internal_static_edu_brown_hstore_UnevictDataRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_edu_brown_hstore_UnevictDataRequest_descriptor, + new java.lang.String[] { "SenderSite", "LastTransactionId", }, + edu.brown.hstore.Hstoreservice.UnevictDataRequest.class, + edu.brown.hstore.Hstoreservice.UnevictDataRequest.Builder.class); + internal_static_edu_brown_hstore_UnevictDataResponse_descriptor = + getDescriptor().getMessageTypes().get(32); + internal_static_edu_brown_hstore_UnevictDataResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_edu_brown_hstore_UnevictDataResponse_descriptor, + new java.lang.String[] { "SenderSite", "Status", }, + edu.brown.hstore.Hstoreservice.UnevictDataResponse.class, + edu.brown.hstore.Hstoreservice.UnevictDataResponse.Builder.class); + internal_static_edu_brown_hstore_TimeSyncRequest_descriptor = + getDescriptor().getMessageTypes().get(33); internal_static_edu_brown_hstore_TimeSyncRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_edu_brown_hstore_TimeSyncRequest_descriptor, @@ -16867,7 +17625,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( edu.brown.hstore.Hstoreservice.TimeSyncRequest.class, edu.brown.hstore.Hstoreservice.TimeSyncRequest.Builder.class); internal_static_edu_brown_hstore_TimeSyncResponse_descriptor = - getDescriptor().getMessageTypes().get(32); + getDescriptor().getMessageTypes().get(34); internal_static_edu_brown_hstore_TimeSyncResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_edu_brown_hstore_TimeSyncResponse_descriptor, diff --git a/src/protorpc/edu/brown/hstore/hstoreservice.proto b/src/protorpc/edu/brown/hstore/hstoreservice.proto index 13fcedc283..ebf8b8d84e 100644 --- a/src/protorpc/edu/brown/hstore/hstoreservice.proto +++ b/src/protorpc/edu/brown/hstore/hstoreservice.proto @@ -460,6 +460,21 @@ message HeartbeatResponse { required Status status = 2; } +// ----------------------------------- +// NODE UNEVICTDATA MESSAGES +// ----------------------------------- + +message UnevictDataRequest { + required int32 sender_site = 1; + // This is the largest txn acked at the sender site + required int64 last_transaction_id = 2; +} + +message UnevictDataResponse { + required int32 sender_site = 1; + required Status status = 2; +} + // ----------------------------------- // TIME SYNC MESSAGE // ----------------------------------- @@ -502,5 +517,6 @@ service HStoreService { rpc ShutdownPrepare(ShutdownPrepareRequest) returns (ShutdownPrepareResponse); rpc Shutdown(ShutdownRequest) returns (ShutdownResponse); rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse); + rpc UnevictData(UnevictDataRequest) returns (UnevictDataResponse); rpc TimeSync(TimeSyncRequest) returns (TimeSyncResponse); } diff --git a/tests/frontend/edu/brown/hstore/MockHStoreCoordinator.java b/tests/frontend/edu/brown/hstore/MockHStoreCoordinator.java index 9dff1bb42e..f8ab6350d5 100644 --- a/tests/frontend/edu/brown/hstore/MockHStoreCoordinator.java +++ b/tests/frontend/edu/brown/hstore/MockHStoreCoordinator.java @@ -36,6 +36,8 @@ import edu.brown.hstore.Hstoreservice.TransactionReduceResponse; import edu.brown.hstore.Hstoreservice.TransactionWorkRequest; import edu.brown.hstore.Hstoreservice.TransactionWorkResponse; +import edu.brown.hstore.Hstoreservice.UnevictDataRequest; +import edu.brown.hstore.Hstoreservice.UnevictDataResponse; import edu.brown.logging.LoggerUtil; import edu.brown.logging.LoggerUtil.LoggerBoolean; import edu.brown.utils.EventObservable; @@ -207,6 +209,14 @@ public void transactionDebug(RpcController controller, TransactionDebugRequest r // TODO Auto-generated method stub } + + @Override + public void unevictData(RpcController controller, + UnevictDataRequest request, + RpcCallback done) { + // TODO Auto-generated method stub + + } } } diff --git a/tests/frontend/edu/brown/hstore/MockHStoreSite.java b/tests/frontend/edu/brown/hstore/MockHStoreSite.java index 307e962064..c3bdcdbce5 100644 --- a/tests/frontend/edu/brown/hstore/MockHStoreSite.java +++ b/tests/frontend/edu/brown/hstore/MockHStoreSite.java @@ -55,6 +55,8 @@ static LocalTransaction makeLocalTransaction(HStoreSite hstore_site) { EstTimeUpdater.update(System.currentTimeMillis()); return (ts); } + + private HStoreCoordinator hstore_coordinator; // ---------------------------------------------------------------------------- // INITIALIZATION @@ -80,6 +82,15 @@ public MockHStoreSite(int site_id, CatalogContext catalogContext, HStoreConf hst } // FOR } + public void setCoordinator(){ + this.hstore_coordinator = this.initHStoreCoordinator(); + } + + @Override + public HStoreCoordinator getCoordinator(){ + return this.hstore_coordinator; + } + @Override public HStoreCoordinator initHStoreCoordinator() { return new MockHStoreCoordinator(this); diff --git a/tests/frontend/edu/brown/hstore/TestAntiCacheManager.java b/tests/frontend/edu/brown/hstore/TestAntiCacheManager.java index 3237dfaa14..cb09978837 100644 --- a/tests/frontend/edu/brown/hstore/TestAntiCacheManager.java +++ b/tests/frontend/edu/brown/hstore/TestAntiCacheManager.java @@ -380,5 +380,4 @@ public void testReadNonExistentBlock() throws Exception { } assertTrue(failed); } - } diff --git a/tests/frontend/edu/brown/hstore/TestAntiCacheManagerDistributedTxn.java b/tests/frontend/edu/brown/hstore/TestAntiCacheManagerDistributedTxn.java new file mode 100644 index 0000000000..9826bce451 --- /dev/null +++ b/tests/frontend/edu/brown/hstore/TestAntiCacheManagerDistributedTxn.java @@ -0,0 +1,273 @@ +package edu.brown.hstore; + +import java.io.File; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.channels.ServerSocketChannel; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.voltdb.SysProcSelector; +import org.voltdb.VoltTable; +import org.voltdb.catalog.Partition; +import org.voltdb.catalog.Site; +import org.voltdb.catalog.Table; +import org.voltdb.client.Client; +import org.voltdb.jni.ExecutionEngine; +import org.voltdb.utils.VoltTableUtil; + +import edu.brown.BaseTestCase; +import edu.brown.benchmark.AbstractProjectBuilder; +import edu.brown.benchmark.ycsb.YCSBConstants; +import edu.brown.benchmark.ycsb.YCSBProjectBuilder; +import edu.brown.catalog.CatalogUtil; +import edu.brown.hstore.TestHStoreCoordinator.AssertThreadGroup; +import edu.brown.hstore.conf.HStoreConf; +import edu.brown.hstore.txns.LocalTransaction; +import edu.brown.utils.CollectionUtil; +import edu.brown.utils.FileUtil; +import edu.brown.utils.ProjectType; +import edu.brown.utils.ThreadUtil; + +public class TestAntiCacheManagerDistributedTxn extends BaseTestCase { + + private static final int NUM_PARTITIONS = 1; + private static final int NUM_TUPLES = 100000; + private static final String TARGET_TABLE = YCSBConstants.TABLE_NAME; + + private static final String statsFields[] = { + "ANTICACHE_TUPLES_EVICTED", + "ANTICACHE_BLOCKS_EVICTED", + "ANTICACHE_BYTES_EVICTED" + }; + + + private MockHStoreSite hstore_sites[] = new MockHStoreSite[2]; + private HStoreCoordinator coordinators[] = new HStoreCoordinator[2]; + + private HStoreConf hstore_conf; + private File anticache_dir; + private Client client; + + private PartitionExecutor executor; + private ExecutionEngine ee; + private Table catalog_tbl; + private int locators[]; + + private final AbstractProjectBuilder builder = new YCSBProjectBuilder() { + { + this.markTableEvictable(TARGET_TABLE); + this.addAllDefaults(); + this.addStmtProcedure("GetRecord", + "SELECT * FROM " + TARGET_TABLE + " WHERE ycsb_key = ?"); + } + }; + + + @Before + public void setUp() throws Exception { + super.setUp(builder, false); + this.anticache_dir = FileUtil.getTempDirectory(); + + // Just make sure that the Table has the evictable flag set to true + this.catalog_tbl = getTable(TARGET_TABLE); + assertTrue(catalog_tbl.getEvictable()); + this.locators = new int[] { catalog_tbl.getRelativeIndex() }; + + // Create a fake cluster of two HStoreSites, each with two partitions + // This will allow us to test same site communication as well as cross-site communication + this.initializeCatalog(1, 2, NUM_PARTITIONS); + for (int i = 0; i < 2; i++) { + this.hstore_conf = HStoreConf.singleton(); + this.hstore_conf.site.status_enable = false; + this.hstore_conf.site.anticache_enable = true; + this.hstore_conf.site.anticache_profiling = true; + this.hstore_conf.site.anticache_check_interval = Integer.MAX_VALUE; + this.hstore_conf.site.anticache_dir = this.anticache_dir.getAbsolutePath(); + this.hstore_conf.site.coordinator_sync_time = false; + + this.hstore_sites[i] = new MockHStoreSite(i, catalogContext, hstore_conf); + this.hstore_sites[i].setCoordinator(); + this.coordinators[i] = this.hstore_sites[i].getCoordinator(); + int p_id = CollectionUtil.first(this.hstore_sites[i].getLocalPartitionIds()); + MockPartitionExecutor es = new MockPartitionExecutor(p_id, catalogContext, p_estimator); + this.hstore_sites[i].addPartitionExecutor(p_id, es); + if(i == 0){ + this.executor = es; + assertNotNull(this.executor); + this.ee = executor.getExecutionEngine(); + assertNotNull(this.executor); + } + + + } // FOR + + this.startMessengers(); + + + System.err.println("All HStoreCoordinators started!"); + } + + @Override + protected void tearDown() throws Exception { + System.err.println("TEAR DOWN!"); + super.tearDown(); + this.stopMessengers(); + + // Check to make sure all of the ports are free for each messenger + for (HStoreCoordinator m : this.coordinators) { + // assert(m.isStopped()) : "Site #" + m.getLocalSiteId() + " wasn't stopped"; + int port = m.getLocalMessengerPort(); + ServerSocketChannel channel = ServerSocketChannel.open(); + try { + channel.socket().bind(new InetSocketAddress(port)); + } catch (IOException ex) { + ex.printStackTrace(); + assert(false) : "Messenger port #" + port + " for Site #" + m.getLocalSiteId() + " isn't open: " + ex.getLocalizedMessage(); + } finally { + channel.close(); + Thread.yield(); + } + } // FOR + FileUtil.deleteDirectory(this.anticache_dir); + } + /** + * To keep track out how many threads fail + */ + public class AssertThreadGroup extends ThreadGroup { + private List exceptions = new ArrayList(); + + public AssertThreadGroup() { + super("Assert"); + } + public void uncaughtException(Thread t, Throwable e) { + e.printStackTrace(); + this.exceptions.add(e); + } + } + + /** + * Start all of the HStoreMessengers + * @throws Exception + */ + private void startMessengers() throws Exception { + // We have to fire of threads in parallel because HStoreMessenger.start() blocks! + List threads = new ArrayList(); + AssertThreadGroup group = new AssertThreadGroup(); + for (final HStoreCoordinator m : this.coordinators) { + threads.add(new Thread(group, "Site#" + m.getLocalSiteId()) { + @Override + public void run() { + System.err.println("START: " + m); + m.start(); + } + }); + } // FOR + ThreadUtil.runNewPool(threads); + if (group.exceptions.isEmpty() == false) stopMessengers(); + assert(group.exceptions.isEmpty()) : group.exceptions; + } + + /** + * Stop all of the HStoreMessengers + * @throws Exception + */ + private void stopMessengers() throws Exception { + // Tell everyone to prepare to stop + for (final HStoreCoordinator m : this.coordinators) { + if (m.isStarted()) { + System.err.println("PREPARE: " + m); + m.prepareShutdown(false); + } + } // FOR + // Now stop everyone for real! + for (final HStoreCoordinator m : this.coordinators) { + if (m.isShuttingDown()) { + System.err.println("STOP: " + m); + m.shutdown(); + } + } // FOR + } + + + // -------------------------------------------------------------------------------------------- + // UTILITY METHODS + // -------------------------------------------------------------------------------------------- + + private void loadData() throws Exception { + // Load in a bunch of dummy data for this table + VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl); + assertNotNull(vt); + for (int i = 0; i < NUM_TUPLES; i++) { + Object row[] = VoltTableUtil.getRandomRow(catalog_tbl); + row[0] = i; + vt.addRow(row); + } // FOR + this.executor.loadTable(1000l, catalog_tbl, vt, false); + + VoltTable stats[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L); + assertEquals(1, stats.length); + System.err.println(VoltTableUtil.format(stats)); + } + + private VoltTable evictData() throws Exception { + VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L); + assertEquals(1, results.length); + // System.err.println(VoltTableUtil.format(results)); + for (String col : statsFields) { + results[0].advanceRow(); + int idx = results[0].getColumnIndex(col); + assertEquals(0, results[0].getLong(idx)); + } // FOR + + // Now force the EE to evict our boys out + // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples + VoltTable evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 1024 * 500, 1); + + System.err.println("-------------------------------"); + System.err.println(VoltTableUtil.format(evictResult)); + assertNotNull(evictResult); + assertEquals(1, evictResult.getRowCount()); + //assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount()); + evictResult.resetRowPosition(); + boolean adv = evictResult.advanceRow(); + assertTrue(adv); + return (evictResult); + } + + + // -------------------------------------------------------------------------------------------- + // TEST CASES + // -------------------------------------------------------------------------------------------- + + @Test + public void testQueueingOfTransaction() throws Exception { + AntiCacheManager manager = hstore_sites[0].getAntiCacheManager(); + short block_ids[] = new short[]{ 1111 }; + int tuple_offsets[] = new int[]{0}; + int partition_id = 0; + this.hstore_conf.site.anticache_profiling = false; + LocalTransaction txn = MockHStoreSite.makeLocalTransaction(hstore_sites[0]); + + assertTrue(manager.queue(txn, partition_id, catalog_tbl, block_ids, tuple_offsets)); + + } + + @Test + public void testQueueingOfDistributedTransaction() throws Exception { + AntiCacheManager manager = hstore_sites[0].getAntiCacheManager(); + short block_ids[] = new short[]{ 1111 }; + int tuple_offsets[] = new int[]{0}; + // different from the base partition. This means the exception was + // thrown by a remote site + this.hstore_conf.site.anticache_profiling = false; + LocalTransaction txn = MockHStoreSite.makeLocalTransaction(hstore_sites[0]); + int partition_id = CollectionUtil.first(this.hstore_sites[1].getLocalPartitionIds()); + + assertTrue(manager.queue(txn, partition_id, catalog_tbl, block_ids, tuple_offsets)); + + } + +}